コード例 #1
0
ファイル: CatalogTreeModel.java プロジェクト: rmelton/ChefX3D
  /**
   * Build children objects for the requested node type. If the node is an attribute then do
   * nothing. Listeners will be added to the root item but not the children. This is to prevent odd
   * mixups if the children have listeners but have not yet had their children built. The viewable
   * tree would get very mixed up then
   *
   * @param root The root object to add children for
   */
  private void buildChildren(ToolGroupTreeNode root) {
    ToolGroupChild toolItem = root.getToolObject();

    if (toolItem instanceof ToolGroup) {
      ToolGroup tg = (ToolGroup) toolItem;
      List<ToolGroupChild> kids = tg.getChildren();

      for (int i = 0; i < kids.size(); i++) {
        ToolGroupChild child = kids.get(i);
        ToolGroupTreeNode kid = new ToolGroupTreeNode(child, root);

        root.insert(kid, i);
      }
    }
  }
コード例 #2
0
ファイル: CatalogTreeModel.java プロジェクト: rmelton/ChefX3D
  /**
   * Check to see if the given node is a leaf node. Leaf nodes are determined if the DOM object does
   * not support children.
   *
   * @param child The child node to check
   * @return True if the DOM node is a leaf
   */
  public boolean isLeaf(Object child) {
    ToolGroupTreeNode treeNode = (ToolGroupTreeNode) child;
    ToolGroupChild kid = treeNode.getToolObject();

    return (kid instanceof SimpleTool);
  }