Cai*_*der 2 data-binding jface eclipse-rcp
模型类有一个属性可见,它的字符串可以有两个值"1"表示是,"0"表示不,我怎么能将它绑定到一个复选框?
我建议使用JFace数据绑定框架:请参阅Vogella的教程.
JFace Data Binding是一个连接对象属性的框架.
例如,您将"Person"对象的属性"firstName"绑定到UI中的文本字段.此绑定将同步模型和UI中的更改,例如,如果用户更改UI中的名称,模型将自动更新

附:
public class Person implements PropertyChangeListener {
[...]
private String gender;
Run Code Online (Sandbox Code Playgroud)
和:
DataBindingContext ctx = new DataBindingContext();
widgetValue = WidgetProperties.selection().observe(marriedButton);
modelValue = BeanProperties.value(Person.class, "married").observe(person);
ctx.bindValue(widgetValue, modelValue);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2199 次 |
| 最近记录: |