Example usage for org.eclipse.swt.custom ScrolledComposite ScrolledComposite

List of usage examples for org.eclipse.swt.custom ScrolledComposite ScrolledComposite

Introduction

In this page you can find the example usage for org.eclipse.swt.custom ScrolledComposite ScrolledComposite.

Prototype

public ScrolledComposite(Composite parent, int style) 

Source Link

Document

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Usage

From source file:at.ac.tuwien.inso.subcat.ui.widgets.TimeChartControlPanel.java

public TimeChartControlPanel(Composite parent, int style) {
    super(parent, SWT.NONE);
    setLayout(new GridLayout(3, false));

    Composite composite = new Composite(this, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
    GridLayout gl_composite = new GridLayout(3, false);
    gl_composite.verticalSpacing = 0;/*  www . j  ava 2s. co  m*/
    gl_composite.marginWidth = 0;
    gl_composite.marginHeight = 0;
    gl_composite.horizontalSpacing = 0;
    composite.setLayout(gl_composite);

    // Chart, Top Panel:
    new Label(composite, SWT.NONE);
    ;

    Composite chartTopComposite = new Composite(composite, SWT.NONE);
    GridLayout chartBottomLayout = new GridLayout(3, true);
    chartTopComposite.setLayout(chartBottomLayout);
    chartBottomLayout.verticalSpacing = 0;
    chartBottomLayout.marginWidth = 0;
    chartBottomLayout.marginHeight = 0;
    chartBottomLayout.horizontalSpacing = 0;

    chartTopComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
    yearSelector = new Combo(chartTopComposite, SWT.READ_ONLY);

    chartTopComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    chartSelector = new Combo(chartTopComposite, SWT.READ_ONLY);
    chartSelector.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));

    chartTopComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    Button saveButton = new Button(chartTopComposite, SWT.NONE);
    saveButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    saveButton.setText("Save");

    new Label(composite, SWT.NONE);

    // Chart Row:
    btnPrev = new Button(composite, SWT.NONE);
    btnPrev.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    btnPrev.setText("<");

    // TODO: drop scrolledComposite 
    scrolledComposite = new ScrolledComposite(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayout(new FillLayout());

    chartComposite = new ChartComposite(scrolledComposite, SWT.NONE, null);
    chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    chartComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
    scrolledComposite.setContent(chartComposite);

    btnNext = new Button(composite, SWT.NONE);
    btnNext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    btnNext.setText(">");

    // ** Event handling:

    chartSelector.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            for (TimeChartControlPanelListener listener : listeners) {
                listener.chartSelectionChanged();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    // *** Year Setting:
    yearSelector.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    btnPrev.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            yearSelector.select(yearSelector.getSelectionIndex() - 1);
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    btnNext.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            yearSelector.select(yearSelector.getSelectionIndex() + 1);
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    saveButton.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fd = new FileDialog(TimeChartControlPanel.this.getShell(), SWT.SAVE);
            fd.setText("Save Chart");
            String[] filterExt = { "*.png", "*.jpg" };
            fd.setFilterExtensions(filterExt);
            String selectedPath = fd.open();
            if (selectedPath == null) {
                return;
            }

            for (TimeChartControlPanelListener listener : listeners) {
                listener.chartSaveRequest(selectedPath);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}

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 . j  ava 2  s .com
        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:org.locationtech.udig.processingtoolbox.tools.ScatterPlotDialog.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.ScatterPlotDialog_IndependentField, EMPTY, image, 1);
    cboXField = uiBuilder.createCombo(container, 1, true);

    uiBuilder.createLabel(container, Messages.ScatterPlotDialog_DependentField, EMPTY, image, 1);
    cboYField = uiBuilder.createCombo(container, 1, true);

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

    // register events
    cboLayer.addModifyListener(new ModifyListener() {
        @Override// w ww .ja v a2  s.  c o m
        public void modifyText(ModifyEvent e) {
            inputLayer = MapUtils.getLayer(map, cboLayer.getText());
            if (inputLayer != null) {
                fillFields(cboXField, inputLayer.getSchema(), FieldType.Number);
                fillFields(cboYField, inputLayer.getSchema(), FieldType.Number);
            }
        }
    });

    // 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:at.ac.tuwien.inso.subcat.ui.widgets.TrendView.java

public TrendView(Composite parent, int style) {
    super(parent, style);
    initCharts();//from ww  w .  j av  a2 s. c o  m

    setLayout(new FillLayout());

    SashForm sashForm = new SashForm(this, SWT.VERTICAL);

    timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER);
    timeChart.addChartSelectionEntry("Trend View", SelectedChart.LINE);
    timeChart.addChartSelectionEntry("Bar View", SelectedChart.BAR);
    timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH);

    JFreeChart chart = createChart(SelectedChart.LINE);
    setChart(chart);

    scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new FillLayout());

    optionComposite = new Composite(scrolledComposite, SWT.NONE);
    optionComposite.setLayout(new GridLayout(3, false));

    scrolledComposite.setContent(optionComposite);
    scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setAlwaysShowScrollBars(false);

    // Signals:
    boxListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.getSource();
            ChartIdentifier boxData = (ChartIdentifier) button.getData();
            assert (boxData != null);

            boolean checked = button.getSelection();

            if (boxData.paint == null) {
                boxData.paint = drawingSupplier.getNextPaint();
            }

            if (checked) {
                java.awt.Color paintColor = (java.awt.Color) boxData.paint;
                Color color = new Color(null, paintColor.getRed(), paintColor.getGreen(), paintColor.getBlue());
                button.setBackground(color);
            } else {
                button.setBackground(null);
            }

            for (TrendViewListener listener : listeners) {
                listener.optionSelected(boxData, checked);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };

    comboListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.getSource();
            DropDownData data = (DropDownData) combo.getData();
            assert (data != null);
            DropDownConfig config = data.getConfig();

            for (TrendViewListener listener : listeners) {
                listener.comboChanged(config);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };
}

