Search in sources :

Example 56 with FormLayout

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

the class RangeFilterWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    super.createControl(parent);
    Composite comp = new Composite(parent, SWT.NULL);
    comp.setLayout(new FormLayout());
    FormData data1 = new FormData();
    data1.left = new FormAttachment(0, 0);
    data1.top = new FormAttachment(0, 0);
    data1.right = new FormAttachment(40, 0);
    data1.bottom = new FormAttachment(100, 0);
    Composite cmpFilterOpts = new Composite(comp, SWT.NONE);
    cmpFilterOpts.setLayoutData(data1);
    ColumnLayout colLayout = new ColumnLayout();
    colLayout.maxNumColumns = 1;
    cmpFilterOpts.setLayout(colLayout);
    // Column
    Label lblColumn = new Label(cmpFilterOpts, SWT.NONE);
    // $NON-NLS-1$
    lblColumn.setText(Localization.getString("RangeFilterWizardPage.Column"));
    cboColumn = new Combo(cmpFilterOpts, SWT.DROP_DOWN | SWT.READ_ONLY);
    cboColumn.addSelectionListener(selectionListener);
    for (int i = 0; i < wizard.series.length; i++) {
        cboColumn.add(wizard.series[i]);
    }
    // Spacer
    new Label(cmpFilterOpts, SWT.NONE);
    // Low
    Label lblLow = new Label(cmpFilterOpts, SWT.NONE);
    // $NON-NLS-1$
    lblLow.setText(Localization.getString("RangeFilterWizardPage.LowerBound"));
    txtLow = new Text(cmpFilterOpts, SWT.BORDER);
    txtLow.addModifyListener(modifyListener);
    txtLow.addKeyListener(numberKeyListener);
    // High
    Label lblHigh = new Label(cmpFilterOpts, SWT.NONE);
    // $NON-NLS-1$
    lblHigh.setText(Localization.getString("RangeFilterWizardPage.UpperBound"));
    txtHigh = new Text(cmpFilterOpts, SWT.BORDER);
    txtHigh.addModifyListener(modifyListener);
    txtHigh.addKeyListener(numberKeyListener);
    // Spacer
    new Label(cmpFilterOpts, SWT.NONE);
    // Style
    radInside = new Button(cmpFilterOpts, SWT.RADIO);
    // $NON-NLS-1$
    radInside.setText(Localization.getString("RangeFilterWizardPage.InsideBounds"));
    radInside.addSelectionListener(selectionListener);
    radInside.setSelection(true);
    radOutside = new Button(cmpFilterOpts, SWT.RADIO);
    // $NON-NLS-1$
    radOutside.setText(Localization.getString("RangeFilterWizardPage.OutsideBounds"));
    radOutside.addSelectionListener(selectionListener);
    chkInclusive = new Button(cmpFilterOpts, SWT.CHECK);
    // $NON-NLS-1$
    chkInclusive.setText(Localization.getString("RangeFilterWizardPage.Inclusive"));
    chkInclusive.addSelectionListener(selectionListener);
    // Spacer
    new Label(cmpFilterOpts, SWT.NONE);
    cboColumn.select(0);
    createFilter();
    setControl(comp);
}
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) ColumnLayout(org.eclipse.ui.forms.widgets.ColumnLayout) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 57 with FormLayout

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

the class SortFilterWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    super.createControl(parent);
    Composite comp = new Composite(parent, SWT.NULL);
    comp.setLayout(new FormLayout());
    FormData data1 = new FormData();
    data1.left = new FormAttachment(0, 0);
    data1.top = new FormAttachment(0, 0);
    data1.right = new FormAttachment(40, 0);
    data1.bottom = new FormAttachment(100, 0);
    Composite cmpFilterOpts = new Composite(comp, SWT.NONE);
    cmpFilterOpts.setLayoutData(data1);
    ColumnLayout colLayout = new ColumnLayout();
    colLayout.maxNumColumns = 1;
    cmpFilterOpts.setLayout(colLayout);
    // Column
    Label lblColumn = new Label(cmpFilterOpts, SWT.NONE);
    // $NON-NLS-1$
    lblColumn.setText(Localization.getString("SortFilterWizardPage.Column"));
    cboColumn = new Combo(cmpFilterOpts, SWT.DROP_DOWN | SWT.READ_ONLY);
    cboColumn.addSelectionListener(selectionListener);
    for (int i = 0; i < wizard.series.length; i++) {
        cboColumn.add(wizard.series[i]);
    }
    // Spacer
    new Label(cmpFilterOpts, SWT.NONE);
    // Style
    radAscending = new Button(cmpFilterOpts, SWT.RADIO);
    // $NON-NLS-1$
    radAscending.setText(Localization.getString("SortFilterWizardPage.Ascending"));
    radAscending.addSelectionListener(selectionListener);
    radAscending.setSelection(true);
    radDescending = new Button(cmpFilterOpts, SWT.RADIO);
    // $NON-NLS-1$
    radDescending.setText(Localization.getString("SortFilterWizardPage.Descending"));
    radDescending.addSelectionListener(selectionListener);
    cboColumn.select(0);
    createFilter();
    setControl(comp);
}
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) ColumnLayout(org.eclipse.ui.forms.widgets.ColumnLayout) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 58 with FormLayout

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

