public ConfigurationFormToolkit ( final FormToolkit providedToolkit ) { this.toolkit = providedToolkit; this.toolkitCreated = false; this.dbc = new DataBindingContext (); }
public ConfigurationFormToolkit ( final FormToolkit providedToolkit ) { this.toolkit = providedToolkit; this.toolkitCreated = false; this.dbc = new DataBindingContext (); }
ctx = new DataBindingContext(); ISWTObservableValue observe = WidgetProperties.selection().observe(myCheckBox); ISWTObservableValue observe2 = WidgetProperties.enabled().observe(myTextField); ctx.bindValue(observe, observe2)
public ConfigurationFormToolkit ( final Display display ) { this.toolkit = new FormToolkit ( display ); this.toolkitCreated = true; this.dbc = new DataBindingContext (); }
public ConfigurationFormToolkit ( final Display display ) { this.toolkit = new FormToolkit ( display ); this.toolkitCreated = true; this.dbc = new DataBindingContext (); }
DataBindingContext bindingContext = new DataBindingContext(); IObservableValue yourTextObserveTextObserveWidget = SWTObservables.observeText(yourText, SWT.Modify); IObservableValue yourModelTemplateObserveValue = BeansObservables.observeValue(yourModel, "yourInt"); bindingContext.bindValue(yourTextObserveWidget, yourModelTemplateObserveValue, null, null);
/* with portText being your SWT text control */ IObservableValue textObservable = WidgetProperties.text().observe(portText); UpdateValueStrategy strategy = new UpdateValueStrategy(); strategy.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object value) { Integer portNumber = null; try { portNumber = Integer.valueOf((String) value); } catch (NumberFormatException e) { return error(e.getMessage() + " is not a number"); } if (portNumber < 0 || portNumber > 65535) { return error("Number is out of range"); } return ok(); } }); /* with text being the port value in your model */ Binding binding = new DataBindingContext().bindValue( textObservable, PojoProperties.value(Model.class, "text").observe(this.model), strategy, null); ControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
FileModel model; new DataBindingContext().bindValue(SWTObservables.observeText(text, SWT.Modify), BeansObservables.observeValue(model, "fileSummary"), new UpdateValueStrategy(), new UpdateValueStrategy());
private Composite createComposite ( final Composite wrapper ) { this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) ); wrapper.addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { CallbackDialog.this.dbc.dispose (); } } ); final Composite composite = new Composite ( wrapper, SWT.NONE ); composite.setLayout ( new GridLayout ( 2, false ) ); for ( final CallbackWidgetFactory factory : this.factories ) { factory.createGridWidgets ( this.dbc, composite ); } return composite; }
private Composite createComposite ( final Composite wrapper ) { this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) ); wrapper.addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { CallbackDialog.this.dbc.dispose (); } } ); final Composite composite = new Composite ( wrapper, SWT.NONE ); composite.setLayout ( new GridLayout ( 2, false ) ); for ( final CallbackWidgetFactory factory : this.factories ) { factory.createGridWidgets ( this.dbc, composite ); } return composite; }
private State getState( SwtMetawidget metawidget ) { State state = (State) metawidget.getData( DataBindingProcessor.class.getName() ); if ( state == null ) { state = new State(); state.bindingContext = new DataBindingContext( getRealm( metawidget.getDisplay() ) ); metawidget.setData( DataBindingProcessor.class.getName(), state ); } return state; }
MyModel model = new MyModel(); bindCombo(new DataBindingContext(), model, "longs", new UpdateValueStrategy(), new UpdateValueStrategy());
toModelStrategy.setConverter(intToViewTypeConverter); DataBindingContext context = new DataBindingContext(); context.bindValue(comboObservable, viewTypeObservable, toModelStrategy, toTargetStrategy);
private void bindValues() { final DataBindingContext ctx = new DataBindingContext(); { rValue = new WritableValue(); bindValue(ctx, rootName, ClasspathEntryInfo.class, ClasspathEntryInfo.P_SYMBOLIC_NAME, rValue); bindValue(ctx, rootFingerprint, ClasspathEntryInfo.class, ClasspathEntryInfo.P_FINGERPRINT, rValue); bindValue(ctx, rootVersion, ClasspathEntryInfo.class, ClasspathEntryInfo.P_VERSION, rValue); } { mValue = new WritableValue(); bindValue(ctx, modelCoordinate, ModelArchiveMetadata.class, ModelArchiveMetadata.P_COORDINATE, mValue); final IObservableValue widgetValue = ViewerProperties.singlePostSelection().observe(modelStatus); final IObservableValue modelValue = BeanProperties.value(ModelArchiveMetadata.class, ModelArchiveMetadata.P_STATUS).observeDetail(mValue); ctx.bindValue(widgetValue, modelValue); } }
public Control createContents(Composite parent) { bindingContext = new DataBindingContext(); WizardPage wizardPage = getContainer(WizardPage.class); if (wizardPage != null) {