コード例 #1
0
 /* (non-Javadoc)
  * @see mat.client.clause.clauseworkspace.presenter.XmlTreeDisplay#expandSelected(com.google.gwt.user.cellview.client.TreeNode)
  */
 @Override
 public void expandSelected(TreeNode treeNode) {
   if (treeNode != null) {
     for (int i = 0; i < treeNode.getChildCount(); i++) {
       TreeNode subTree = null;
       if (treeNode
           .getChildValue(i)
           .equals(
               selectedNode)) { // this check is performed since IE was giving JavaScriptError
                                // after removing a node and closing all nodes.
         // to avoid that we are closing the parent of the removed node.
         subTree = treeNode.setChildOpen(i, true, true);
         if ((subTree != null) && (subTree.getChildCount() > 0)) {
           openAllNodes(subTree);
         }
         break;
       }
       subTree =
           treeNode.setChildOpen(
               i,
               ((CellTreeNode) treeNode.getChildValue(i)).isOpen(),
               ((CellTreeNode) treeNode.getChildValue(i)).isOpen());
       if ((subTree != null) && (subTree.getChildCount() > 0)) {
         expandSelected(subTree);
       }
     }
   }
 }
コード例 #2
0
 /**
  * This method is called after adding a child node to the parent. After adding a child node, close
  * the Parent node and open. Remaining all nodes will be opened or closed based on the isOpen
  * boolean in CellTreeNode
  *
  * @param treeNode the tree node
  */
 private void closeSelectedOpenNodes(TreeNode treeNode) {
   if (treeNode != null) {
     for (int i = 0; i < treeNode.getChildCount(); i++) {
       TreeNode subTree = null;
       if (treeNode.getChildValue(i).equals(selectedNode)) { // this check is performed since IE
         // was giving JavaScriptError after removing a node and closing all nodes.
         // to avoid that we are closing the parent of the removed node.
         subTree = treeNode.setChildOpen(i, false, false);
       }
       subTree = treeNode.setChildOpen(i, ((CellTreeNode) treeNode.getChildValue(i)).isOpen());
       if ((subTree != null) && (subTree.getChildCount() > 0)) {
         closeSelectedOpenNodes(subTree);
       }
     }
   }
 }
コード例 #3
0
  /* (non-Javadoc)
   * @see mat.client.clause.clauseworkspace.presenter.XmlTreeDisplay#validateCellTreeNodes(com.google.gwt.user.cellview.client.TreeNode)
   */
  @Override
  public boolean validateCellTreeNodes(TreeNode treeNode) {

    if (treeNode != null) {
      openAllNodes(treeNode);
      for (int i = 0; i < treeNode.getChildCount(); i++) {
        TreeNode subTree = null;
        CellTreeNode node = (CellTreeNode) treeNode.getChildValue(i);
        if ((node.getNodeType() == CellTreeNode.TIMING_NODE)
            || (node.getNodeType() == CellTreeNode.RELATIONSHIP_NODE)) {
          // this check is performed since IE was giving JavaScriptError after removing a node and
          // closing all nodes.
          subTree = treeNode.setChildOpen(i, true, true);
          if ((subTree != null) && (subTree.getChildCount() == 2)) {
            if (!node.getValidNode()) {
              editNode(true, node, subTree);
            }
          } else {
            editNode(false, node, subTree);
            if (isValid) {
              isValid = false;
            }
          }
        }
        subTree =
            treeNode.setChildOpen(
                i,
                ((CellTreeNode) treeNode.getChildValue(i)).isOpen(),
                ((CellTreeNode) treeNode.getChildValue(i)).isOpen());
        if ((subTree != null) && (subTree.getChildCount() > 0)) {
          validateCellTreeNodes(subTree);
        }
      }
    }
    return isValid;
  }
コード例 #4
0
  /**
   * Closing all nodes in the CellTree except for the Master Root Node which is the Population node.
   * This method is called when '-' Collapse All button is clicked on the Screen
   *
   * @param node the node
   */
  @Override
  public void closeNodes(TreeNode node) {
    if (node != null) {
      for (int i = 0; i < node.getChildCount(); i++) {
        TreeNode subTree = null;
        if (((CellTreeNode) node.getChildValue(i)).getNodeType() == CellTreeNode.MASTER_ROOT_NODE) {
          subTree = node.setChildOpen(i, true, true);
        } else {
          subTree = node.setChildOpen(i, false, true);
        }

        if ((subTree != null) && (subTree.getChildCount() > 0)) {
          closeNodes(subTree);
        }
      }
    }
  }
コード例 #5
0
ファイル: NavigationActivity.java プロジェクト: xwiz/kaa
 private boolean openNode(TreeNode node, TreePlace place) {
   int childCount = node.getChildCount();
   for (int i = 0; i < childCount; i++) {
     if (node.getChildValue(i).equals(place)) {
       // node.setChildOpen(i, true, true);
       return true;
     } else if (!node.isChildLeaf(i)) {
       boolean wasOpen = node.isChildOpen(i);
       TreeNode child = node.setChildOpen(i, true);
       if (child != null && openNode(child, place)) {
         return true;
       } else if (!wasOpen) {
         node.setChildOpen(i, false);
       }
     }
   }
   return false;
 }