the class GraphDisplaySet method createPartControl.

/**
 * This method creates the framework for what will be displayed by this dialog box.
 * @param parent The composite that will contain all the elements from this dialog
 */
private void createPartControl(Composite parent) {
    parent.setLayout(new FormLayout());
    FormData data1 = new FormData();
    Composite cmpCoolBar = new Composite(parent, SWT.NONE);
    data1.left = new FormAttachment(0, 0);
    data1.top = new FormAttachment(0, 0);
    data1.right = new FormAttachment(100, 0);
    data1.bottom = new FormAttachment(0, 10);
    cmpCoolBar.setLayoutData(data1);
    FormData data2 = new FormData();
    data2.left = new FormAttachment(0, 0);
    data2.top = new FormAttachment(cmpCoolBar);
    data2.right = new FormAttachment(100, 0);
    data2.bottom = new FormAttachment(100, 0);
    Composite cmpGraph = new Composite(parent, SWT.NONE);
    cmpGraph.setLayoutData(data2);
    // This is for the tab view
    cmpGraph.setLayout(new FormLayout());
    folder = new CTabFolder(cmpGraph, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    folder.setLayoutData(data);
    listener = new ButtonClickListener();
    folder.addSelectionListener(listener);
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent e) {
            int selected = folder.indexOf((CTabItem) e.item) - 2;
            if (null != updater) {
                updater.removeUpdateListener(builders.get(selected));
            }
            builders.remove(selected);
        }
    });
    // This is a tab/button for opening new graphs
    CTabItem newGraph = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    newGraph.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(GraphingUIPlugin.PLUGIN_ID, "icons/actions/new_wiz.gif").createImage());
    // $NON-NLS-1$
    newGraph.setToolTipText(Localization.getString("GraphDisplaySet.CreateGraph"));
    // Tab containing the data table
    CTabItem item = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    item.setText(Localization.getString("GraphDisplaySet.DataView"));
    Composite c = new Composite(folder, SWT.NONE);
    GridLayout grid = new GridLayout();
    grid.marginHeight = 0;
    grid.marginWidth = 0;
    c.setLayout(grid);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    DataGrid table = DataSetFactory.getDataGrid(c, dataSet);
    if (null != updater) {
        updater.addUpdateListener(table);
    }
    table.getControl().setLayoutData(gd);
    item.setControl(c);
    folder.setSelection(item);
    lastSelectedTab = 1;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) GraphComposite(org.eclipse.linuxtools.systemtap.graphing.ui.widgets.GraphComposite) Composite(org.eclipse.swt.widgets.Composite) DataGrid(org.eclipse.linuxtools.systemtap.graphing.ui.datadisplay.DataGrid) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 59 with FormLayout

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

the class GraphSelectorEditor method createPartControl.

/**
 * This method creates the framework for what will be displayed by this dialog box.
 * @param parent The composite that will contain all the elements from this dialog
 */
