if (snapshotOfOpenedNodes != null) {
snapshotOfOpenedNodes.openIfRequired(item);
}
Treecell cellForName = new Treecell();
Textbox textboxName= new Textbox();
textboxName.setWidth("400px");
cellForName.appendChild(Util.bind(textboxName,
new Util.Getter<String>() {
@Override
public String get() {
return criterionForThisRow.getName();
}
}, new Util.Setter<String>() {
@Override
public void set(String value) {
criterionForThisRow.setName(value);
}
}));
String message = _("cannot be empty");
textboxName
.setConstraint("no empty:"+message);
Treecell cellForActive = new Treecell();
cellForActive.setStyle("center");
Checkbox checkboxActive = new Checkbox();
cellForActive.appendChild(Util.bind(checkboxActive,
new Util.Getter<Boolean>() {
@Override
public Boolean get() {
return criterionForThisRow.isActive();
}
}, new Util.Setter<Boolean>() {
@Override
public void set(Boolean value) {
criterionForThisRow.setActive(value);
}
}));
checkboxActive.addEventListener(Events.ON_CHECK,new EventListener() {
@Override
public void onEvent(Event event) {
getModel().updateEnabledCriterions(criterionForThisRow.isActive(),criterionForThisRow);
reloadTree();
}
});
Treerow tr = null;
/*
* Since only one treerow is allowed, if treerow is not null, append
* treecells to it. If treerow is null, contruct a new treerow and
* attach it to item.
*/
if (item.getTreerow() == null) {
tr = new Treerow();
tr.setParent(item);
} else {
tr = item.getTreerow();
tr.getChildren().clear();
}
// Attach treecells to treerow
tr.setDraggable("true");
tr.setDroppable("true");
// Treecell with the cost category of the Criterion
Treecell cellForCostCategory = new Treecell();
criterionForThisRow.getCriterion().getCostCategory();
cellForCostCategory.appendChild(appendAutocompleteType(item));
// Treecell with the code of the Criterion
Treecell cellForCode = new Treecell();
cellForCode.setStyle("center");
Textbox codeLabel = new Textbox();
codeLabel.setDisabled(codeEditionDisabled);
cellForCode.appendChild(Util.bind(codeLabel,
new Util.Getter<String>() {
@Override
public String get() {