Search in sources :

Example 1 with Composite

use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.

the class NewActionChangeDialog method addMoreFields.

@Override
protected void addMoreFields() {
    GridData reqLayout;
    if (complaint != null) {
        reqLayout = new GridData();
        reqLayout.grabExcessHorizontalSpace = true;
        reqLayout.horizontalSpan = 4;
        complaintLabel = new Label(dialog, SWT.NONE);
        complaintLabel.setText(complaint);
        complaintLabel.setLayoutData(reqLayout);
        complaintLabel.setFont(FontUtils.SYMBOL_FONT);
        complaintMode = properties.useWhichParts;
    }
    reqLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    reqLayout.grabExcessHorizontalSpace = true;
    reqLayout.horizontalSpan = 4;
    Composite c = new Composite(dialog, SWT.NONE);
    c.setLayoutData(reqLayout);
    propertySet = new ActionChangePropertySet(deviceTypes, c, this) {

        protected ActionProperties testEnableProps = new ActionProperties(ActionProperties.UNSET);

        @Override
        protected boolean userSelectedMode(int widgetMode) {
            boolean enableOK = super.userSelectedMode(widgetMode);
            if (complaintLabel != null) {
                complaintLabel.setVisible(widgetMode == complaintMode);
            }
            return enableOK;
        }

        @Override
        protected void enableOKButton(boolean enable) {
            // the OK button should be otherwise enabled
            if (enable) {
                if ((transitionSrc != null) && (properties != null)) {
                    propertySet.getProperties(testEnableProps);
                    AAction action = testEnableProps.buildAction();
                    Transition existingTransition = transitionSrc.getTransition(action);
                    if ((action != null) && (existingTransition != null)) {
                        enable = false;
                    }
                }
            }
            super.enableOKButton(enable);
        }
    };
    propertySet.layOutPropertiesPane();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Transition(edu.cmu.cs.hcii.cogtool.model.Transition) AAction(edu.cmu.cs.hcii.cogtool.model.AAction) ActionChangePropertySet(edu.cmu.cs.hcii.cogtool.view.ActionChangePropertySet)

Example 2 with Composite

use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.

the class Keypad method makeNumbers.

/**
     * Creates and lays out the buttons for the keypad's number pad.
     *
     * @author Paul Rubritz (ptr@andrew.cmu.edu)
     */
protected void makeNumbers() {
    GridLayout grid = new GridLayout();
    grid.numColumns = 3;
    GridData gridKeysOption = new GridData();
    gridKeysOption.horizontalIndent = (keypadType == FULL_KEYPAD) ? 60 : 0;
    gridKeysOption.verticalAlignment = SWT.TOP;
    Composite numbers = new Composite(dialog, SWT.NONE);
    numbers.setLayoutData(gridKeysOption);
    numbers.setLayout(grid);
    Button keypadButton;
    for (int i = 0; i < numberKeys.length; i++) {
        gridKeysOption = new GridData();
        if (i < numberKeys.length - 1) {
            gridKeysOption.widthHint = 50;
        } else if (keypadType == NUMPAD_ONLY) {
            gridKeysOption.widthHint = 160;
            gridKeysOption.horizontalSpan = 3;
        } else {
            break;
        }
        gridKeysOption.heightHint = 50;
        keypadButton = makeButton(numbers, numberKeys[i], gridKeysOption);
        //       (see IntegerEntry)
        if ((keypadType == NUMPAD_ONLY) && numberKeys[i].equals("-")) {
            keypadButton.setBackground(getDisabledColor());
            keypadButton.setEnabled(false);
        }
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Example 3 with Composite

use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.

the class ActionSet method createGraffitiComposite.

protected Composite createGraffitiComposite() {
    Composite graffitiComp = new Composite(actionSettings, SWT.NONE);
    graffitiComp.setLayout(new FormLayout());
    graffitiTextLabel = new DisplayLabel(graffitiComp, SWT.NONE);
    graffitiTextLabel.setText(L10N.get("DE.GraffitiTextCaption", "Graffiti® Gestures") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionSourceLabelGraffiti = createTransitionSourceLabel(graffitiComp);
    transitionSourceNameGraffiti = createTransitionSourceName(graffitiComp);
    transitionDestinationLabelGraffiti = createTransitionDestinationLabel(graffitiComp);
    transitionDestinationNameGraffiti = createTransitionDestinationName(graffitiComp);
    // TODO: set desired width to something somewhat larger
    graffitiText = createGraffitiText(graffitiComp);
    graffitiIsCmd = new Button(graffitiComp, SWT.CHECK);
    graffitiIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    graffitiIsCmd.addSelectionListener(widgetActionChange);
    return graffitiComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 4 with Composite

use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.

the class ActionChangePropertySet method createKeyComposite.

@Override
protected Composite createKeyComposite() {
    Composite c = super.createKeyComposite();
    keyboardChoice = new Button(actionComposite, SWT.RADIO);
    keyboardChoice.setData(new Integer(ActionSet.USE_KEYBOARD));
    keyboardChoice.addSelectionListener(getActionChoiceListener());
    keyboardChoice.setText(KEYBOARD_LABEL);
    c.setData(keyboardChoice);
    if (actionSettingsLayout.topControl == null) {
        setSelectedActionChoice(keyboardChoice, c, keyboardText);
    }
    return c;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button)

Example 5 with Composite

use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.

the class ActionChangePropertySet method createMouseComposite.

@Override
protected Composite createMouseComposite() {
    Composite c = super.createMouseComposite();
    mouseChoice = new Button(actionComposite, SWT.RADIO);
    mouseChoice.setData(new Integer(ActionSet.USE_MOUSE));
    mouseChoice.addSelectionListener(getActionChoiceListener());
    mouseChoice.setText(MOUSE_LABEL);
    c.setData(mouseChoice);
    if (actionSettingsLayout.topControl == null) {
        setSelectedActionChoice(mouseChoice, c, mouseButtonCombo);
    }
    return c;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)1543 GridData (org.eclipse.swt.layout.GridData)1136 GridLayout (org.eclipse.swt.layout.GridLayout)1098 Label (org.eclipse.swt.widgets.Label)594 SelectionEvent (org.eclipse.swt.events.SelectionEvent)495 Button (org.eclipse.swt.widgets.Button)492 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)421 Text (org.eclipse.swt.widgets.Text)373 Group (org.eclipse.swt.widgets.Group)233 ModifyListener (org.eclipse.swt.events.ModifyListener)152 ModifyEvent (org.eclipse.swt.events.ModifyEvent)149 Combo (org.eclipse.swt.widgets.Combo)135 FillLayout (org.eclipse.swt.layout.FillLayout)131 TableViewer (org.eclipse.jface.viewers.TableViewer)127 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)114 Table (org.eclipse.swt.widgets.Table)112 Point (org.eclipse.swt.graphics.Point)104 SelectionListener (org.eclipse.swt.events.SelectionListener)90 Control (org.eclipse.swt.widgets.Control)88 FormData (org.eclipse.swt.layout.FormData)87