From source file:at.ac.tuwien.inso.subcat.ui.widgets.TrendChart.java

public TrendChart(Composite parent, int style) {
    super(parent, style);
    initCharts();/*www  .ja  va 2s . co m*/

    setLayout(new FillLayout());

    SashForm sashForm = new SashForm(this, SWT.VERTICAL);

    timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER);
    timeChart.addChartSelectionEntry("Trend View", SelectedChart.LINE);
    timeChart.addChartSelectionEntry("Bar View", SelectedChart.BAR);
    timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH);

    JFreeChart chart = createChart(SelectedChart.LINE);
    setChart(chart);

    scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new FillLayout());

    optionComposite = new Composite(scrolledComposite, SWT.NONE);
    optionComposite.setLayout(new GridLayout(3, false));

    scrolledComposite.setContent(optionComposite);
    scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setAlwaysShowScrollBars(false);

    // Signals:
    boxListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.getSource();
            ChartIdentifier boxData = (ChartIdentifier) button.getData();
            assert (boxData != null);

            boolean checked = button.getSelection();

            if (boxData.paint == null) {
                boxData.paint = drawingSupplier.getNextPaint();
            }

            if (checked) {
                java.awt.Color paintColor = (java.awt.Color) boxData.paint;
                Color color = new Color(null, paintColor.getRed(), paintColor.getGreen(), paintColor.getBlue());
                button.setBackground(color);
            } else {
                button.setBackground(null);
            }

            for (TrendChartListener listener : listeners) {
                listener.optionSelected(boxData, checked);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };

    comboListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.getSource();
            DropDownData data = (DropDownData) combo.getData();
            assert (data != null);
            DropDownConfig config = data.getConfig();

            for (TrendChartListener listener : listeners) {
                listener.comboChanged(config);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };
}

From source file:org.locationtech.udig.processingtoolbox.tools.BubbleChartDialog.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.BubbleChartDialog_XField, EMPTY, image, 1);
    cboXField = uiBuilder.createCombo(container, 1, true);

    uiBuilder.createLabel(container, Messages.BubbleChartDialog_YField, EMPTY, image, 1);
    cboYField = uiBuilder.createCombo(container, 1, true);

    uiBuilder.createLabel(container, Messages.BubbleChartDialog_SizeField, EMPTY, image, 1);
    cboSize = uiBuilder.createCombo(container, 1, true);

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

    // register events
    cboLayer.addModifyListener(new ModifyListener() {
        @Override/*www .  ja  v a  2s.c  om*/
        public void modifyText(ModifyEvent e) {
            inputLayer = MapUtils.getLayer(map, cboLayer.getText());
            if (inputLayer != null) {
                fillFields(cboXField, inputLayer.getSchema(), FieldType.Number);
                fillFields(cboYField, inputLayer.getSchema(), FieldType.Number);
                fillFields(cboSize, inputLayer.getSchema(), FieldType.Number);
            }
        }
    });

    // 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:at.ac.tuwien.inso.subcat.ui.widgets.DistributionView.java

