rcp3.3中的数据绑定<快速参考例子>
?下面是一个测试例子,以后我理解了在补充完说明
class Test {
??public String name;
??public void setName(String name) {
???this.name = name;
??}
??public String getName() {
???return this.name;
??}
?}
?private void createUI() {??
??Text testText = new Text(container, SWT.BORDER);
??testText.addFocusListener(new FocusAdapter() {
???public void focusGained(FocusEvent e) {
????createUI();
???}
??});??
??
??Test bean = new Test();
??bean.name = "123";
??DataBindingContext dataBindingContext = new DataBindingContext();
??IObservableValue targetObservableValue = SWTObservables.observeText(testText, SWT.Modify);
??IObservableValue modelObservableValue = BeansObservables.observeValue(bean, "name");
??UpdateValueStrategy targetToModel = new UpdateValueStrategy();
??UpdateValueStrategy modelToTarget = new UpdateValueStrategy();
??dataBindingContext.bindValue(targetObservableValue, modelObservableValue, targetToModel, modelToTarget);
?}
?