Example usage for org.eclipse.jface.databinding.swt SWTObservables observeSelection

List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeSelection

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt SWTObservables observeSelection.

Prototype

@Deprecated
public static ISWTObservableValue observeSelection(Control control) 

Source Link

Document

Returns an observable observing the selection attribute of the provided control.

Usage

From source file:org.kalypso.model.wspm.pdb.ui.internal.wspm.UpdatePdbCrossSectionsOptionPage.java

License:Open Source License

private void createCommentOption(final Composite parent) {
    final Button checkbox = new Button(parent, SWT.CHECK);
    checkbox.setText(Messages.getString("UpdatePdbCrossSectionsOptionPage_2")); //$NON-NLS-1$
    checkbox.setToolTipText(Messages.getString("UpdatePdbCrossSectionsOptionPage_3")); //$NON-NLS-1$
    checkbox.setEnabled(false);/*  w  w w.j a v a 2s  .c  o m*/

    final ISWTObservableValue target = SWTObservables.observeSelection(checkbox);
    final IObservableValue model = BeansObservables.observeValue(m_data,
            UpdatePdbCrossSectionsData.PROPERTY_UPDATE_COMMENTS);

    m_binding.bindValue(target, model);
}

From source file:org.kalypso.model.wspm.tuhh.ui.export.bankline.BanklineExportOptionsPage.java

License:Open Source License

private void createDensifyControls(final Composite parent) {
    final Composite panel = new Composite(parent, SWT.NONE);
    panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(panel);

    final Button checkbox = new Button(panel, SWT.CHECK);
    checkbox.setText(Messages.getString("BanklineExportOptionsPage.0")); //$NON-NLS-1$
    checkbox.setToolTipText(Messages.getString("BanklineExportOptionsPage.1")); //$NON-NLS-1$

    final Text densifyField = new Text(panel, SWT.BORDER | SWT.RIGHT);
    densifyField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    densifyField.setText(Messages.getString("BanklineExportOptionsPage.2")); //$NON-NLS-1$

    /* binding */
    final ISWTObservableValue targetCheckbox = SWTObservables.observeSelection(checkbox);
    final ISWTObservableValue targetFieldEnablement = SWTObservables.observeEnabled(densifyField);
    final ISWTObservableValue targetFieldValue = SWTObservables.observeText(densifyField, SWT.Modify);

    final IObservableValue modelDensifyEnabled = BeansObservables.observeValue(m_data,
            BanklineExportData.PROPERTY_DENSIFY_ENABLED);
    final IObservableValue modelDensifyValue = BeansObservables.observeValue(m_data,
            BanklineExportData.PROPERTY_DENSIFY_DISTANCE);

    m_binding.bindValue(targetCheckbox, modelDensifyEnabled);
    m_binding.bindValue(targetFieldEnablement, modelDensifyEnabled);
    m_binding.bindValue(targetFieldValue, modelDensifyValue);
}

From source file:org.kalypso.model.wspm.tuhh.ui.export.wspwin.PlotterExportPage.java

License:Open Source License

private void createFields(final Composite parent) {
    /* Print Button */
    final Button button = new Button(parent, SWT.CHECK);
    button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    button.setText(Messages.getString("PlotterExportPage_1")); //$NON-NLS-1$
    button.setToolTipText(Messages.getString("PlotterExportPage_2")); //$NON-NLS-1$

    final ISWTObservableValue targetPrint = SWTObservables.observeSelection(button);
    final IObservableValue modelPrint = BeansObservables.observeValue(m_data,
            PlotterExportData.PROPERTY_DO_PRINT);

    m_binding.bindValue(targetPrint, modelPrint);

    /* Sleep *///from   w w  w .  j  a  v  a 2s .  c o m
    new Label(parent, SWT.NONE).setText(Messages.getString("PlotterExportPage.0")); //$NON-NLS-1$

    final Text field = new Text(parent, SWT.BORDER | SWT.SINGLE);
    field.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    field.setToolTipText(Messages.getString("PlotterExportPage.1")); //$NON-NLS-1$

    final ISWTObservableValue targetSleep = SWTObservables.observeText(field, SWT.Modify);
    final IObservableValue modelSleep = BeansObservables.observeValue(m_data,
            PlotterExportData.PROPERTY_SLEEP_TIME);
    final DataBinder binder = new DataBinder(targetSleep, modelSleep);
    binder.addTargetAfterConvertValidator(
            new NotNullValidator<>(Long.class, IStatus.ERROR, Messages.getString("PlotterExportPage.2"))); //$NON-NLS-1$
    binder.addTargetAfterConvertValidator(new NumberNotNegativeValidator(IStatus.ERROR));
    m_binding.bindValue(binder);

    /* Enable/Disable sleep field */
    final ISWTObservableValue targetEnabled = SWTObservables.observeEnabled(field);
    final IObservableValue modelEnabled = modelPrint;
    m_binding.bindValue(targetEnabled, modelEnabled);
}

From source file:org.kalypso.model.wspm.tuhh.ui.imports.ewawi.EwawiImportFilesPage.java

License:Open Source License

private void createDirectionUpstreamsControls(final Group optionsGroup,
        final DatabindingWizardPage dataBinding) {
    final Button directionUpstreamsButton = new Button(optionsGroup, SWT.CHECK);
    directionUpstreamsButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    directionUpstreamsButton.setText(Messages.getString("EwawiImportFilesPage.17")); //$NON-NLS-1$

    final IObservableValue target = SWTObservables.observeSelection(directionUpstreamsButton);
    final IObservableValue model = BeansObservables.observeValue(m_data,
            EwawiImportData.PROPERTY_DIRECTION_UPSTREAMS);
    dataBinding.bindValue(target, model);
}

