Example usage for org.eclipse.swt.widgets Composite setLayout

List of usage examples for org.eclipse.swt.widgets Composite setLayout

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Composite setLayout.

Prototype

public void setLayout(Layout layout) 

Source Link

Document

Sets the layout which is associated with the receiver to be the argument which may be null.

Usage

From source file:org.locationtech.udig.processingtoolbox.tools.BoxPlotDialog.java

private void createInputTab(final CTabFolder parentTabFolder) {
    inputTab = new CTabItem(parentTabFolder, SWT.NONE);
    inputTab.setText(Messages.ProcessExecutionDialog_tabparameters);

    ScrolledComposite scroller = new ScrolledComposite(parentTabFolder, SWT.NONE | SWT.V_SCROLL | SWT.H_SCROLL);
    scroller.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite container = new Composite(scroller, SWT.NONE);
    container.setLayout(new GridLayout(1, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // local moran's i
    Image image = ToolboxPlugin.getImageDescriptor("icons/public_co.gif").createImage(); //$NON-NLS-1$
    uiBuilder.createLabel(container, Messages.ScatterPlotDialog_InputLayer, EMPTY, image, 1);
    cboLayer = uiBuilder.createCombo(container, 1, true);
    fillLayers(map, cboLayer, VectorLayerType.ALL);

    uiBuilder.createLabel(container, Messages.BoxPlotDialog_Fields, EMPTY, image, 1);
    schemaTable = uiBuilder.createTable(container, new String[] { Messages.General_Name }, 1);
    schemaTable.addSelectionListener(new SelectionAdapter() {
        @Override//from  w w w.ja  va  2s.c o  m
        public void widgetSelected(SelectionEvent event) {
            StringBuffer buffer = new StringBuffer();
            for (TableItem item : schemaTable.getItems()) {
                if (item.getChecked()) {
                    if (buffer.length() > 0) {
                        buffer.append(",").append(item.getText()); //$NON-NLS-1$
                    } else {
                        buffer.append(item.getText());
                    }
                }
            }
            selectedFields = buffer.toString();
        }
    });

    uiBuilder.createLabel(container, null, null, 1);
    chkStatistics = uiBuilder.createCheckbox(container, Messages.ScatterPlotDialog_BasicStatistics, null, 1);

    // register events
    cboLayer.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            schemaTable.removeAll();
            inputLayer = MapUtils.getLayer(map, cboLayer.getText());
            if (inputLayer != null) {
                for (AttributeDescriptor dsc : inputLayer.getSchema().getAttributeDescriptors()) {
                    Class<?> binding = dsc.getType().getBinding();
                    if (Number.class.isAssignableFrom(binding)) {
                        TableItem item = new TableItem(schemaTable, SWT.NULL);
                        item.setText(dsc.getLocalName());
                    }
                }
            }
        }
    });

    // finally
    scroller.setContent(container);
    inputTab.setControl(scroller);

    scroller.setMinSize(450, container.getSize().y - 2);
    scroller.setExpandVertical(true);
    scroller.setExpandHorizontal(true);

    scroller.pack();
    container.pack();
}

From source file:grafici.PazientiTimeSeriesChart.java

/**
 * A demonstration application showing how to create a simple time series
 * chart.  This example uses monthly data.
 *
 * @param title  the frame title.//www .  j  a v  a  2s.c o  m
 */
public PazientiTimeSeriesChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);

    Label titolo = new Label(this, SWT.NONE);
    titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD));
    titolo.setText(title);
    GridData gdLbl = new GridData(SWT.FILL);
    titolo.setLayoutData(gdLbl);
    Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
    GridData gdCmp = new GridData(SWT.FILL);
    gdCmp.horizontalAlignment = SWT.FILL;
    gdCmp.verticalAlignment = SWT.FILL;
    gdCmp.grabExcessHorizontalSpace = true;
    gdCmp.grabExcessVerticalSpace = true;
    cmp.setLayoutData(gdCmp);
    cmp.setLayout(new GridLayout(1, false));
    JPanel chartPanel = createDemoPanel(tipo);
    Frame graphFrame = SWT_AWT.new_Frame(cmp);
    graphFrame.add(chartPanel);
    graphFrame.pack();

    GridData gdThis = new GridData(SWT.FILL);
    gdThis.horizontalAlignment = SWT.FILL;
    gdThis.verticalAlignment = SWT.FILL;
    gdThis.grabExcessHorizontalSpace = true;
    gdThis.grabExcessVerticalSpace = true;

    this.setLayoutData(gdThis);
    this.setLayout(new GridLayout(1, false));
}

From source file:grafici.StatistichePieChart.java

