Package org.richfaces.component.state

Examples of org.richfaces.component.state.TreeState


    UITreeNode node = (UITreeNode) component;
    UITree tree = node.getUITree();
    TreeRowKey<?> key = (TreeRowKey<?>) tree.getRowKey();
    Map<String, String> 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);
    }
View Full Code Here


  public void resetDataModel() {
    this.allowCachedModel = false;
   
    super.resetDataModel();

    TreeState state = (TreeState) getComponentState();
    // re-set stopInCollapsed to handle AJAX switch type change
    state.setStopInCollapsed(isStopInCollapsed());
  }
View Full Code Here

    try {
      super.processDecodes(faces, null);

      if (null != getAttributes().get(SELECTION_INPUT_ATTRIBUTE)) {
        TreeState state = (TreeState) getComponentState();

        if (!state.isSelected(null)) {
          new NodeSelectedEvent(this, state.getSelectedNode()).queue();
        }
      }

    } finally {
      getAttributes().remove(SELECTION_INPUT_ATTRIBUTE);
View Full Code Here

   * Returns whether current node is expanded
   *
   * @return <code>true</code> if node is expanded else <code>false</code>
   */
  public boolean isExpanded() {
    TreeState treeState = (TreeState) getComponentState();
    return treeState.isExpanded((TreeRowKey) this.getRowKey());
  }
View Full Code Here

   * Returns whether current node is selected
   *
   * @return <code>true</code> if node is selected else <code>false</code>
   */
  public boolean isSelected() {
    TreeState treeState = (TreeState) getComponentState();
    return treeState.isSelected((TreeRowKey) this.getRowKey());
  }
View Full Code Here

  /**
   * Sets current node as selected
   */
  public void setSelected() {
    TreeState treeState = (TreeState) getComponentState();
    treeState.setSelected((TreeRowKey) this.getRowKey());
  }
View Full Code Here

    return getFacets().values().iterator();
  }


  protected DataComponentState createComponentState() {
    return new TreeState(isStopInCollapsed());
  }
View Full Code Here

    // Check for node were choosed
    TreeRowKey rowKey = (TreeRowKey) getRowKey();
    if (rowKey == null) {
      return null;
    }
    TreeState state = (TreeState) getComponentState();
    return state.getSubState(rowKey);
  }
View Full Code Here

    if (rowKey == null) {
      return;
    }
   
    if (state instanceof TreeState) {
          TreeState currentState = (TreeState) getComponentState();
          currentState.mergeSubState(rowKey, (TreeState) state);
    }
  }
View Full Code Here

    TreeRowKey rowKey = (TreeRowKey) getRowKey();
    if (rowKey == null) {
      return;
    }
   
    TreeState state = (TreeState) getComponentState();
    state.clearSubState(rowKey);
  }
View Full Code Here

TOP

Related Classes of org.richfaces.component.state.TreeState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.