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

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

Introduction

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

Prototype

@Deprecated
public static ISWTObservableValue observeText(Control control, int event) 

Source Link

Document

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

Usage

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 *///  w  w w  . j  a v  a 2  s . c  om
    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.sobek.SobekImportFilePage.java

License:Open Source License

private void createStationControls(final Composite panel) {
    final Group group = new Group(panel, SWT.NONE);
    group.setText(Messages.getString("SobekImportFilePage.6")); //$NON-NLS-1$
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(group);

    new Label(group, SWT.NONE).setText(Messages.getString("SobekImportFilePage.7")); //$NON-NLS-1$

    final ComboViewer combo = new ComboViewer(group);
    combo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    combo.setContentProvider(new ArrayContentProvider());
    combo.setLabelProvider(new LabelProvider());
    combo.setInput(GUESS_STATION_STRATEGY.values());

    final IViewerObservableValue targetStrategy = ViewersObservables.observeSinglePostSelection(combo);
    final IObservableValue modelStrategy = BeansObservables.observeValue(m_data,
            SobekImportData.PROPERTY_STATION_STRATEGY);
    m_binding.bindValue(targetStrategy, modelStrategy);

    new Label(group, SWT.NONE);

    /* Pattern control */
    final Label patternLabel = new Label(group, SWT.NONE);
    patternLabel.setText(Messages.getString("SobekImportFilePage.8")); //$NON-NLS-1$

    final Text patternField = new Text(group, SWT.BORDER);
    patternField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    patternField.setMessage(Messages.getString("SobekImportFilePage.9")); //$NON-NLS-1$
    patternField.setToolTipText(Messages.getString("SobekImportFilePage.10")); //$NON-NLS-1$

    final GuessStationPatternReplacer replacer = new GuessStationPatternReplacer();
    replacer.createPatternButton(group, patternField);

    final ISWTObservableValue targetPattern = SWTObservables.observeText(patternField, SWT.Modify);
    final IObservableValue modelPattern = BeansObservables.observeValue(m_data,
            SobekImportData.PROPERTY_STATION_PATTERN);
    final DataBinder binderPattern = new DataBinder(targetPattern, modelPattern);
    binderPattern.addTargetAfterGetValidator(new GuessStationPatternValidator());
    m_binding.bindValue(binderPattern);//from  w  ww . j a v  a  2s  . c o  m

    final ISWTObservableValue targetEnablement = SWTObservables.observeEditable(patternField);
    final IObservableValue modelEnablement = BeansObservables.observeValue(m_data,
            SobekImportData.PROPERTY_STATION_PATTERN_ENABLED);
    m_binding.bindValue(targetEnablement, modelEnablement);

    final ISWTObservableValue targetLabelEnablement = SWTObservables.observeEnabled(patternLabel);
    final IObservableValue modelLabelEnablement = BeansObservables.observeValue(m_data,
            SobekImportData.PROPERTY_STATION_PATTERN_ENABLED);
    m_binding.bindValue(targetLabelEnablement, modelLabelEnablement);
}

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

License:Open Source License

private DataBinder bind(final Text textField, final EnergylossDataModel model) {
    final ISWTObservableValue targetValue = SWTObservables.observeText(textField,
            SLDBinding.TEXT_DEFAULT_EVENTS);
    final IObservableValue modelValue = BeansObservables.observeValue(model,
            EnergylossDataModel.PROPERTY_ENERGYLOSS_VALUE);
    return new DataBinder(targetValue, modelValue);
}

From source file:org.kalypso.model.wspm.tuhh.ui.panel.roughness.pages.AbstractRoughnessPage.java

License:Open Source License

protected void bind(final Text textField, final String property) {
    final ISWTObservableValue targetValue = SWTObservables.observeText(textField,
            SLDBinding.TEXT_DEFAULT_EVENTS);
    final IObservableValue modelValue = m_model.getObservableValue(property);

    final DataBinder binder = new DataBinder(targetValue, modelValue);

    m_binding.bindValue(binder);//from   w  w  w . ja  v a2 s  . c  om
}

From source file:org.kalypso.model.wspm.tuhh.ui.panel.vegetation.pages.VegetationPropertiesPage.java

License:Open Source License

protected void bind(final Text text, final VegetationsDataModel model, final String property) {
    final ISWTObservableValue targetValue = SWTObservables.observeText(text, SLDBinding.TEXT_DEFAULT_EVENTS);
    final IObservableValue modelValue = model.getObservableValue(property);

    final DataBinder binder = new DataBinder(targetValue, modelValue);

    m_binding.bindValue(binder);//  w w w  .j  ava  2 s. c o m
}

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

License:Open Source License

