*
* <p>
* If this property is true, writing null-representation string to text
- * field allways sets the field value to real null. If this property is
+ * field always sets the field value to real null. If this property is
* false, null setting is not made, but the null values are maintained.
* Maintenance of null-values is made by only converting the textfield
* contents to real null, if the text field matches the null-string
* By default this setting is false
* </p>
*
- * @return boolean Should the null-string represenation be allways converted
+ * @return boolean Should the null-string represenation be always converted
* to null-values.
* @see TextField#getNullRepresentation()
*/
*
* <p>
* If this property is true, writing null-representation string to text
- * field allways sets the field value to real null. If this property is
+ * field always sets the field value to real null. If this property is
* false, null setting is not made, but the null values are maintained.
* Maintenance of null-values is made by only converting the textfield
* contents to real null, if the text field matches the null-string
* </p>
*
* @param nullSettingAllowed
- * Should the null-string represenation be allways converted to
+ * Should the null-string represenation be always converted to
* null-values.
* @see TextField#getNullRepresentation()
*/
import com.itmill.toolkit.terminal.gwt.client.MouseEventDetails;
/**
- * MenuTree component. MenuTree can be used to select an item (or multiple
- * items) from a hierarchical set of items.
+ * Tree component. A Tree can be used to select an item (or multiple items) from
+ * a hierarchical set of items.
*
* @author IT Mill Ltd.
* @version
/**
* List of action handlers.
*/
- private LinkedList actionHandlers = null;
+ private LinkedList<Action.Handler> actionHandlers = null;
/**
* Action mapper.
final Action action = (Action) actionMapper.get(st.nextToken());
if (action != null && containsId(itemId)
&& actionHandlers != null) {
- for (final Iterator i = actionHandlers.iterator(); i
- .hasNext();) {
- ((Action.Handler) i.next()).handleAction(action, this,
- itemId);
+ for (final Iterator<Action.Handler> i = actionHandlers
+ .iterator(); i.hasNext();) {
+ i.next().handleAction(action, this, itemId);
}
}
}
}
// Initialize variables
- final Set actionSet = new LinkedHashSet();
+ final Set<Action> actionSet = new LinkedHashSet<Action>();
String[] selectedKeys;
if (isMultiSelect()) {
selectedKeys = new String[((Set) getValue()).size()];
final LinkedList expandedKeys = new LinkedList();
// Iterates through hierarchical tree using a stack of iterators
- final Stack iteratorStack = new Stack();
+ final Stack<Iterator> iteratorStack = new Stack<Iterator>();
Collection ids;
if (partialUpdate) {
ids = getChildren(expandedItemId);
while (!iteratorStack.isEmpty()) {
// Gets the iterator for current tree level
- final Iterator i = (Iterator) iteratorStack.peek();
+ final Iterator i = iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {
// Actions
if (actionHandlers != null) {
- final ArrayList keys = new ArrayList();
- for (final Iterator ahi = actionHandlers.iterator(); ahi
- .hasNext();) {
- final Action[] aa = ((Action.Handler) ahi.next())
- .getActions(itemId, this);
+ final ArrayList<String> keys = new ArrayList<String>();
+ final Iterator<Action.Handler> ahi = actionHandlers
+ .iterator();
+ while (ahi.hasNext()) {
+ final Action[] aa = ahi.next().getActions(itemId, this);
if (aa != null) {
for (int ai = 0; ai < aa.length; ai++) {
final String akey = actionMapper.key(aa[ai]);
if (!actionSet.isEmpty()) {
target.addVariable(this, "action", "");
target.startTag("actions");
- for (final Iterator i = actionSet.iterator(); i.hasNext();) {
- final Action a = (Action) i.next();
+ final Iterator<Action> i = actionSet.iterator();
+ while (i.hasNext()) {
+ final Action a = i.next();
target.startTag("action");
if (a.getCaption() != null) {
target.addAttribute("caption", a.getCaption());
}
if (partialUpdate) {
+ // update tree-level selection information in case some selected
+ // node(s) were collapsed
+ target.addVariable(this, "selected", selectedKeys);
+
partialUpdate = false;
} else {
// Selected
if (actionHandler != null) {
if (actionHandlers == null) {
- actionHandlers = new LinkedList();
+ actionHandlers = new LinkedList<Action.Handler>();
actionMapper = new KeyMapper();
}
final LinkedList visible = new LinkedList();
// Iterates trough hierarchical tree using a stack of iterators
- final Stack iteratorStack = new Stack();
+ final Stack<Iterator> iteratorStack = new Stack<Iterator>();
final Collection ids = rootItemIds();
if (ids != null) {
iteratorStack.push(ids.iterator());
while (!iteratorStack.isEmpty()) {
// Gets the iterator for current tree level
- final Iterator i = (Iterator) iteratorStack.peek();
+ final Iterator i = iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {