return ((CriterionDTO) listitem.getValue()).getCriterion()
.getCostCategory();
}
private Autocomplete appendAutocompleteType(final Treeitem row) {
final Autocomplete autocomplete = new Autocomplete();
autocomplete.setAutodrop(true);
autocomplete.applyProperties();
autocomplete.setFinder("CostCategoryFinder");
// Getter, show type selected
if (getCostCategory(row) != null) {
autocomplete.setSelectedItem(getCostCategory(row));
}
// Setter, set type selected to HourCost.type
autocomplete.addEventListener("onSelect", new EventListener() {
@Override
public void onEvent(Event event) {
final Comboitem comboitem = autocomplete.getSelectedItem();
if (comboitem != null) {
// Update resourcesCostCategoryAssignment
CriterionDTO assignment = (CriterionDTO) row
.getValue();
assignment.getCriterion().setCostCategory(
(CostCategory) comboitem
.getValue());
row.setValue(assignment);
}
}
});
autocomplete.addEventListener("onBlur", new EventListener() {
@Override
public void onEvent(Event event) {
if (autocomplete.getText().isEmpty()) {
autocomplete.clear();
CriterionDTO assignment = (CriterionDTO) row.getValue();
assignment.getCriterion().setCostCategory(null);
}
}
});