Search in sources :

Example 66 with FormLayout

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

the class Palette method createPaletteButton.

// Currently, expects images that are 20x20 pixels
public Button createPaletteButton(Image img, Control lastButton, Composite parent, Object buttonData, ButtonListener buttonListener, String toolTipText) {
    buttonListener.setPalette(this);
    // On OSX, we need to use flat buttons. On the PC, toggle is sufficient
    int style = OSUtils.MACOSX ? (SWT.TOGGLE | SWT.FLAT) : SWT.TOGGLE;
    Composite buttonBackground = new Composite(parent, SWT.NONE);
    buttonBackground.setLayout(new FormLayout());
    Button b = new Button(buttonBackground, style);
    if (img != null) {
        b.setImage(img);
    }
    FormData data = new FormData();
    if (lastButton == null) {
        // default first button to be selected
        b.setSelection(true);
        setData(b);
        buttonBackground.setBackground(SELECTED_BKG);
        data.top = new FormAttachment(0, 1);
        data.bottom = new FormAttachment(0, 26);
    } else {
        Composite lastButtonBkg = lastButton.getParent();
        data.top = new FormAttachment(lastButtonBkg, 0, SWT.BOTTOM);
        data.bottom = new FormAttachment(lastButtonBkg, 25, SWT.BOTTOM);
    }
    data.left = new FormAttachment(0, 1);
    data.right = new FormAttachment(0, 26);
    buttonBackground.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(0, 1);
    data.bottom = new FormAttachment(100, -1);
    data.left = new FormAttachment(0, 1);
    data.right = new FormAttachment(100, -1);
    b.setLayoutData(data);
    b.setData(buttonData);
    b.addSelectionListener(buttonListener);
    b.setToolTipText(toolTipText);
    buttons.put(buttonData, b);
    return b;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 67 with FormLayout

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

the class ScriptViewerView method layOutWindow.

/**
     * Lay out the window including the interactionDrawing editor
     *
     * @param tableCallback
     */
public void layOutWindow(SWTListGroupScript rowRenderer) {
    // Set up the layouts
    getShell().setLayout(new FormLayout());
    // Create a group for the properties on the history
    Group widgetGroup = new Group(getShell(), SWT.NONE);
    widgetGroup.setLayout(new FormLayout());
    // Script
    scriptStepListLabel = new Label(widgetGroup, SWT.CENTER);
    scriptStepListLabel.setText(L10N.get("SE.ScriptStepList", "Script Step List: Double " + "click on a step to edit " + "its script"));
    scriptStepListLabel.setBackground(NONEDITABLE_COLOR);
    Table scriptStepTable = new Table(widgetGroup, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    scriptStepTable.setFont(FontUtils.SYMBOL_FONT);
    scriptSteps = rowRenderer;
    scriptSteps.setTable(scriptStepTable);
    scriptSteps.setColumnTitles(columnTitles);
    FormData editorData = new FormData();
    editorData.top = new FormAttachment(0, 5);
    editorData.left = new FormAttachment(0, 5);
    editorData.bottom = new FormAttachment(100, -5);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 5);
    //data.left = new FormAttachment(sash, 0, SWT.RIGHT); //100, -1 * HISTORY_LIST_WIDTH);
    data.right = new FormAttachment(100, -5);
    data.bottom = new FormAttachment(100, -5);
    //widgetGroup.setLayoutData(data);
    SashUtility.createVerticalSash(getShell(), MIN_DRAWING_AREA_WIDTH, HISTORY_LIST_WIDTH, SWT.RIGHT, editor.bodyComposite, editorData, widgetGroup, data);
    // Layout contents of widgetGroup
    data = new FormData();
    data.top = new FormAttachment(0, 0);
    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);
    data.bottom = new FormAttachment(100, -5);
    scriptStepTable.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) Table(org.eclipse.swt.widgets.Table) Label(org.eclipse.swt.widgets.Label) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 68 with FormLayout

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

the class ScriptViewerView method layOutPropertiesPane.

/**
     * Lay out the elements, and add listeners to communicate with "controller"
     */
