Search in sources :

Example 6 with FormLayout

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

the class FrameEditorView method layOutPropertiesPane.

/**
     * Layout the properties pane, with the specific list of device types
     * and the parent to lay them out in.
     */
protected void layOutPropertiesPane(int deviceTypes, Composite pane) {
    pane.setLayout(new FormLayout());
    actionSettings = new Composite(pane, SWT.BORDER);
    actionSettings.setLayout(actionSettingsLayout);
    frameParms = new FramePropertiesPane(actionSettings, SWT.NONE, this);
    widgetParms = new WidgetPropertiesPane(actionSettings, SWT.NONE, this);
    eltGroupParms = new EltGroupPropertiesPane(actionSettings, SWT.NONE, this);
    propLabel = new Label(pane, SWT.CENTER);
    propLabel.setText(FRAME_PROPERTIES);
    Font labelFont = FontUtils.getAdjustedFont(propLabel.getFont(), SWT.BOLD);
    propLabel.setFont(labelFont);
    FormData data = new FormData();
    data.right = new FormAttachment(100, -5);
    data.left = new FormAttachment(0, 5);
    data.top = new FormAttachment(0, 5);
    propLabel.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(0, 5);
    data.top = new FormAttachment(propLabel, 5, SWT.BOTTOM);
    data.right = new FormAttachment(100, -5);
    actionSettings.setLayoutData(data);
    // To get N/A set
    setWidgetName(null);
    // To get N/A set
    setWidgetTitle(null);
    // To get N/A set
    setWidgetAuxText(null);
    widgetParms.hideAttributeWidgets();
    widgetParms.setParameterChoices(deviceTypes);
    actionSettingsLayout.topControl = frameParms;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Font(org.eclipse.swt.graphics.Font) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 7 with FormLayout

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

the class ActionSet method createVoiceComposite.

protected Composite createVoiceComposite() {
    Composite voiceComp = new Composite(actionSettings, SWT.NONE);
    voiceComp.setLayout(new FormLayout());
    voiceTextLabel = new DisplayLabel(voiceComp, SWT.NONE);
    voiceTextLabel.setText(L10N.get("DE.VoiceTextCaption", "Spoken Input") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionDestinationLabelVoice = createTransitionDestinationLabel(voiceComp);
    transitionDestinationNameVoice = createTransitionDestinationName(voiceComp);
    voiceText = createVoiceText(voiceComp);
    voiceIsCmd = new Button(voiceComp, SWT.CHECK);
    voiceIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    voiceIsCmd.addSelectionListener(deviceActionChange);
    return voiceComp;
}
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 8 with FormLayout

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

the class ActionSet method createTouchComposite.

protected Composite createTouchComposite() {
    Composite touchComp = new Composite(actionSettings, SWT.NONE);
    touchComp.setLayout(new FormLayout());
    touchActionLabel = new DisplayLabel(touchComp, SWT.NONE);
    touchActionLabel.setText(L10N.get("DE.ButtonActionCaption", "Action") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionSourceLabelTouch = createTransitionSourceLabel(touchComp);
    transitionSourceNameTouch = createTransitionSourceName(touchComp);
    transitionDestinationLabelTouch = createTransitionDestinationLabel(touchComp);
    transitionDestinationNameTouch = createTransitionDestinationName(touchComp);
    touchActionCombo = new ComboWithEnableFix(touchComp, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (TapPressType element : TapPressType.DISPLAY) {
        touchActionCombo.add(element.toString());
    }
    touchActionCombo.select(0);
    touchActionCombo.addSelectionListener(widgetActionChange);
    return touchComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) TapPressType(edu.cmu.cs.hcii.cogtool.model.TapPressType) Composite(org.eclipse.swt.widgets.Composite) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 9 with FormLayout

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

the class ActionSet method createKeyComposite.

protected Composite createKeyComposite() {
    Composite keyComp = new Composite(actionSettings, SWT.NONE);
    keyComp.setLayout(new FormLayout());
    keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
    keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
    keyboardText = createKeyboardText(keyComp);
    keyboardText.setFont(FontUtils.SYMBOL_FONT);
    keyboardIsCmd = new Button(keyComp, SWT.CHECK);
    keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    keyboardIsCmd.addSelectionListener(deviceActionChange);
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
    transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
    /* TODO: add back in when single character stuff is straightened out
        this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
        this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
                                                  "Action")
                                            + ":");

        this.keyboardActionCombo =
            new ComboWithEnableFix(keyComp,
                                   SWT.DROP_DOWN | SWT.READ_ONLY);

        for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
            this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
        }

        this.keyboardActionCombo.select(0);
        this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
    SelectionListener insertSpecial = new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            Control source = (Control) e.getSource();
            keyboardText.insert((String) source.getData());
            Point selection = keyboardText.getSelection();
            keyboardText.setFocus();
            keyboardText.setSelection(selection);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    // TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
    // can't assign using ?: because Java is stupid
    Control alignTo;
    if (vertical) {
        alignTo = transitionDestinationNameKeyboard;
    } else {
        alignTo = keyboardText.getOuter();
    }
    keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
    return keyComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with FormLayout

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

the class SEDemoView method layOutWindow.

/**
     * Lay out the window including the interactionDrawing editor
     * @param edit
     *
     * @param tableCallback
     */
public void layOutWindow(int deviceTypes, SWTListMultiColumn rowRenderer) {
    Shell shell = getShell();
    // Set up the layouts
    shell.setLayout(new FormLayout());
    // Create a group for the properties on the history
    historyProperties = new Group(shell, SWT.NONE);
    historyProperties.setLayout(new FormLayout());
    if (editable) {
        // Create the delete Item button
        deleteItem = new Button(historyProperties, SWT.PUSH);
        deleteItem.setText(L10N.get("SE.DeleteStep", "Delete Step"));
        deleteItem.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.Delete));
        lIDMap.addWidget(SEDemoLID.Delete, deleteItem, ListenerIdentifierMap.NORMAL);
        //            this.regenerateItem = new Button(this.historyProperties, SWT.PUSH);
        //            this.regenerateItem.setText(L10N.get("SE.RegenerateScript",
        //                                                 "Regenerate Script"));
        //            this.regenerateItem.addSelectionListener(
        //                           new SWTWidgetChangeHandler(SEDemoLID.RegenerateScript));
        //
        //            this.lIDMap.addWidget(SEDemoLID.RegenerateScript,
        //                                  this.regenerateItem,
        //                                  ListenerIdentifierMap.NORMAL);
        // Create the compute button
        computeItem = new Button(historyProperties, SWT.PUSH);
        computeItem.setText(COMPUTE);
        computeItem.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.RecomputeScript));
        lIDMap.addWidget(SEDemoLID.RecomputeScript, computeItem, ListenerIdentifierMap.NORMAL);
    }
    // Script
    scriptStepListLabel = new Label(historyProperties, SWT.CENTER);
    String scriptStepLabel = scriptStepListTitle;
    if (!editable) {
        scriptStepLabel += " (" + VIEW_ONLY + ")";
        scriptStepListLabel.setBackground(NONEDITABLE_COLOR);
    }
    scriptStepListLabel.setText(scriptStepLabel);
    Table scriptStepTable = new Table(historyProperties, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    scriptStepTable.setFont(FontUtils.SYMBOL_FONT);
    scriptSteps = rowRenderer;
    scriptSteps.setTable(scriptStepTable);
    scriptSteps.setColumnTitles(columnTitles);
    if (editable) {
        addHandOnKeyboardToStart(deviceTypes, historyProperties);
    }
    predictionResult = new Label(shell, SWT.LEFT);
    FormData editorData = new FormData();
    editorData.top = new FormAttachment(0, 5);
    editorData.left = new FormAttachment(0, 5);
    editorData.bottom = new FormAttachment(100, -5);
    Label predictionLabel = new Label(shell, SWT.LEFT);
    predictionLabel.setText(predictionTitle);
    predictionLabel.setFont(PREDICTION_LABEL_FONT);
    Button showVisButton = new Button(shell, SWT.PUSH);
    FormData data = new FormData();
    data.top = new FormAttachment(showVisButton, 0, SWT.CENTER);
    data.left = new FormAttachment(historyProperties, 5, SWT.LEFT);
    predictionLabel.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(showVisButton, 0, SWT.CENTER);
    data.left = new FormAttachment(predictionLabel, 5, SWT.RIGHT);
    data.right = new FormAttachment(showVisButton, 0, SWT.LEFT);
    predictionResult.setLayoutData(data);
    showVisButton.setText(SHOW_VISUALIZATION);
    data = new FormData();
    data.top = new FormAttachment(0, 10);
    data.right = new FormAttachment(historyProperties, 0, SWT.RIGHT);
    showVisButton.setLayoutData(data);
    showVisButton.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.ShowModelVisualization));
    lIDMap.addWidget(SEDemoLID.ShowModelVisualization, showVisButton, ListenerIdentifierMap.NORMAL);
    data = new FormData();
    data.top = new FormAttachment(showVisButton, 2, SWT.BOTTOM);
    data.right = new FormAttachment(100, -5);
    data.bottom = new FormAttachment(100, -5);
    SashUtility.createVerticalSash(getShell(), MIN_DRAWING_AREA_WIDTH, HISTORY_LIST_WIDTH, SWT.RIGHT, editor.bodyComposite, editorData, historyProperties, data);
    // Layout contents of widgetGroup
    data = new FormData();
    data.top = new FormAttachment(predictionLabel, 0, SWT.BOTTOM);
    data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
    data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
    scriptStepListLabel.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(scriptStepListLabel, 5, SWT.BOTTOM);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    positionStartLocParms(data);
    scriptStepTable.setLayoutData(data);
    if (editable) {
        data = new FormData();
        data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
        data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
        data.bottom = new FormAttachment(computeItem, 0, SWT.TOP);
        deleteItem.setLayoutData(data);
        //            data = new FormData();
        //            data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
        //            data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
        //            data.bottom = new FormAttachment(this.computeItem, 0 , SWT.TOP);
        //            this.regenerateItem.setLayoutData(data);
        data = new FormData();
        // use 0 here, since internal frame is set to -05, fix internal frame
        data.bottom = new FormAttachment(100, 0);
        data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
        data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
        computeItem.setLayoutData(data);
        layOutPropertiesPane(editor.propertiesComposite);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Shell(org.eclipse.swt.widgets.Shell) Table(org.eclipse.swt.widgets.Table) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormLayout (org.eclipse.swt.layout.FormLayout)726 FormData (org.eclipse.swt.layout.FormData)651 FormAttachment (org.eclipse.swt.layout.FormAttachment)649 Label (org.eclipse.swt.widgets.Label)503 Button (org.eclipse.swt.widgets.Button)484 SelectionEvent (org.eclipse.swt.events.SelectionEvent)444 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)407 Text (org.eclipse.swt.widgets.Text)390 Composite (org.eclipse.swt.widgets.Composite)384 Shell (org.eclipse.swt.widgets.Shell)365 ModifyListener (org.eclipse.swt.events.ModifyListener)355 Listener (org.eclipse.swt.widgets.Listener)354 Event (org.eclipse.swt.widgets.Event)352 ModifyEvent (org.eclipse.swt.events.ModifyEvent)350 Display (org.eclipse.swt.widgets.Display)343 ShellEvent (org.eclipse.swt.events.ShellEvent)335 ShellAdapter (org.eclipse.swt.events.ShellAdapter)330 TextVar (org.pentaho.di.ui.core.widget.TextVar)220 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)200 TableView (org.pentaho.di.ui.core.widget.TableView)198