/**
 * Default constructor./* ww w.  j a va  2s. co  m*/
 * 
 * @param title the frame title.
 */
public StatistichePieChart(Table result, Composite parent, int style, int indexVariabile, int indexValore) {
    super(parent, style);
    try {

        titolo = result.getColumn(indexVariabile).getText().toUpperCase() + " - "
                + result.getColumn(indexValore).getText().toUpperCase();
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        JPanel chartPanel = createDemoPanel(result, indexVariabile, indexValore);
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;

        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
    } catch (Exception e) {
        alertGraficoNonDisp();
    }
}

From source file:HoverHelp.java

/**
 * Creates the example//from  ww w .  j  a  v a 2s .  c o  m
 */
public void createPartControl(Composite frame) {
    final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    frame.setLayout(layout);

    ToolBar bar = new ToolBar(frame, SWT.BORDER);
    for (int i = 0; i < 5; i++) {
        ToolItem item = new ToolItem(bar, SWT.PUSH);
        item.setText(getResourceString("ToolItem.text", new Object[] { new Integer(i) }));
        item.setData("TIP_TEXT", getResourceString("ToolItem.tooltip", new Object[] { item.getText() }));
        item.setData("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
            public String getHelpText(Widget widget) {
                Item item = (Item) widget;
                return getResourceString("ToolItem.help", new Object[] { item.getText() });
            }
        });
    }
    GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    bar.setLayoutData(gridData);
    tooltip.activateHoverHelp(bar);

    Table table = new Table(frame, SWT.BORDER);
    for (int i = 0; i < 4; i++) {
        TableItem item = new TableItem(table, SWT.PUSH);
        item.setText(getResourceString("Item", new Object[] { new Integer(i) }));
        item.setData("TIP_IMAGE", images[hhiInformation]);
        item.setText(getResourceString("TableItem.text", new Object[] { new Integer(i) }));
        item.setData("TIP_TEXT", getResourceString("TableItem.tooltip", new Object[] { item.getText() }));
        item.setData("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
            public String getHelpText(Widget widget) {
                Item item = (Item) widget;
                return getResourceString("TableItem.help", new Object[] { item.getText() });
            }
        });
    }
    table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
    tooltip.activateHoverHelp(table);

    Tree tree = new Tree(frame, SWT.BORDER);
    for (int i = 0; i < 4; i++) {
        TreeItem item = new TreeItem(tree, SWT.PUSH);
        item.setText(getResourceString("Item", new Object[] { new Integer(i) }));
        item.setData("TIP_IMAGE", images[hhiWarning]);
        item.setText(getResourceString("TreeItem.text", new Object[] { new Integer(i) }));
        item.setData("TIP_TEXT", getResourceString("TreeItem.tooltip", new Object[] { item.getText() }));
        item.setData("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
            public String getHelpText(Widget widget) {
                Item item = (Item) widget;
                return getResourceString("TreeItem.help", new Object[] { item.getText() });
            }
        });
    }
    tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
    tooltip.activateHoverHelp(tree);

    Button button = new Button(frame, SWT.PUSH);
    button.setText(getResourceString("Hello.text"));
    button.setData("TIP_TEXT", getResourceString("Hello.tooltip"));
    tooltip.activateHoverHelp(button);
}

From source file:grafici.FattureTimeSeriesChart.java

/**
 * A demonstration application showing how to create a simple time series
 * chart. This example uses monthly data.
 * //  ww  w. j  av  a 2  s . c  o  m
 * @param title
 *            the frame title.
 */
public FattureTimeSeriesChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);
    System.out.println(2);
    Label titolo = new Label(this, SWT.NONE);
    titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD));
    titolo.setText(title);
    GridData gdLbl = new GridData(SWT.FILL);
    titolo.setLayoutData(gdLbl);
    Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
    GridData gdCmp = new GridData(SWT.FILL);
    gdCmp.horizontalAlignment = SWT.FILL;
    gdCmp.verticalAlignment = SWT.FILL;
    gdCmp.grabExcessHorizontalSpace = true;
    gdCmp.grabExcessVerticalSpace = true;
    cmp.setLayoutData(gdCmp);
    cmp.setLayout(new GridLayout(1, false));
    JPanel chartPanel = createPanel(tipo);
    Frame graphFrame = SWT_AWT.new_Frame(cmp);
    graphFrame.add(chartPanel);
    graphFrame.pack();

    GridData gdThis = new GridData(SWT.FILL);
    gdThis.horizontalAlignment = SWT.FILL;
    gdThis.verticalAlignment = SWT.FILL;
    gdThis.grabExcessHorizontalSpace = true;
    gdThis.grabExcessVerticalSpace = true;

    this.setLayoutData(gdThis);
    this.setLayout(new GridLayout(1, false));
}

