return Boolean.toString(node.getUITree().isExpanded());
}
protected void doDecode(FacesContext context, UIComponent component) {
UITreeNode node = (UITreeNode) component;
UITree tree = node.getUITree();
TreeRowKey key = (TreeRowKey) tree.getRowKey();
Map requestMap = context.getExternalContext().getRequestParameterMap();
String id = node.getClientId(context);
TreeState componentState = (TreeState) tree.getComponentState();
String nodeExpandedId = id + NODE_EXPANDED_INPUT_SUFFIX;
Object nodeExpandedValue = requestMap.get(nodeExpandedId);
if (nodeExpandedValue != null) {
boolean nodeExpanded = Boolean.valueOf(nodeExpandedValue.toString()).booleanValue();
if (tree.isExpanded() ^ nodeExpanded) {
if (nodeExpanded) {
new ExpandNodeCommandEvent(tree, key).queue();
} else {
new CollapseNodeCommandEvent(tree, key).queue();
}
if (Boolean.valueOf((String) requestMap.get(id + AJAX_EXPANDED_SUFFIX)).booleanValue()) {
new AjaxExpandedEvent(node).queue();
new AjaxExpandedEvent(tree).queue();
} else {
new NodeExpandedEvent(node).queue();
new NodeExpandedEvent(tree).queue();
}
}
}
if (id.equals(tree.getAttributes()
.get(UITree.SELECTION_INPUT_ATTRIBUTE))) {
if (!componentState.isSelected(key)) {
if (tree.getAttributes().get(
UITree.SELECTED_NODE_PARAMETER_NAME) == null) {
new NodeSelectedEvent(tree, componentState.getSelectedNode()).queue();
new NodeSelectedEvent(node, componentState.getSelectedNode()).queue();
} else {
new AjaxSelectedEvent(tree, componentState.getSelectedNode()).queue();
new AjaxSelectedEvent(node, componentState.getSelectedNode()).queue();
}
}
tree.getAttributes().remove(UITree.SELECTION_INPUT_ATTRIBUTE);
}
super.doDecode(context, component);
}