JFace ComboViewer에 인덱싱 된 속성을 바인딩하고 싶습니다. 간단한 속성에 대한 코드를 결합인덱스 된 속성을 jface 뷰어에 바인딩하는 방법
class DataModel {
private String[] props = {"A","B","C"};
private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
public String getProperties(int idx){
return props[idx];
}
public void setProperties(int idx, String value){
String oldVal = props[idx];
props[idx] = value;
pcs.fireIndexedPropertyChange("properties", idx, oldVal, value);
}
// code to add/remove PropertyChangeListener
// ...
}
데이터 같을 것이다 :
내가 이런 DataModel이 클래스가 말할 수 있습니다
DataModel dataModel = ...
ComboViewer propertyChoice = ...
DataBindingContext ctx = new DataBindingContext();
IObservableValue target = ViewerProperties.singleSelection().observe(propertyChoice);
IObservableValue model = BeanProperties.value(DataModel.class, "properties").observe(dataModel);
ctx.bindValue(target, model);
하지만 난 통보해야 인덱스 속성
index가 바인딩하려는 값인 ctx. 시도했습니다IObservableValue model = BeanProperties.value(DataModel.class, "properties[0]").observe(dataModel);
그러나 작동하지 않습니다.
단순 속성 대신 인덱싱 된 속성을 바인딩 할 수 있습니까? 방법?