List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeText
@Deprecated public static ISWTObservableValue observeText(Control control, int event)
control
. From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.gaf.ImportGafPage.java
License:Open Source License
private Control createGafPathControl(final Composite parent) { final Group group = new Group(parent, SWT.NONE); group.setText(Messages.getString("ImportGafPage.2")); //$NON-NLS-1$ GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(group); final Text text = new Text(group, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setMessage(Messages.getString("ImportGafPage.3")); //$NON-NLS-1$ final Button fileSelectButton = new Button(group, SWT.PUSH); fileSelectButton.setText("..."); //$NON-NLS-1$ /* Binding */ final ISWTObservableValue target = SWTObservables.observeText(text, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_data, ImportGafData.PROPERTY_GAF_FILE); final DataBinder binder = new DataBinder(target, model); binder.setTargetToModelConverter(new StringToFileConverter()); binder.setModelToTargetConverter(new FileToStringConverter()); binder.addTargetAfterGetValidator(//from ww w .j a va 2 s .c om new StringBlankValidator(IStatus.ERROR, Messages.getString("ImportGafPage.5"))); //$NON-NLS-1$ binder.addTargetAfterConvertValidator(new FileIsFileValidator(IStatus.ERROR)); m_context.bindValue(binder); final String titel = Messages.getString("ImportGafPage.6"); //$NON-NLS-1$ final FileValueSelectionListener fileListener = new FileValueSelectionListener(model, titel, SWT.OPEN); fileListener.addFilter(Messages.getString("ImportGafPage.7"), "*.gaf"); //$NON-NLS-1$ //$NON-NLS-2$ fileListener.addAllFilter(); fileSelectButton.addSelectionListener(fileListener); return group; }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.gaf.WaterlevelComposite.java
License:Open Source License
private void createNameControls(final Composite parent) { new Label(parent, SWT.NONE).setText(Messages.getString("WaterlevelComposite.0")); //$NON-NLS-1$ m_nameField = new Text(parent, SWT.BORDER | SWT.SINGLE); m_nameField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_nameField.setMessage(Messages.getString("WaterlevelComposite.1")); //$NON-NLS-1$ final ISWTObservableValue target = SWTObservables.observeText(m_nameField, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_event, Event.PROPERTY_NAME); final DataBinder binder = new DataBinder(target, model); binder.addTargetAfterGetValidator(/*from w w w .java 2s . co m*/ new StringBlankValidator(IStatus.ERROR, Messages.getString("WaterlevelComposite.2"))); //$NON-NLS-1$ m_uniqueEventNameValidator = new UniqueEventNameValidator(m_ignoreName); binder.addTargetAfterGetValidator(m_uniqueEventNameValidator); m_nameBinding = m_binding.bindValue(binder); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.gaf.WaterlevelComposite.java
License:Open Source License
private void createSourceControls(final Composite parent) { new Label(parent, SWT.NONE).setText(Messages.getString("WaterlevelComposite.3")); //$NON-NLS-1$ m_sourceField = new Text(parent, SWT.BORDER | SWT.SINGLE); m_sourceField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_sourceField.setMessage(Messages.getString("WaterlevelComposite.4")); //$NON-NLS-1$ final ISWTObservableValue target = SWTObservables.observeText(m_sourceField, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_event, Event.PROPERTY_SOURCE); final DataBinder binder = new DataBinder(target, model); binder.addTargetAfterGetValidator(/*from w w w . j av a2s. c o m*/ new StringBlankValidator(IStatus.WARNING, Messages.getString("WaterlevelComposite.5"))); //$NON-NLS-1$ m_binding.bindValue(binder); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.gaf.WaterlevelComposite.java
License:Open Source License
private void createDescriptionControls(final Composite parent) { final Label label = new Label(parent, SWT.NONE); label.setText(Messages.getString("WaterlevelComposite.6")); //$NON-NLS-1$ label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); m_descriptionField = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); m_descriptionField.setTextLimit(Event.DESCRIPTION_LIMIT); m_descriptionField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); m_descriptionField.setMessage(Messages.getString("WaterlevelComposite.7")); //$NON-NLS-1$ final IObservableValue target = SWTObservables.observeText(m_descriptionField, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_event, State.PROPERTY_DESCRIPTION); m_binding.bindValue(target, model);//from w w w.j a v a 2s. c om }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.state.StateViewer.java
License:Open Source License
private void createNameControls(final Composite parent) { new Label(parent, SWT.NONE).setText(Messages.getString("StateViewer.0")); //$NON-NLS-1$ final Text field = new Text(parent, SWT.BORDER); field.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); field.setMessage(Messages.getString("StateViewer.1")); //$NON-NLS-1$ field.setTextLimit(State.NAME_LIMIT); field.setEditable(m_editable);/* w w w .j av a2s. c o m*/ final IObservableValue target = SWTObservables.observeText(field, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_state, State.PROPERTY_NAME); final DataBinder binder = new DataBinder(target, model); binder.addTargetAfterGetValidator( new StringBlankValidator(IStatus.ERROR, Messages.getString("StateViewer.2"))); //$NON-NLS-1$ if (m_stateNameValidator != null) { binder.addTargetAfterGetValidator(m_stateNameValidator); // binder.addTargetBeforeSetValidator( m_stateNameValidator ); // FIXME: does not work correctly: if file is changed on file page, we will not get a correct validation here // using a warning here at least shows the correct // binder.addModelAfterGetValidator( m_stateNameValidator ); } // final UniqueStateNameValidator uniqueStateNameValidator = new UniqueStateNameValidator( existingStates, ignoreName ); // binder.addTargetAfterGetValidator( uniqueStateNameValidator ); // binder.addTargetBeforeSetValidator( uniqueStateNameValidator ); // // // FIXME: does not work correctly: if file is changed on file page, we will not get a correct validation here // // using a warning here at least shows the correct // binder.addModelAfterGetValidator( new UniqueStateNameValidator( existingStates, IStatus.WARNING, ignoreName ) ); m_binding.bindValue(binder); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.state.StateViewer.java
License:Open Source License
private void createCommentControls(final Composite parent) { final Label label = new Label(parent, SWT.NONE); label.setText(Messages.getString("StateViewer.3")); //$NON-NLS-1$ label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); final Text field = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); field.setTextLimit(State.COMMENT_LIMIT); field.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); field.setMessage(Messages.getString("StateViewer.4")); //$NON-NLS-1$ field.setEditable(m_editable);/*from ww w . ja v a 2s . c om*/ final IObservableValue target = SWTObservables.observeText(field, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_state, State.PROPERTY_DESCRIPTION); m_binding.bindValue(target, model); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.state.StateViewer.java
License:Open Source License
private void createSourceControls(final Composite parent) { new Label(parent, SWT.NONE).setText(Messages.getString("StateViewer.5")); //$NON-NLS-1$ final Text field = new Text(parent, SWT.BORDER | SWT.READ_ONLY); field.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); field.setEditable(m_editable);//w ww . j av a 2 s. c om final IObservableValue target = SWTObservables.observeText(field, SWT.Modify); final IObservableValue model = BeansObservables.observeValue(m_state, State.PROPERTY_SOURCE); m_binding.bindValue(target, model); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.waterbody.imports.ImportWaterbodiesSelectAttributesPage.java
License:Open Source License
private void createDescriptionControl(final Composite parent, final IDataBinding binding) { final ImportAttributeInfo<String> info = createAttributeControl( Messages.getString("ImportWaterbodiesSelectAttributesPage.3"), WaterBody.PROPERTY_DESCRIPTION, //$NON-NLS-1$ parent, true);//from ww w. j a v a 2s . c o m final Text text = new Text(parent, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setMessage(Messages.getString("ImportWaterbodiesSelectAttributesPage.4")); //$NON-NLS-1$ final ISWTObservableValue targetValue = SWTObservables.observeText(text, SWT.Modify); final ISWTObservableValue targetEnablement = SWTObservables.observeEnabled(text); final IObservableValue modelValue = BeansObservables.observeValue(info, ImportAttributeInfo.PROPERTY_DEFAULT_VALUE); final IObservableValue modelEnablement = BeansObservables.observeValue(info, ImportAttributeInfo.PROPERTY_ENABLEMENT); binding.bindValue(targetValue, modelValue); binding.bindValue(targetEnablement, modelEnablement); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.waterbody.imports.ImportWaterlevelsSelectAttributesPage.java
License:Open Source License
private void createDischargeControl(final Composite parent, final IDataBinding binding) { final ImportAttributeInfo<BigDecimal> info = createAttributeControl(WaterlevelFixationStrings.DISCHARGE, WaterlevelFixation.PROPERTY_DISCHARGE, parent, true); final Text text = new Text(parent, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setMessage(Messages.getString("ImportWaterlevelsSelectAttributesPage.1")); //$NON-NLS-1$ final ISWTObservableValue targetValue = SWTObservables.observeText(text, SWT.Modify); final IObservableValue modelValue = BeanProperties .value(ImportAttributeInfo.PROPERTY_DEFAULT_VALUE, BigDecimal.class).observe(info); final DataBinder binder = new DataBinder(targetValue, modelValue); binding.bindValue(binder);//from w w w . j a va2 s. c o m final ISWTObservableValue targetEnablement = SWTObservables.observeEnabled(text); final IObservableValue modelEnablement = BeansObservables.observeValue(info, ImportAttributeInfo.PROPERTY_ENABLEMENT); binding.bindValue(targetEnablement, modelEnablement); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.admin.waterbody.imports.ImportWaterlevelsSelectAttributesPage.java
License:Open Source License
private void createDescriptionControl(final Composite parent, final IDataBinding binding) { final ImportAttributeInfo<String> info = createAttributeControl(WaterlevelFixationStrings.DESCRIPTION, WaterlevelFixation.PROPERTY_DESCRIPTION, parent, true); final Text text = new Text(parent, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setMessage(Messages.getString("ImportWaterlevelsSelectAttributesPage.3")); //$NON-NLS-1$ final ISWTObservableValue targetValue = SWTObservables.observeText(text, SWT.Modify); final ISWTObservableValue targetEnablement = SWTObservables.observeEnabled(text); final IObservableValue modelValue = BeansObservables.observeValue(info, ImportAttributeInfo.PROPERTY_DEFAULT_VALUE); final IObservableValue modelEnablement = BeansObservables.observeValue(info, ImportAttributeInfo.PROPERTY_ENABLEMENT); binding.bindValue(targetValue, modelValue); binding.bindValue(targetEnablement, modelEnablement); }