From source file:grafici.StatisticheBarChart3D.java

/**
 * Creates a new demo instance.//from  w  w  w.j a  v  a 2s .c o m
 * 
 * @param title
 *            the frame title.
 */
public StatisticheBarChart3D(Table risultati, Composite parent, int style, int variabile1, int variabile2,
        int valore) {
    super(parent, style);
    try {
        this.titolo = risultati.getColumn(variabile1).getText().toUpperCase() + " - "
                + risultati.getColumn(variabile2).getText().toUpperCase() + " - "
                + risultati.getColumn(valore).getText().toUpperCase();
        GridData gdThis = new GridData(SWT.FILL);
        gdThis.horizontalAlignment = SWT.FILL;
        gdThis.verticalAlignment = SWT.FILL;
        gdThis.grabExcessHorizontalSpace = true;
        gdThis.grabExcessVerticalSpace = true;
        this.setLayoutData(gdThis);
        this.setLayout(new GridLayout(1, false));
        Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
        GridData gdCmp = new GridData(SWT.FILL);
        gdCmp.horizontalAlignment = SWT.FILL;
        gdCmp.verticalAlignment = SWT.FILL;
        gdCmp.grabExcessHorizontalSpace = true;
        gdCmp.grabExcessVerticalSpace = true;
        cmp.setLayoutData(gdCmp);
        cmp.setLayout(new GridLayout(1, false));

        CategoryDataset dataset = createDataset(risultati, variabile1, variabile2, valore);
        JFreeChart chart = createChart(dataset, risultati, variabile1, variabile2, valore);
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setFillZoomRectangle(true);
        // chartPanel.setMouseWheelEnabled(true);
        // chartPanel.setPreferredSize(new Dimension(1000, 700));
        Frame graphFrame = SWT_AWT.new_Frame(cmp);
        graphFrame.add(chartPanel);
        graphFrame.pack();

    } catch (Exception e) {
        alertGraficoNonDisp();
    }
}

From source file:org.eclipse.swt.examples.hoverhelp.HoverHelp.java

/**
 * Creates the example/*from   w  w w  .  j a v  a2 s . c  om*/
 */
public void createPartControl(Composite frame) {
    final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    frame.setLayout(layout);

    String platform = SWT.getPlatform();
    String helpKey = "F1";
    if (platform.equals("gtk"))
        helpKey = "Ctrl+F1";
    if (platform.equals("cocoa"))
        helpKey = "Help";

    ToolBar bar = new ToolBar(frame, SWT.BORDER);
    for (int i = 0; i < 5; i++) {
        ToolItem item = new ToolItem(bar, SWT.PUSH);
        item.setText(getResourceString("ToolItem.text", new Object[] { Integer.valueOf(i) }));
        item.setData("TIP_TEXT",
                getResourceString("ToolItem.tooltip", new Object[] { item.getText(), helpKey }));
        item.setData("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
            Item item1 = (Item) widget;
            return getResourceString("ToolItem.help", new Object[] { item1.getText() });
        });
    }
    GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    bar.setLayoutData(gridData);
    tooltip.activateHoverHelp(bar);

    Table table = new Table(frame, SWT.BORDER);
    for (int i = 0; i < 4; i++) {
        TableItem item = new TableItem(table, SWT.PUSH);
        item.setText(getResourceString("Item", new Object[] { Integer.valueOf(i) }));
        item.setData("TIP_IMAGE", images[hhiInformation]);
        item.setText(getResourceString("TableItem.text", new Object[] { Integer.valueOf(i) }));
        item.setData("TIP_TEXT",
                getResourceString("TableItem.tooltip", new Object[] { item.getText(), helpKey }));
        item.setData("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
            Item item1 = (Item) widget;
            return getResourceString("TableItem.help", new Object[] { item1.getText() });
        });
    }
    table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
    tooltip.activateHoverHelp(table);

    Tree tree = new Tree(frame, SWT.BORDER);
    for (int i = 0; i < 4; i++) {
        TreeItem item = new TreeItem(tree, SWT.PUSH);
        item.setText(getResourceString("Item", new Object[] { Integer.valueOf(i) }));
        item.setData("TIP_IMAGE", images[hhiWarning]);
        item.setText(getResourceString("TreeItem.text", new Object[] { Integer.valueOf(i) }));
        item.setData("TIP_TEXT",
                getResourceString("TreeItem.tooltip", new Object[] { item.getText(), helpKey }));
        item.setData("TIP_HELPTEXTHANDLER", (ToolTipHelpTextHandler) widget -> {
            Item item1 = (Item) widget;
            return getResourceString("TreeItem.help", new Object[] { item1.getText() });
        });
    }
    tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
    tooltip.activateHoverHelp(tree);

    Button button = new Button(frame, SWT.PUSH);
    button.setText(getResourceString("Hello.text"));
    button.setData("TIP_TEXT", getResourceString("Hello.tooltip"));
    tooltip.activateHoverHelp(button);
}

