Examples of TreeState


Examples of org.richfaces.component.state.TreeState

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


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

Examples of org.richfaces.component.state.TreeState

    }
  }

  public String encodeSelectionStateInput(FacesContext context, UITree tree) throws IOException {
    String result = "";
    TreeState treeState = (TreeState) tree.getComponentState();
    TreeRowKey selectedNodeKey = treeState.getSelectedNode();
    if (selectedNodeKey != null) {
      Object rowKey = tree.getRowKey();
      try {
        tree.setRowKey(selectedNodeKey);
        if (tree.isRowAvailable()) {
View Full Code Here

Examples of org.richfaces.component.state.TreeState

    // 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

Examples of org.richfaces.component.state.TreeState

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

Examples of org.richfaces.component.state.TreeState

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

Examples of org.richfaces.component.state.TreeState

  public Object getParentRowKey(Object rowKey) {
    return ((AbstractTreeDataModel) getExtendedDataModel()).getParentRowKey(rowKey);
  }

  public void transferQueuedNode() {
    TreeState treeState = (TreeState) getComponentState();
    treeState.transferQueuedNodes((TreeRowKey) getRowKey());
  }
View Full Code Here

Examples of org.richfaces.component.state.TreeState

      isLastElement = false;
      navigator.resetLastElement();
    }

    public void processAdvisors(FacesContext context, TreeRowKey rowKey) throws IOException {
      TreeState state = (TreeState) tree.getComponentState();
      TreeStateAdvisor stateAdvisor = (TreeStateAdvisor)tree.getStateAdvisor();

      if (null == stateAdvisor) {
        if (null == methodBindingAdvisor) {
          methodBindingAdvisor = new TreeStateAdvisor() {
            public Boolean adviseNodeOpened(UITree tree) {
              MethodBinding adviseNodeOpened = tree.getAdviseNodeOpened();
              if (null != adviseNodeOpened) {
                return (Boolean) adviseNodeOpened.invoke(FacesContext.getCurrentInstance(), new Object[] {tree});
              }
              return null;
            }

            public Boolean adviseNodeSelected(UITree tree) {
              MethodBinding adviseNodeSelected = tree.getAdviseNodeSelected();
              if (null != adviseNodeSelected) {
                return (Boolean) adviseNodeSelected.invoke(FacesContext.getCurrentInstance(), new Object [] {tree});
              }
              return null;
            }
          };
        }
        stateAdvisor = methodBindingAdvisor;
      }

      Boolean adviseOpened = stateAdvisor.adviseNodeOpened(tree);
      if (null != adviseOpened) {
        if (adviseOpened.booleanValue()) {
          state.makeExpanded(rowKey);
        } else {
          state.makeCollapsed(rowKey);
        }
      }
     
      Boolean adviseSelected = stateAdvisor.adviseNodeSelected(tree);
      if (null != adviseSelected) {
        if (adviseSelected.booleanValue()) {
          if (!state.isSelected(rowKey)) {
            state.setSelected(rowKey);
          }
        }
        else {
          if (state.isSelected(rowKey)) {
            state.setSelected(null);
          }
        }
      }
    }
View Full Code Here

Examples of org.richfaces.component.state.TreeState

  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

Examples of org.richfaces.component.state.TreeState

    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

Examples of org.richfaces.component.state.TreeState

    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);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.