protected void layOutPropertiesPane(Composite parent) {
    // Create a group for the properties
    Group widgetGroup = new Group(parent, SWT.NONE);
    widgetGroup.setLayout(new FormLayout());
    // Tell the parent to use a fill layout so it will fill the area.
    parent.setLayout(new FillLayout());
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 69 with FormLayout

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

the class SEDemoView method layOutPropertiesPane.

/**
     * Lay out the elements, and add listeners to communicate with "controller"
     */
protected void layOutPropertiesPane(Composite parent) {
    // Create a group for the properties
    Group widgetGroup = new Group(parent, SWT.NONE);
    widgetGroup.setLayout(new FormLayout());
    // Tell the parent to use a fill layout so it will fill the area.
    parent.setLayout(new FillLayout());
    // Lay out the insert think button
    insertThink = new Button(widgetGroup, SWT.PUSH);
    insertThink.setText(L10N.get("SE.Think", "Think"));
    insertThink.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.InsertThink));
    lIDMap.addWidget(SEDemoLID.InsertThink, insertThink, ListenerIdentifierMap.NORMAL);
    // since driving is not currently supported hide that button
    //        this.insertDrive = new Button(widgetGroup, SWT.PUSH);
    //        this.insertDrive.setText(L10N.get("SE.AttendDriving",
    //                                          "Attend To Driving"));
    //        this.insertDrive.addSelectionListener(
    //                             new WidgetChangeHandler(SEDemoLID.insertDrive));
    //        this.insertDrive.setVisible(false);
    // Insert delay button.
    //        this.insertDelay = new Button(widgetGroup, SWT.PUSH);
    //        this.insertDelay.setText(L10N.get("SE.WaitForSystem",
    //                                          "Wait for System"));
    //        this.insertDelay.addSelectionListener(
    //                            new SWTWidgetChangeHandler(SEDemoLID.InsertDelay));
    //
    //        this.lIDMap.addWidget(SEDemoLID.InsertDelay,
    //                              this.insertDelay,
    //                              ListenerIdentifierMap.NORMAL);
    // Insert the look at button
    insertLookAt = new Button(widgetGroup, SWT.TOGGLE);
    insertLookAt.setText(L10N.get("SE.LookAtWidget", "Look at Widget"));
    lIDMap.addWidget(SEDemoLID.InsertLookAt, insertLookAt, ListenerIdentifierMap.NORMAL);
    // The toggle button listener does not raise an alert,
    // UIModel needs to listen for its state change
    // on MacOSX, toggle button is not a standard size
    // To make things line up nicely we add a -5 offset.
    int displacementForWindows = 0;
    if (OSUtils.MACOSX) {
        // XXX: dirty hacks around SWT bugs
        displacementForWindows = 5;
    }
    FormData data = new FormData();
    data.left = new FormAttachment(0, 5);
    data.top = new FormAttachment(insertThink, 0, SWT.CENTER);
    //        data.bottom = new FormAttachment(this.insertThink,
    //                                         // OSX Look At is larger,
    //                                         // so shift it down
    //                                         0 - displacementForWindows,
    //                                         SWT.BOTTOM);
    insertLookAt.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(insertLookAt, // OSXLook At is wider then normal.
    5 + displacementForWindows, SWT.RIGHT);
    // on windows leave space on edges, macOSX doesn't need it
    data.bottom = new FormAttachment(100, -5 + displacementForWindows);
    //        this.insertDelay.setLayoutData(data);
    //
    //        data = new FormData();
    //        data.left = new FormAttachment(this.insertDelay, 5, SWT.RIGHT);
    //        data.bottom = new FormAttachment(this.insertDelay, 0, SWT.BOTTOM);
    insertThink.setLayoutData(data);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Button(org.eclipse.swt.widgets.Button) FillLayout(org.eclipse.swt.layout.FillLayout) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 70 with FormLayout

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

the class SEFrameChooserView method layOutPropertyPanel.

protected void layOutPropertyPanel(int deviceTypes, SWTList rowRenderer) {
    Composite propertiesComposite = editor.getSWTPropertiesComposite();
    addHandOnKeyboardToStart(deviceTypes, propertiesComposite);
    frameList = rowRenderer;
    frameList.setTable(new Table(propertiesComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION));
    demonstrateScriptButton = new Button(propertiesComposite, SWT.NONE);
    demonstrateScriptButton.setText(startDemonstratingLabel);
    shell.setDefaultButton(demonstrateScriptButton);
    demonstrateScriptButton.addSelectionListener(new SWTWidgetChangeHandler(SEFrameChooserLID.OpenScriptEditor));
    lIDMap.addWidget(SEFrameChooserLID.OpenScriptEditor, demonstrateScriptButton, ListenerIdentifierMap.NORMAL);
    closeButton = new Button(propertiesComposite, SWT.NONE);
    closeButton.setText(L10N.get("SE.Close", "Close"));
    closeButton.addSelectionListener(new SWTWidgetChangeHandler(CogToolLID.CloseWindow));
    propertiesComposite.setLayout(new FormLayout());
    // First thing resides at the top
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 5);
    data.right = new FormAttachment(100, 0);
    positionStartLocParms(data);
    frameList.getTable().setLayoutData(data);
    data = new FormData();
    data.bottom = new FormAttachment(100, 0);
    data.left = new FormAttachment(0, 5);
    demonstrateScriptButton.setLayoutData(data);
    data = new FormData();
    data.top = new FormAttachment(demonstrateScriptButton, 0, SWT.TOP);
    data.left = new FormAttachment(demonstrateScriptButton, 5, SWT.RIGHT);
    data.bottom = new FormAttachment(100, 0);
    closeButton.setLayoutData(data);
    SashUtility.createVerticalSash(editor.bodyComposite, FRAME_LIST_WIDTH, 250, SWT.RIGHT, propertiesComposite, editor.getPropFormData(), editor.scrollComposite, editor.getScrollFormData());
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormLayout (org.eclipse.swt.layout.FormLayout)127 FormData (org.eclipse.swt.layout.FormData)97 FormAttachment (org.eclipse.swt.layout.FormAttachment)93 Composite (org.eclipse.swt.widgets.Composite)82 Button (org.eclipse.swt.widgets.Button)54 Label (org.eclipse.swt.widgets.Label)53 SelectionEvent (org.eclipse.swt.events.SelectionEvent)39 Point (org.eclipse.swt.graphics.Point)33 Group (org.eclipse.swt.widgets.Group)31 GridData (org.eclipse.swt.layout.GridData)30 Text (org.eclipse.swt.widgets.Text)30 GridLayout (org.eclipse.swt.layout.GridLayout)29 SelectionListener (org.eclipse.swt.events.SelectionListener)27 Combo (org.eclipse.swt.widgets.Combo)25 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)19 FillLayout (org.eclipse.swt.layout.FillLayout)19 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)17 StyledText (org.eclipse.swt.custom.StyledText)13 ModifyListener (org.eclipse.swt.events.ModifyListener)12 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11