List of usage examples for org.eclipse.jface.internal.databinding.swt ComboTextProperty ComboTextProperty
public ComboTextProperty()
From source file:com.iks.hto.karteikastensystem.simple.rcp.databinding.FormBuilder.java
License:Open Source License
/** * Build a two column form with the elements added * /*from w w w.j a v a2s . c o m*/ * @param dbc * the databinding context * @param parent * the parent the form is created on * @param object * the object to bind * @param nachSeite * @return the form container */ public Composite build(DataBindingContext dbc, Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout(2, false)); IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); IWidgetValueProperty comboProp = new ComboTextProperty(); for (Entry e : entries) { Label l = new Label(container, SWT.NONE); l.setText(e.label); IObservableValue uiObs = null; if (e.type.equals(TEXT_TYPE)) { Text t = new Text(container, SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); uiObs = textProp.observeDelayed(400, t); } else if (e.type.equals(COMBO_TYPE)) { Combo cb = new Combo(container, SWT.DROP_DOWN); cb.setItems(e.options); cb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); uiObs = comboProp.observeDelayed(400, cb); } else if (e.type.equals(ONLY_LABEL_TYPE)) { Label dummy = new Label(container, SWT.NONE); dummy.setText(""); } IObservableValue mObs; if (e.bindTo != null) { if (e.bindTo instanceof IObservableValue) { mObs = e.property.observeDetail((IObservableValue) e.bindTo); } else { mObs = e.property.observe(e.bindTo); } // TODO: Hier findet das Binding statt!!! Inkl. Update-strategie // und // Validation dbc.bindValue(uiObs, mObs, new EMFUpdateValueStrategy().setBeforeSetValidator(new EmptyStringValidator(e.nullMessage)), null); } } return container; }