Search in sources :

Example 81 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class SimpleModelExample method createControls.

/**
     * Create the controls that compose the console test.
     * 
     */
protected void createControls() {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
    _jt.setLayoutData(gd);
    if (_tableModel == null) {
        SimpleJaretTableModel model = new SimpleJaretTableModel();
        for (int x = 0; x <= NUMCOLS; x++) {
            model.setHeaderLabel(x, "" + x);
            for (int y = 0; y <= NUMROWS; y++) {
                model.setValueAt(x, y, x + "/" + y);
            }
        }
        _tableModel = model;
    }
    _jt.setTableModel(_tableModel);
    // set rowheight mode to variable .. optimal would be quite expensive on each col resize
    _jt.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE);
    for (int i = 0; i < NUMCOLS; i++) {
        IColumn col = _tableModel.getColumn(i);
        _jt.getTableViewState().setColumnWidth(col, 40);
    }
    JaretTableActionFactory af = new JaretTableActionFactory();
    MenuManager mm = new MenuManager();
    mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
    _jt.setHeaderContextMenu(mm.createContextMenu(_jt));
    MenuManager rm = new MenuManager();
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
    _jt.setRowContextMenu(rm.createContextMenu(_jt));
    TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) IColumn(de.jaret.util.ui.table.model.IColumn) JaretTable(de.jaret.util.ui.table.JaretTable) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) SimpleJaretTableModel(de.jaret.util.ui.table.model.simple.SimpleJaretTableModel) JaretTableActionFactory(de.jaret.util.ui.table.util.action.JaretTableActionFactory)

Example 82 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class SelectionStatusDialog method createButtonBar.

/*
     * @see Dialog#createButtonBar(Composite)
     */
protected Control createButtonBar(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    if (!fStatusLineAboveButtons) {
        layout.numColumns = 2;
    }
    layout.marginHeight = 0;
    layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);
    if (!fStatusLineAboveButtons && isHelpAvailable()) {
        createHelpControl(composite);
    }
    fStatusLine = new MessageLine(composite);
    fStatusLine.setAlignment(SWT.LEFT);
    GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
    fStatusLine.setErrorStatus(null);
    fStatusLine.setFont(font);
    if (fStatusLineAboveButtons && isHelpAvailable()) {
        statusData.horizontalSpan = 2;
        createHelpControl(composite);
    }
    fStatusLine.setLayoutData(statusData);
    /*
		 * Create the rest of the button bar, but tell it not to
		 * create a help button (we've already created it).
		 */
    boolean helpAvailable = isHelpAvailable();
    setHelpAvailable(false);
    super.createButtonBar(composite);
    setHelpAvailable(helpAvailable);
    return composite;
}
Also used : MessageLine(org.eclipse.ui.internal.MessageLine) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Font(org.eclipse.swt.graphics.Font)

Example 83 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class HsImageLabel method doComputeSize.

protected Point doComputeSize(int width) {
    Point bodySize = getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    if (descriptionLabel != null) {
        GridData gd = (GridData) descriptionLabel.getLayoutData();
        gd.widthHint = bodySize.x + width;
        descriptionLabel.setText(description);
    }
    return bodySize;
}
Also used : GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Example 84 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class HsImageLabel method createControl.

public Composite createControl(Composite parent) {
    parent.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            dispose();
        }
    });
    Composite content = new Composite(parent, SWT.NONE);
    GridLayout contentLayout = new GridLayout(2, false);
    contentLayout.marginWidth = 0;
    contentLayout.marginHeight = 0;
    content.setLayout(contentLayout);
    content.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.control = content;
    imageLabel = createImageLabel(content);
    if (imageLabel != null) {
        imageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    }
    Composite composite = new Composite(content, SWT.NONE);
    GridLayout comLayout = new GridLayout();
    comLayout.marginWidth = 0;
    comLayout.marginHeight = 0;
    composite.setLayout(comLayout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    descriptionLabel = createDescriptionLabel(composite);
    if (descriptionLabel != null) {
        descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }
    body = new Composite(composite, SWT.NONE);
    GridLayout gd = new GridLayout();
    gd.marginRight = 0;
    gd.marginHeight = 0;
    body.setLayout(gd);
    if (body != null) {
        body.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    return body;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Example 85 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class TSWizardDialog method createDialogArea.

/*
	 * (non-Javadoc) Method declared on Dialog.
	 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    // Build the Page container
    pageContainer = createPageContainer(composite);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = pageWidth;
    gd.heightHint = pageHeight;
    pageContainer.setLayoutData(gd);
    pageContainer.setFont(parent.getFont());
    // Insert a progress monitor
    progressMonitorPart = createProgressMonitorPart(composite, new GridLayout());
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    progressMonitorPart.setLayoutData(gridData);
    progressMonitorPart.setVisible(false);
    // Build the separator line
    Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    applyDialogFont(progressMonitorPart);
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2385 GridLayout (org.eclipse.swt.layout.GridLayout)1659 Composite (org.eclipse.swt.widgets.Composite)1448 Label (org.eclipse.swt.widgets.Label)982 Button (org.eclipse.swt.widgets.Button)732 SelectionEvent (org.eclipse.swt.events.SelectionEvent)719 Text (org.eclipse.swt.widgets.Text)578 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)577 Group (org.eclipse.swt.widgets.Group)509 Combo (org.eclipse.swt.widgets.Combo)234 ModifyListener (org.eclipse.swt.events.ModifyListener)225 ModifyEvent (org.eclipse.swt.events.ModifyEvent)214 SelectionListener (org.eclipse.swt.events.SelectionListener)213 Table (org.eclipse.swt.widgets.Table)196 Point (org.eclipse.swt.graphics.Point)167 TableViewer (org.eclipse.jface.viewers.TableViewer)162 FillLayout (org.eclipse.swt.layout.FillLayout)134 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)118 Control (org.eclipse.swt.widgets.Control)117 Image (org.eclipse.swt.graphics.Image)114