Set focus in the element with empty name
FEA: ItEr76S13WBSSettingUpBehavior
This commit is contained in:
parent
930bb705ea
commit
65aa8f3a8e
3 changed files with 25 additions and 0 deletions
|
|
@ -377,6 +377,7 @@ public class OrderElementTreeController extends TreeController<OrderElement> {
|
|||
}
|
||||
textBox.setConstraint("no empty:" + _("cannot be empty"));
|
||||
addCell(cssClass, textBox);
|
||||
putNameTextbox(orderElementForThisRow, textBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public class TemplatesTreeController extends
|
|||
});
|
||||
|
||||
addCell(textBox);
|
||||
putNameTextbox(element, textBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -224,10 +224,18 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
|
|||
hours.setValue(0);
|
||||
}
|
||||
|
||||
Textbox nameTextbox = null;
|
||||
|
||||
// Parse hours
|
||||
try {
|
||||
if (tree.getSelectedCount() == 1) {
|
||||
T node = getSelectedNode();
|
||||
|
||||
if (!node.isEmptyLeaf()) {
|
||||
// Then a new container will be created
|
||||
nameTextbox = getRenderer().getNameTextbox(node);
|
||||
}
|
||||
|
||||
T newNode = getModel().addElementAt(node, name.getValue(),
|
||||
hours.getValue());
|
||||
getRenderer().refreshHoursValueForThisNodeAndParents(newNode);
|
||||
|
|
@ -239,9 +247,14 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
|
|||
LOG.warn("exception ocurred adding element", e);
|
||||
messagesForUser.showMessage(Level.ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
name.setValue("");
|
||||
hours.setValue(0);
|
||||
name.focus();
|
||||
|
||||
if (nameTextbox != null) {
|
||||
nameTextbox.focus();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void filterByPredicateIfAny();
|
||||
|
|
@ -560,6 +573,8 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
|
|||
|
||||
}
|
||||
|
||||
private Map<T, Textbox> nameTextboxByElement = new HashMap<T, Textbox>();
|
||||
|
||||
private Map<T, Intbox> hoursIntBoxByElement = new HashMap<T, Intbox>();
|
||||
|
||||
private KeyboardNavigationHandler navigationHandler = new KeyboardNavigationHandler();
|
||||
|
|
@ -573,6 +588,14 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
|
|||
public Renderer() {
|
||||
}
|
||||
|
||||
protected Textbox getNameTextbox(T key) {
|
||||
return nameTextboxByElement.get(key);
|
||||
}
|
||||
|
||||
protected void putNameTextbox(T key, Textbox textbox) {
|
||||
nameTextboxByElement.put(key, textbox);
|
||||
}
|
||||
|
||||
protected void registerFocusEvent(final InputElement inputElement) {
|
||||
inputElement.addEventListener(Events.ON_FOCUS,
|
||||
new EventListener() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue