Fixed focus at textbox on created leaves with the ancestor hours

FEA: ItEr76S13WBSSettingUpBehavior
This commit is contained in:
Lorenzo Tilve Álvaro 2012-02-28 17:27:06 +01:00
parent 65aa8f3a8e
commit b1b1a3146b

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
* Copyright (C) 2010-2011 Igalia, S.L.
* Copyright (C) 2010-2012 Igalia, S.L.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@ -231,14 +231,14 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
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);
if (node.isLeaf() && !node.isEmptyLeaf()) {
// Then a new container will be created
nameTextbox = getRenderer().getNameTextbox(node);
}
} else {
getModel().addElement(name.getValue(), hours.getValue());
}
@ -250,10 +250,11 @@ public abstract class TreeController<T extends ITreeNode<T>> extends
name.setValue("");
hours.setValue(0);
name.focus();
if (nameTextbox != null) {
nameTextbox.focus();
} else {
name.focus();
}
}