public DistributionView(Composite parent, int style) {
    super(parent, style);

    listeners = new LinkedList<DistributionViewListener>();
    identifiers = new LinkedList<ChartIdentifier>();
    initCharts();//from   www  .  j  a v a  2 s .  c  o  m

    setLayout(new FillLayout());

    SashForm sashForm = new SashForm(this, SWT.VERTICAL);

    timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER);
    timeChart.addChartSelectionEntry("Distribution View", SelectedChart.DISTRIBUTION);
    timeChart.addChartSelectionEntry("Bar View", SelectedChart.SIZE);
    timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH);

    JFreeChart chart = createChart(SelectedChart.DISTRIBUTION);
    setChart(chart);

    scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new FillLayout());

    optionComposite = new Composite(scrolledComposite, SWT.NONE);
    optionComposite.setLayout(new GridLayout(3, false));

    scrolledComposite.setContent(optionComposite);
    scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setAlwaysShowScrollBars(false);

    configSelectionListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.getSource();
            ChartIdentifier identifier = (ChartIdentifier) combo.getData("identifier");
            assert (identifier != null);

            for (DistributionViewListener listener : listeners) {
                listener.optionChanged(identifier);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };
}

From source file:at.ac.tuwien.inso.subcat.ui.widgets.DistributionChart.java

public DistributionChart(Composite parent, int style) {
    super(parent, style);

    listeners = new LinkedList<DistributionChartListener>();
    identifiers = new LinkedList<ChartIdentifier>();
    initCharts();// w  w  w.ja v a  2 s .com

    setLayout(new FillLayout());

    SashForm sashForm = new SashForm(this, SWT.VERTICAL);

    timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER);
    timeChart.addChartSelectionEntry("Distribution View", SelectedChart.DISTRIBUTION);
    timeChart.addChartSelectionEntry("Bar View", SelectedChart.SIZE);
    timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH);

    JFreeChart chart = createChart(SelectedChart.DISTRIBUTION);
    setChart(chart);

    scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new FillLayout());

    optionComposite = new Composite(scrolledComposite, SWT.NONE);
    optionComposite.setLayout(new GridLayout(3, false));

    scrolledComposite.setContent(optionComposite);
    scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setAlwaysShowScrollBars(false);

    configSelectionListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.getSource();
            ChartIdentifier identifier = (ChartIdentifier) combo.getData("identifier");
            assert (identifier != null);

            for (DistributionChartListener listener : listeners) {
                listener.optionChanged(identifier);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    };
}