From source file:org.kalypso.model.wspm.tuhh.ui.panel.EnergylossPanel.java

License:Open Source License

private DataBinder bind(final Combo combo, final EnergylossDataModel model) {
    final ISWTObservableValue targetValue = SWTObservables.observeSelection(combo);
    final IObservableValue modelValue = BeansObservables.observeValue(model,
            EnergylossDataModel.PROPERTY_ENERGYLOSS_TYPE);
    return new DataBinder(targetValue, modelValue);
}

From source file:org.kalypso.model.wspm.tuhh.ui.wizards.WspWinExportDestinationPage.java

License:Open Source License

/**
 * Create the button for checking if we should ask if we are going to overwrite existing files.
 */// w w  w  . j  ava2 s  .c  o m
protected void createOverwriteExisting(final Group optionsGroup) {
    final Button overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
    overwriteExistingFilesCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    overwriteExistingFilesCheckbox.setText(OVERWRITE_EXISTING_CHECK_LABEL);
    overwriteExistingFilesCheckbox.setFont(optionsGroup.getFont());

    final ISWTObservableValue target = SWTObservables.observeSelection(overwriteExistingFilesCheckbox);
    final IObservableValue model = BeansObservables.observeValue(m_data,
            WspWinExportProjectData.PROPERTY_OVERWRITE_EXISTING);
    m_binding.bindValue(target, model);
}

From source file:org.kalypso.ui.addlayer.internal.wms.ImportWmsWizardPage.java

License:Open Source License

private void createMultiLayerControl(final Composite parent) {
    final Button checkbox = new Button(parent, SWT.CHECK);
    checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1));

    checkbox.setText(Messages.getString("org.kalypso.ui.wizard.wms.pages.ImportWmsWizardPage.10")); //$NON-NLS-1$
    checkbox.setToolTipText(Messages.getString("org.kalypso.ui.wizard.wms.pages.ImportWmsWizardPage.11")); //$NON-NLS-1$

    /**//w ww . j a  v a  2 s. c  o  m
     * BIDING
     */
    final ISWTObservableValue targetEnablement = SWTObservables.observeEnabled(checkbox);
    final IObservableValue modelEnablement = BeansObservables.observeValue(m_data,
            ImportWmsData.PROPERTY_MULTI_LAYER_ENABLEMENT);
    m_binding.bindValue(targetEnablement, modelEnablement);

    final ISWTObservableValue targetValue = SWTObservables.observeSelection(checkbox);
    final IObservableValue modelValue = BeansObservables.observeValue(m_data,
            ImportWmsData.PROPERTY_MULTI_LAYER);
    m_binding.bindValue(targetValue, modelValue);
}

From source file:org.kalypso.ui.editor.styleeditor.fill.FillComposite.java

License:Open Source License

private void createOpacityControl(final FormToolkit toolkit, final Composite parent) {
    toolkit.createLabel(parent, Messages.getString("org.kalypso.ui.editor.sldEditor.FillEditorComposite.14")); //$NON-NLS-1$

    final Spinner spinner = new Spinner(parent, SWT.BORDER);
    toolkit.adapt(spinner, true, true);//  w  w w.j a va 2s  .  c o  m
    spinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final IObservableValue target = SWTObservables.observeSelection(spinner);
    final FillOpacityValue model = new FillOpacityValue(m_input);

    model.configureSpinner(spinner);

    m_binding.bindValue(target, model);
}

From source file:org.kalypso.ui.editor.styleeditor.graphic.GraphicComposite.java

License:Open Source License

private Control createSizeControl(final FormToolkit toolkit, final Composite parent) {
    final Composite composite = toolkit.createComposite(parent);
    composite.setLayout(Layouts.createGridLayout(2));

    toolkit.createLabel(composite, MessageBundle.STYLE_EDITOR_SIZE);

    final Spinner sizeSpinner = new Spinner(composite, SWT.BORDER);
    toolkit.adapt(sizeSpinner, true, true);
    sizeSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final GraphicSizeValue graphicSizeField = new GraphicSizeValue(m_input);
    graphicSizeField.configureSpinner(sizeSpinner);

    final ISWTObservableValue target = SWTObservables.observeSelection(sizeSpinner);
    m_binding.bindValue(target, graphicSizeField, new NumberNotNegativeValidator(IStatus.WARNING));

    return composite;
}

From source file:org.kalypso.ui.editor.styleeditor.graphic.GraphicComposite.java

License:Open Source License

private Control createRotationControl(final FormToolkit toolkit, final Composite parent) {
    final Composite composite = toolkit.createComposite(parent);
    composite.setLayout(Layouts.createGridLayout(2));

    toolkit.createLabel(composite, MessageBundle.STYLE_EDITOR_ROTATION);

    final Spinner rotationSpinner = new Spinner(composite, SWT.BORDER);
    toolkit.adapt(rotationSpinner, true, true);
    rotationSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final GraphicRotationField graphicRotationField = new GraphicRotationField(m_input);
    graphicRotationField.configureSpinner(rotationSpinner);

    final ISWTObservableValue target = SWTObservables.observeSelection(rotationSpinner);
    m_binding.bindValue(target, graphicRotationField, new NumberNotNegativeValidator(IStatus.WARNING));

    return composite;
}