@Override
public void createPartControl(Composite parent) {
    FormData data2 = new FormData();
    data2.left = new FormAttachment(0, 0);
    data2.top = new FormAttachment(0, 0);
    data2.right = new FormAttachment(100, 0);
    data2.bottom = new FormAttachment(100, 0);
    Composite cmpGraph = new Composite(parent, SWT.NONE);
    cmpGraph.setLayoutData(data2);
    // This is for the tab view
    cmpGraph.setLayout(new FormLayout());
    // Create the folder for all of the script sets, so it takes up all of the parent composite
    scriptFolder = new CTabFolder(cmpGraph, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    scriptFolder.setLayoutData(data);
    scriptFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent e) {
            displaySets.remove(scriptFolder.indexOf((CTabItem) e.item));
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) Composite(org.eclipse.swt.widgets.Composite) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 60 with FormLayout

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

the class DNDExample method createDropWidget.

private void createDropWidget(Composite parent) {
    parent.setLayout(new FormLayout());
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    combo.setItems("Toggle Button", "Radio Button", "Checkbox", "Canvas", "Label", "List", "Table", "Tree", "Text", "StyledText", "Combo");
    combo.select(LABEL);
    dropControlType = combo.getSelectionIndex();
    dropControl = createWidget(dropControlType, parent, "Drop Target");
    combo.addSelectionListener(widgetSelectedAdapter(e -> {
        Object data = dropControl.getLayoutData();
        Composite dropParent = dropControl.getParent();
        dropControl.dispose();
        Combo c = (Combo) e.widget;
        dropControlType = c.getSelectionIndex();
        dropControl = createWidget(dropControlType, dropParent, "Drop Target");
        dropControl.setLayoutData(data);
        if (dropEnabled)
            createDropTarget();
        dropParent.layout();
    }));
    Button b = new Button(parent, SWT.CHECK);
    b.setText("DropTarget");
    b.addSelectionListener(widgetSelectedAdapter(e -> {
        Button eb = (Button) e.widget;
        dropEnabled = eb.getSelection();
        if (dropEnabled) {
            createDropTarget();
        } else {
            if (dropTarget != null) {
                dropTarget.dispose();
            }
            dropTarget = null;
        }
    }));
    // initialize state
    b.setSelection(true);
    dropEnabled = true;
    FormData data = new FormData();
    data.top = new FormAttachment(0, 10);
    data.bottom = new FormAttachment(combo, -10);
    data.left = new FormAttachment(0, 10);
    data.right = new FormAttachment(100, -10);
    dropControl.setLayoutData(data);
    data = new FormData();
    data.bottom = new FormAttachment(100, -10);
    data.left = new FormAttachment(0, 10);
    combo.setLayoutData(data);
    data = new FormData();
    data.bottom = new FormAttachment(100, -10);
    data.left = new FormAttachment(combo, 10);
    b.setLayoutData(data);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) StyledText(org.eclipse.swt.custom.StyledText) URL(java.net.URL) DND(org.eclipse.swt.dnd.DND) TableColumn(org.eclipse.swt.widgets.TableColumn) FontMetrics(org.eclipse.swt.graphics.FontMetrics) Point(org.eclipse.swt.graphics.Point) SWTError(org.eclipse.swt.SWTError) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) URLTransfer(org.eclipse.swt.dnd.URLTransfer) Composite(org.eclipse.swt.widgets.Composite) TreeColumn(org.eclipse.swt.widgets.TreeColumn) DropTarget(org.eclipse.swt.dnd.DropTarget) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) Display(org.eclipse.swt.widgets.Display) Transfer(org.eclipse.swt.dnd.Transfer) MenuItem(org.eclipse.swt.widgets.MenuItem) Tree(org.eclipse.swt.widgets.Tree) SWT(org.eclipse.swt.SWT) HTMLTransfer(org.eclipse.swt.dnd.HTMLTransfer) List(org.eclipse.swt.widgets.List) DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) Label(org.eclipse.swt.widgets.Label) RTFTransfer(org.eclipse.swt.dnd.RTFTransfer) DragSourceListener(org.eclipse.swt.dnd.DragSourceListener) Image(org.eclipse.swt.graphics.Image) Rectangle(org.eclipse.swt.graphics.Rectangle) Table(org.eclipse.swt.widgets.Table) SelectionListener.widgetSelectedAdapter(org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter) TextTransfer(org.eclipse.swt.dnd.TextTransfer) Canvas(org.eclipse.swt.widgets.Canvas) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) FileTransfer(org.eclipse.swt.dnd.FileTransfer) DragSource(org.eclipse.swt.dnd.DragSource) TableItem(org.eclipse.swt.widgets.TableItem) Combo(org.eclipse.swt.widgets.Combo) Shell(org.eclipse.swt.widgets.Shell) MalformedURLException(java.net.MalformedURLException) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) FormLayout(org.eclipse.swt.layout.FormLayout) FileDialog(org.eclipse.swt.widgets.FileDialog) FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment) Group(org.eclipse.swt.widgets.Group) TreeItem(org.eclipse.swt.widgets.TreeItem) File(java.io.File) RowLayout(org.eclipse.swt.layout.RowLayout) Menu(org.eclipse.swt.widgets.Menu) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) Combo(org.eclipse.swt.widgets.Combo) 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