From source file:grafici.MediciTimeSeriesChart.java

/**
 * A demonstration application showing how to create a simple time series
 * chart. This example uses monthly data.
 * // w w  w  .  j a  va2 s  . com
 * @param title
 *            the frame title.
 */
public MediciTimeSeriesChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);

    Label titolo = new Label(this, SWT.NONE);
    titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD));
    titolo.setText(title);
    GridData gdLbl = new GridData(SWT.FILL);
    titolo.setLayoutData(gdLbl);
    Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
    GridData gdCmp = new GridData(SWT.FILL);
    gdCmp.horizontalAlignment = SWT.FILL;
    gdCmp.verticalAlignment = SWT.FILL;
    gdCmp.grabExcessHorizontalSpace = true;
    gdCmp.grabExcessVerticalSpace = true;
    cmp.setLayoutData(gdCmp);
    cmp.setLayout(new GridLayout(1, false));
    JPanel chartPanel = createDemoPanel(tipo);
    Frame graphFrame = SWT_AWT.new_Frame(cmp);
    graphFrame.add(chartPanel);
    graphFrame.pack();

    GridData gdThis = new GridData(SWT.FILL);
    gdThis.horizontalAlignment = SWT.FILL;
    gdThis.verticalAlignment = SWT.FILL;
    gdThis.grabExcessHorizontalSpace = true;
    gdThis.grabExcessVerticalSpace = true;

    this.setLayoutData(gdThis);
    this.setLayout(new GridLayout(1, false));
}

From source file:edu.isistan.carcha.plugin.editors.DXMIEditor.java

/**
 * Creates the DDD list page.// w  w w  .j  av a2s  .co m
 */
void createListPage() {
    final Composite composite = new Composite(getContainer(), SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 4));
    composite.setLayout(new GridLayout());
    Label concernLabel = new Label(composite, SWT.BORDER);
    concernLabel.setText("Design Decisions");
    concernLabel.setToolTipText("This are the Design Decisions detected in the architectural document");
    GridData gridData = new GridData(SWT.LEFT, SWT.LEFT, false, false);
    concernLabel.setLayoutData(gridData);

    ddsViewer = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    createColumns(composite, ddsViewer);

    final Table table = ddsViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    ddsViewer.setContentProvider(new ArrayContentProvider());

    getSite().setSelectionProvider(ddsViewer);
    // define layout for the viewer
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    ddsViewer.getControl().setLayoutData(gridData);

    int index = addPage(composite);
    setPageText(index, "List");
}

From source file:grafici.PrenotazioneTimeSeriesChart.java

/**
 * A demonstration application showing how to create a simple time series
 * chart. This example uses monthly data.
 * /*from ww w  .j a  v a2s  .  com*/
 * @param title
 *            the frame title.
 */
public PrenotazioneTimeSeriesChart(String title, Composite parent, int style, int tipo) {
    super(parent, style);

    Label titolo = new Label(this, SWT.NONE);
    titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD));
    titolo.setText(title);
    GridData gdLbl = new GridData(SWT.FILL);
    titolo.setLayoutData(gdLbl);
    Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED);
    GridData gdCmp = new GridData(SWT.FILL);
    gdCmp.horizontalAlignment = SWT.FILL;
    gdCmp.verticalAlignment = SWT.FILL;
    gdCmp.grabExcessHorizontalSpace = true;
    gdCmp.grabExcessVerticalSpace = true;
    cmp.setLayoutData(gdCmp);
    cmp.setLayout(new GridLayout(1, false));
    JPanel chartPanel = createDemoPanel(tipo);
    Frame graphFrame = SWT_AWT.new_Frame(cmp);
    graphFrame.add(chartPanel);
    graphFrame.pack();

    GridData gdThis = new GridData(SWT.FILL);
    gdThis.horizontalAlignment = SWT.FILL;
    gdThis.verticalAlignment = SWT.FILL;
    gdThis.grabExcessHorizontalSpace = true;
    gdThis.grabExcessVerticalSpace = true;

    this.setLayoutData(gdThis);
    this.setLayout(new GridLayout(1, false));
}