我在TableView列中填充Employees pojo。
雇主包含rate属性,其中包含不在tableView中填充的doubleDomainObject。
comboBox的实现我没有显示,因为它很好地与CellFactory一起工作。希望专注于CellValueFactory。
public class DoubleDomainObject extends DomainObject {
private SimpleObjectProperty<Double> doubleValue =new SimpleObjectProperty(this, "doubleValue", null);
public Double getDoubleValue() {return doubleValue.get(); }
public SimpleObjectProperty<Double> doubleValueProperty() {return doubleValue;}
public void setDoubleValue(Double value) {this.doubleValue.set(value);}
}
public class ColumnDoubleComboBox extends ColumnWrapper{
protected TableColumn<DomainObject, DoubleDomainObject> column;
@SuppressWarnings("unchecked")
public ColumnDoubleComboBox(Bulder builder) {
super(builder);
this.column = new TableColumn<>(columnName);
setCellValueFactory();
setCellFactory();
}
public void setCellValueFactory(){
column.setCellValueFactory(new PropertyValueFactory<>(propertyName));
}
}
public class Employees extends DomainObject {
private SimpleObjectProperty<DoubleDomainObject> rate =new
SimpleObjectProperty<>(this, "rate", null);
public DoubleDomainObject getRate() {
return rate.get();
}
public SimpleObjectProperty<DoubleDomainObject> rateProperty() {
return rate;
}
public void setRate(RatePerHour rate) {
this.rate.set(rate);
}
}
tableViewWrapper = AppNode.NodeBuilder.create()
.<Employees>createTableViewWrapper()
.setDataMapper(this.dataMapperFabric.getEmployeesDataMapper())
.setColums(
columnFabric.createColumnDoubleComboBox(ColumnWrapper.Bulder.create()
.setColumnName("RATE").setColumnSize(0.2).setPropertyName("rate")
.............................etc
);