Package org.richfaces.model

Examples of org.richfaces.model.TreeRowKey


    subTreeState._transient = _transient;
   
    int subKeyDepth = rowKey.depth() - 1;

    for (Iterator<TreeRowKey> iter = this.expandedNodes.iterator(); iter.hasNext(); ) {
      TreeRowKey nextKey = iter.next();
      if (nextKey != null && rowKey.isSubKey(nextKey)) {
        subTreeState.expandedNodes.add(nextKey.getSubKey(subKeyDepth));
      }
    }
   
    for (Iterator<Entry<TreeRowKey, NodeState>> iter = this.queuedNodeStates.entrySet().iterator();
      iter.hasNext(); ) {
   
      Entry<TreeRowKey, NodeState> entry = iter.next();

      TreeRowKey nextKey = entry.getKey();
     
      if (nextKey != null && rowKey.isSubKey(nextKey)) {
        subTreeState.queuedNodeStates.put(nextKey.getSubKey(subKeyDepth),
          entry.getValue());
      }
    }
   
    return subTreeState;
View Full Code Here


      this.expandedNodes.clear();
      this.queuedNodeStates = new HashMap<TreeRowKey, NodeState>();
    } else {
      // collect nodes to clean up
      for (Iterator<TreeRowKey> itr = this.expandedNodes.iterator(); itr.hasNext(); ) {
        TreeRowKey nextKey = itr.next();
        if (nextKey != null && rowKey.isSubKey(nextKey)) {
          itr.remove();
        }
      }
     
      for (Iterator<Entry<TreeRowKey, NodeState>> itr =
        this.queuedNodeStates.entrySet().iterator(); itr.hasNext(); ) {

        TreeRowKey nextKey = itr.next().getKey();
        if (nextKey != null && rowKey.isSubKey(nextKey)) {
          itr.remove();
        }
      }
    }
View Full Code Here

  }
 
  public void mergeSubState(TreeRowKey rowKey, TreeState subState) {
    Iterator<TreeRowKey> iter = subState.expandedNodes.iterator();
    while (iter != null && iter.hasNext()) {
      TreeRowKey key = iter.next().getSubKey(1);
      if (key.depth() > 0) {
          expandedNodes.add(new ListRowKey((ListRowKey)rowKey, (ListRowKey)key));
      } else if (!expandedNodes.contains(rowKey)) {
          expandedNodes.add(rowKey);
      }
    }

    Iterator<Entry<TreeRowKey, NodeState>> sItr = subState.queuedNodeStates.entrySet().iterator();
    while (sItr.hasNext()) {
      Entry<TreeRowKey, NodeState> entry = sItr.next();
      TreeRowKey key = entry.getKey().getSubKey(1);
     
      TreeRowKey newKey;
     
      if (key.depth() > 0) {
        newKey = new ListRowKey((ListRowKey)rowKey, (ListRowKey)key);
      } else {
        newKey = rowKey;
View Full Code Here

  protected void doDecode(FacesContext context, UIComponent component) {
    super.doDecode(context, 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;
View Full Code Here

    public void process(FacesContext context, Object rowKey, Object argument)
    throws IOException {
      tree.setRowKey(context, rowKey);
      if (tree.isRowAvailable()) {
        TreeRowKey nextKey = (TreeRowKey) rowKey;

        if (!tree.isLeaf() && nextKey != null) {
          if (key == null || nextKey.isSubKey(key)
              || nextKey.equals(key)) {
            if (tree.isImmediate()) {
              queuedExpandedNodes.add(nextKey);
            } else {
              expandedNodes.add(nextKey);
            }
View Full Code Here

          }

          Iterator<RowKeyHolder> ajaxKeysItr = holders.iterator();
          while (ajaxKeysItr.hasNext()) {
            RowKeyHolder keyHolder = ajaxKeysItr.next();
            TreeRowKey key = keyHolder.getRowKey();

            if (key != null && key.depth() == 0) {
              key = null;
            }

            tree.setRowKey(context, key);
View Full Code Here

  }

  protected String getSelectionValue(FacesContext context, UITree tree) {
    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

    // simple flag can be used here because
    // we cannot jump more than one level down until next node
    // when rendering
    Flag droppedDownToLevelFlag = new Flag();

    TreeRowKey rowKey = (TreeRowKey) key;

    //Object savedRowKey = input.getRowKey();
    try {
      input.captureOrigValue();
View Full Code Here

      if (!context.isExpanded() || !context.isHasChildren()) {
        getUtils().writeAttribute(writer, "style", "display: none;");
      } else {
        if (tree.isShowConnectingLines()) {
          TreeRowKey floatingKey = getFloatingKey();
          //need the expression only for AJAX update root
          if (floatingKey != null && floatingKey.equals(context.getRowKey())) {
            String expression = "background-image:expression(this.nextSibling ? '' : 'none')";
            getUtils().writeAttribute(writer, "style", expression);
          }
        }
      }
View Full Code Here

 
  public void dropListener(DropEvent dropEvent) {
    // resolve drag source attributes
    UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
    UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
    TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
    TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;

    // resolve drag destination attributes
    UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
    UITree destTree = destNode != null ? destNode.getUITree() : null;
    TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
    TreeNode droppedInNode = dropNodeKey != null ? destTree.getTreeNode(dropNodeKey) : null;
   
    // Note: check if we dropped node on to itself or to item instead of folder here
    if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
        System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
View Full Code Here

TOP

Related Classes of org.richfaces.model.TreeRowKey

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.