From source file:org.locationtech.udig.processingtoolbox.tools.HistogramDialog.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(2, 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.HistogramDialog_InputLayer, EMPTY, image, 2);
    cboLayer = uiBuilder.createCombo(container, 2, true);
    fillLayers(map, cboLayer, VectorLayerType.ALL);

    uiBuilder.createLabel(container, Messages.HistogramDialog_InputField, EMPTY, image, 2);
    cboField = uiBuilder.createCombo(container, 2, true);

    uiBuilder.createLabel(container, Messages.HistogramDialog_BinCount, EMPTY, image, 2);
    spinner = uiBuilder.createSpinner(container, 10, 1, 50, 0, 1, 5, 2);

    // yXais Type
    uiBuilder.createLabel(container, Messages.HistogramDialog_YAxisType, EMPTY, image, 1);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;/*  w ww .  j  ava 2 s. co  m*/

    Composite subCon = new Composite(container, SWT.NONE);
    subCon.setLayout(layout);
    subCon.setLayoutData(new GridData(SWT.LEFT_TO_RIGHT, SWT.CENTER, false, false, 1, 1));
    final Button chkRatio = uiBuilder.createRadioButton(subCon, Messages.HistogramDialog_Ratio, null, 1);
    final Button chkFrequency = uiBuilder.createRadioButton(subCon, Messages.HistogramDialog_Frequency, null,
            1);
    chkFrequency.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (chkFrequency.getSelection()) {
                histogramType = HistogramType.FREQUENCY;
            }
        }
    });
    chkRatio.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (chkRatio.getSelection()) {
                histogramType = HistogramType.RELATIVE_FREQUENCY;
            }
        }
    });
    chkRatio.setSelection(true);

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

    // register events
    cboLayer.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            inputLayer = MapUtils.getLayer(map, cboLayer.getText());
            if (inputLayer != null) {
                fillFields(cboField, inputLayer.getSchema(), FieldType.Number);
            }
        }
    });

    // 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:org.locationtech.udig.processingtoolbox.tools.MoranScatterPlotDialog.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.MoranScatterPlotDialog_InputLayer, EMPTY, image, 1);
    cboLayer = uiBuilder.createCombo(container, 1, true);
    fillLayers(map, cboLayer, VectorLayerType.ALL);

    uiBuilder.createLabel(container, Messages.MoranScatterPlotDialog_InputField, EMPTY, image, 1);
    cboField = uiBuilder.createCombo(container, 1, true);

    uiBuilder.createLabel(container, Messages.MoranScatterPlotDialog_Conceptualization, EMPTY, 1);
    cboConcept = uiBuilder.createCombo(container, 1, true);
    cboConcept.addModifyListener(new ModifyListener() {
        @Override/*from ww w  .  ja  v a 2  s . c  o  m*/
        public void modifyText(ModifyEvent e) {
            for (Object enumVal : SpatialConcept.class.getEnumConstants()) {
                if (enumVal.toString().equalsIgnoreCase(cboConcept.getText())) {
                    params.put(GlobalMoransIProcessFactory.spatialConcept.key, enumVal);
                    break;
                }
            }
        }
    });
    fillEnum(cboConcept, SpatialConcept.class);

    uiBuilder.createLabel(container, Messages.MoranScatterPlotDialog_DistanceMethod, EMPTY, 1);
    cboDistance = uiBuilder.createCombo(container, 1, true);
    cboDistance.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            for (Object enumVal : DistanceMethod.class.getEnumConstants()) {
                if (enumVal.toString().equalsIgnoreCase(cboDistance.getText())) {
                    params.put(GlobalMoransIProcessFactory.distanceMethod.key, enumVal);
                    break;
                }
            }
        }
    });
    fillEnum(cboDistance, DistanceMethod.class);

    uiBuilder.createLabel(container, Messages.MoranScatterPlotDialog_Standardization, EMPTY, 1);
    cboStandard = uiBuilder.createCombo(container, 1, true);
    cboStandard.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            for (Object enumVal : StandardizationMethod.class.getEnumConstants()) {
                if (enumVal.toString().equalsIgnoreCase(cboStandard.getText())) {
                    params.put(GlobalMoransIProcessFactory.standardization.key, enumVal);
                    break;
                }
            }
        }
    });
    fillEnum(cboStandard, StandardizationMethod.class);

    uiBuilder.createLabel(container, Messages.MoranScatterPlotDialog_DistanceBand, EMPTY, 1);
    final Text txtDistance = uiBuilder.createText(container, EMPTY, 1, true);
    txtDistance.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            Object obj = Converters.convert(txtDistance.getText(), Double.class);
            if (obj == null) {
                params.put(GlobalMoransIProcessFactory.searchDistance.key, Double.valueOf(0d));
            } else {
                params.put(GlobalMoransIProcessFactory.searchDistance.key, obj);
            }
        }
    });

    // register events
    cboLayer.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            inputLayer = MapUtils.getLayer(map, cboLayer.getText());
            if (inputLayer == null) {
                return;
            }
            SimpleFeatureCollection features = MapUtils.getFeatures(inputLayer);
            params.put(GlobalMoransIProcessFactory.inputFeatures.key, features);
            fillFields(cboField, inputLayer.getSchema(), FieldType.Number);
        }
    });

    cboField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            params.put(GlobalMoransIProcessFactory.inputField.key, cboField.getText());
        }
    });

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

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

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