Search in sources :

Example 6 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cogtool by cogtool.

the class ThreadProgressBar method addBelowBar.

@Override
protected void addBelowBar() {
    FormData data = new FormData();
    // at the top of the dialog box otherwise
    if (statusLabel != null) {
        data.top = new FormAttachment(statusLabel, 10, SWT.BOTTOM);
        data.bottom = new FormAttachment(statusLabel, 25, SWT.BOTTOM);
    } else {
        data.top = new FormAttachment(0, 10);
        data.bottom = new FormAttachment(0, 25);
    }
    data.left = new FormAttachment(0, 20);
    data.right = new FormAttachment(100, -20);
    bar.setLayoutData(data);
    // box, tying it to the given cancelable "process" object.
    if (cancelListener != null) {
        cancelButton = new Button(shell, SWT.PUSH);
        cancelButton.setText(L10N.get("B.Cancel", "Cancel"));
        cancelButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent evt) {
                // Called from the main UI thread
                cancelListener.cancel();
                cancelButton.setEnabled(false);
            }
        });
        data = new FormData();
        data.left = new FormAttachment(bar, 0, SWT.CENTER);
        data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
        cancelButton.setLayoutData(data);
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 7 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cogtool by cogtool.

the class ThreadProgressBar method addAboveBar.

@Override
protected void addAboveBar() {
    shell.setLayout(new FormLayout());
    // Add status display area if requested
    if (initialStatus != null) {
        statusLabel = new Label(shell, SWT.NONE);
        statusLabel.setText(initialStatus);
        FormData data = new FormData();
        data.left = new FormAttachment(0, 20);
        data.top = new FormAttachment(0, 10);
        data.right = new FormAttachment(100, -20);
        statusLabel.setLayoutData(data);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Label(org.eclipse.swt.widgets.Label) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 8 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cogtool by cogtool.

the class ActionChangePropertySet method layOutTouchComposite.

@Override
public void layOutTouchComposite() {
    touchActionCombo.addSelectionListener(handleChangeChecks);
    // Center button action label to its associated combo vertically
    // Attach button action label to 5 pixels from the properties left
    FormData data = new FormData();
    data.top = new FormAttachment(touchActionCombo, 0, SWT.CENTER);
    data.left = new FormAttachment(0, 5);
    touchActionLabel.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(0, 5);
    data.left = new FormAttachment(touchActionLabel, 5, SWT.RIGHT);
    data.right = new FormAttachment(100, -5);
    touchActionCombo.setLayoutData(data);
    transitionSourceLabelTouch.setVisible(false);
    transitionSourceNameTouch.setVisible(false);
    transitionDestinationLabelTouch.setVisible(false);
    transitionDestinationNameTouch.setVisible(false);
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 9 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cogtool by cogtool.

the class ActionChangePropertySet method layOutMouseComposite.

@Override
public void layOutMouseComposite() {
    mouseButtonCombo.addSelectionListener(handleChangeChecks);
    mouseActionCombo.addSelectionListener(handleChangeChecks);
    if (buttonModifierSet != null) {
        buttonModifierSet.addSelectionListener(handleChangeChecks);
    }
    // Center mouse button label to its associated combo vertically
    // Attach mouse button label to 5 from the properties left
    FormData data = new FormData();
    data.top = new FormAttachment(mouseButtonCombo, 0, SWT.CENTER);
    data.left = new FormAttachment(0, 5);
    mouseButtonLabel.setLayoutData(data);
    // Attach mouse button combo to 5 pixels from the label's right
    // Attach mouse button combo to 5 from the properties top
    // Attach right of combo to end of the properties space
    data = new FormData();
    data.top = new FormAttachment(0, 5);
    data.left = new FormAttachment(mouseButtonLabel, 5, SWT.RIGHT);
    data.right = new FormAttachment(100, -5);
    mouseButtonCombo.setLayoutData(data);
    // Center button action label to its associated combo vertically
    // Attach button action label to 5 pixels from the properties left
    data = new FormData();
    data.top = new FormAttachment(mouseActionCombo, 0, SWT.CENTER);
    data.left = new FormAttachment(0, 5);
    mouseActionLabel.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(mouseButtonCombo, 0, SWT.LEFT);
    data.top = new FormAttachment(mouseButtonCombo, 5, SWT.BOTTOM);
    data.right = new FormAttachment(100, -5);
    mouseActionCombo.setLayoutData(data);
    transitionSourceLabelMouse.setVisible(false);
    transitionSourceNameMouse.setVisible(false);
    transitionDestinationLabelMouse.setVisible(false);
    transitionDestinationNameMouse.setVisible(false);
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 10 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project cogtool by cogtool.

the class ActionChangePropertySet method layOutVoiceComposite.

@Override
public void layOutVoiceComposite() {
    // Center isCommand state checkbox to associated text
    // Align checkbox 5 pixels from the right edge
    FormData data = new FormData();
    data.top = new FormAttachment(voiceText.getOuter(), 0, SWT.CENTER);
    data.right = new FormAttachment(100, -5);
    voiceIsCmd.setLayoutData(data);
    // Center voice text label to its associated text vertically
    // Attach label to 5 pixels from the properties left
    data = new FormData();
    data.top = new FormAttachment(voiceText.getOuter(), 0, SWT.CENTER);
    data.left = leftAttachment;
    voiceTextLabel.setLayoutData(data);
    // Attach device command text to 5 pixels from the label's right
    // Attach top 5 pixels from the top edge
    // Attach right of combo to 5 before the isCommand checkbox
    data = new FormData();
    data.top = new FormAttachment(0, 5);
    data.left = new FormAttachment(voiceTextLabel, 5, SWT.RIGHT);
    data.right = new FormAttachment(voiceIsCmd, -5, SWT.LEFT);
    voiceText.setLayoutData(data);
    transitionDestinationLabelVoice.setVisible(false);
    transitionDestinationNameVoice.setVisible(false);
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormAttachment (org.eclipse.swt.layout.FormAttachment)228 FormData (org.eclipse.swt.layout.FormData)228 Point (org.eclipse.swt.graphics.Point)87 Button (org.eclipse.swt.widgets.Button)85 Composite (org.eclipse.swt.widgets.Composite)83 FormLayout (org.eclipse.swt.layout.FormLayout)78 Control (org.eclipse.swt.widgets.Control)57 CLabel (org.eclipse.swt.custom.CLabel)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)55 Node (org.talend.designer.core.ui.editor.nodes.Node)49 Label (org.eclipse.swt.widgets.Label)47 GC (org.eclipse.swt.graphics.GC)46 Text (org.eclipse.swt.widgets.Text)39 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)36 SelectionListener (org.eclipse.swt.events.SelectionListener)36 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)34 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)32 GridData (org.eclipse.swt.layout.GridData)32 GridLayout (org.eclipse.swt.layout.GridLayout)28 Group (org.eclipse.swt.widgets.Group)26