总结了一下jface databinding的模型
Jface databinding 中支持两类模型,javaBean 和 pojo :
PJO是一般的java Object,没有反应和反应 notification,JAVABEAN则需要支持和反应notification
下面是模型和控件的绑定关系表
Factory | Description |
---|---|
PojoProperties
| Used to create IObservableValues for Java objects.
|
BeanProperties
| Used to create IObservableValue objects for Java Beans.
|
WidgetProperties
| Used to create IObservableValues for properties of SWT widgets.
|
代码如下:
IObservableValue target = WidgetProperties.text(SWT.Modify).observe(firstNameText);
IObservable model = PojoProperties.value(Person.class, "address.country").observe(person);
IObservableValue myModel = BeansProperties.value("firstName").observe(person)