private void createNameControl(final Composite parent) {
    final Label lName = new Label(parent, SWT.NONE);
    lName.setText(Messages.getString("ProfileFromDEMWizardPage.0")); //$NON-NLS-1$

    final Text tName = new Text(parent, SWT.BORDER);
    tName.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

    /* Binding */
    final ISWTObservableValue target = SWTObservables.observeText(tName, SWT.Modify);
    final IObservableValue model = BeansObservables.observeValue(m_data, ProfileFromDEMData.PROPERTY_NAME);

    final DataBinder binder = new DataBinder(target, model);

    final String warning = Messages.getString("org.kalypso.model.wspm.tuhh.ui.wizard.CreateProfileFromDem.6"); //$NON-NLS-1$
    binder.addTargetAfterGetValidator(new StringBlankValidator(IStatus.WARNING, warning));

    m_binding.bindValue(binder);/* w w w . j a  v  a 2  s . co m*/
}

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

License:Open Source License

private void createStationControls(final Composite parent) {
    final Label lStation = new Label(parent, SWT.NONE);
    lStation.setText(Messages.getString("ProfileFromDEMWizardPage.1")); //$NON-NLS-1$

    final Text tStation = new Text(parent, SWT.BORDER);
    tStation.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

    /* Binding */
    final ISWTObservableValue target = SWTObservables.observeText(tStation, SWT.Modify);
    final IObservableValue model = BeansObservables.observeValue(m_data, ProfileFromDEMData.PROPERTY_STATION);

    final DataBinder binder = new DataBinder(target, model);

    final String error = Messages.getString("org.kalypso.model.wspm.tuhh.ui.wizard.CreateProfileFromDem.7"); //$NON-NLS-1$
    binder.addTargetAfterGetValidator(new StringBlankValidator(IStatus.ERROR, error));
    binder.addTargetAfterConvertValidator(new DoubleNaNValidator(IStatus.WARNING, error));

    m_binding.bindValue(binder);// w w w  . j  a  v a 2  s  .c  o  m
}

From source file:org.kalypso.ogc.gml.outline.handler.ExportFileControls.java

License:Open Source License

public void createControls(final Composite parent, final int numFieldColumns) {
    final Text fileField = new Text(parent, SWT.BORDER | SWT.SINGLE);
    fileField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Button fileButton = new Button(parent, SWT.PUSH);
    fileButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, numFieldColumns, 1));
    fileButton.setText(Messages.getString("ExportFileControls_0")); //$NON-NLS-1$

    /* field binding */
    final ISWTObservableValue target = SWTObservables.observeText(fileField,
            new int[] { SWT.Modify, SWT.DefaultSelection });
    final IObservableValue model = BeansObservables.observeValue(m_data,
            AbstractExportFileData.PROPERTY_EXPORT_FILE);
    final DataBinder binder = new DataBinder(target, model);

    binder.setTargetToModelConverter(new StringToFileConverter());
    binder.setModelToTargetConverter(new FileToStringConverter());

    binder.addTargetAfterGetValidator(// www. j av a2s .co m
            new StringBlankValidator(IStatus.ERROR, Messages.getString("ExportFileControls_1"))); //$NON-NLS-1$
    binder.addTargetAfterConvertValidator(new FileShouldNotBeDirectoryValidator());
    binder.addTargetAfterConvertValidator(new FileAlreadyExistsValidator());

    m_binding.bindValue(binder);

    /* Button binding */
    m_fileListener.addAllFilter();
    m_fileListener.setFileValue(model);
    fileButton.addSelectionListener(m_fileListener);
}

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

License:Open Source License

private void createAddressControls() {
    final Label label = new Label(this, SWT.NONE);

    label.setText(Messages.getString("org.kalypso.ui.wizard.wms.pages.ImportWmsWizardPage.2")); //$NON-NLS-1$
    label.setToolTipText(Messages.getString("org.kalypso.ui.wizard.wms.pages.ImportWmsWizardPage.3")); //$NON-NLS-1$

    final Text addressField = new Text(this, SWT.BORDER);
    addressField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    addressField.setToolTipText(Messages.getString("org.kalypso.ui.wizard.wms.pages.ImportWmsWizardPage.3")); //$NON-NLS-1$
    addressField.setEnabled(false);//from ww  w . jav  a  2  s  .co m

    /**
     * Binding
     */
    final ISWTObservableValue targetAddress = SWTObservables.observeText(addressField,
            new int[] { SWT.FocusOut, SWT.DefaultSelection });
    final IObservableValue modelAddress = BeansObservables.observeValue(m_data, ImportWmsData.PROPERTY_ADDRESS);
    m_binding.bindValue(targetAddress, modelAddress);
}