Examples of MutableTreeNode


Examples of javax.swing.tree.MutableTreeNode

    super(pEvent);
    insert(createDataNode(), getChildCount());
  }

  private MutableTreeNode createDataNode() {
    MutableTreeNode dataNode = new DefaultMutableTreeNode("Data");
    dataNode.insert(new DefaultMutableTreeNode("ID : "
        + ((ActionEvent) mEvent).getId()), dataNode.getChildCount());
    dataNode.insert(new DefaultMutableTreeNode("Action command : "
        + ((ActionEvent) mEvent).getActionCommand()),
        dataNode.getChildCount());
    return dataNode;
  }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

          treeState.setLastMarker(null);
          treeState.setLastCommand(null);
        }
      } else if (UITreeOld.COMMAND_MOVE_UP.equals(command)) {
        if (!isRoot) {
          MutableTreeNode node = marker;
          MutableTreeNode parent = (MutableTreeNode) node.getParent();
          int index = parent.getIndex(node);
          index = Math.max(index - 1, 0);
          parent.insert(node, index);
        }
        treeState.setLastMarker(null);
        treeState.setLastCommand(null);
      } else if (UITreeOld.COMMAND_MOVE_DOWN.equals(command)) {
        if (!isRoot) {
          MutableTreeNode node = marker;
          MutableTreeNode parent = (MutableTreeNode) node.getParent();
          int index = parent.getIndex(node);
          index = Math.min(index + 1, parent.getChildCount() - 1);
          parent.insert(node, index);
        }
        treeState.setLastMarker(null);
        treeState.setLastCommand(null);
      }
    }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

                ("Unexpected exception while closing " +
                event.getName() + " in " + event.getPath().toString());
            ex.printStackTrace(System.err);
        }

        final MutableTreeNode parentNode = getNode(d.path, filename, rootNode);
        final MutableTreeNode nameNode = new DefaultMutableTreeNode(d.name);
        parentNode.insert(nameNode, 0);
        final MutableTreeNode dNode = new DefaultMutableTreeNode(d);
        nameNode.insert(dNode, 0);
    }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

     */
    private MutableTreeNode getNode(final POIFSDocumentPath path,
                                    final String fsName,
                                    final MutableTreeNode root)
    {
        MutableTreeNode n = (MutableTreeNode) pathToNode.get(path);
        if (n != null)
            /* Node found in map, just return it. */
            return n;
        if (path.length() == 0)
        {
            /* This is the root path of the POI filesystem. Its tree
             * node is resp. must be located below the tree node of
             * the POI filesystem itself. This is a tree node with the
             * POI filesystem's name (this the operating system file's
             * name) as its key it the path-to-node map. */
            n = (MutableTreeNode) pathToNode.get(fsName);
            if (n == null)
            {
                /* A tree node for the POI filesystem does not yet
                 * exist. */
                n = new DefaultMutableTreeNode(fsName);
                pathToNode.put(fsName, n);
                root.insert(n, 0);
            }
            return n;
        }
        else
        {
            /* The path is somewhere down in the POI filesystem's
             * hierarchy. We need the tree node of this path's parent
             * and attach our new node to it. */
            final String name = path.getComponent(path.length() - 1);
            final POIFSDocumentPath parentPath = path.getParent();
            final MutableTreeNode parentNode =
                getNode(parentPath, fsName, root);
            n = new DefaultMutableTreeNode(name);
            pathToNode.put(path, n);
            parentNode.insert(n, 0);
            return n;
        }
    }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

  /** Remove the currently selected node. */
  public void removeCurrentNode() {
    final TreePath currentSelection = tree.getSelectionPath();
    if (currentSelection != null) {
      final DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) currentSelection.getLastPathComponent();
      final MutableTreeNode parent = (MutableTreeNode) currentNode.getParent();
      if (parent != null) {
        treeModel.removeNodeFromParent(currentNode);
        return;
      }
    }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

    public void removeCurrentNode() {
        TreePath currentSelection = tree.getSelectionPath();
        if (currentSelection != null) {
            DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)
                         (currentSelection.getLastPathComponent());
            MutableTreeNode parent = (MutableTreeNode)(currentNode.getParent());
            if (parent != null) {
                treeModel.removeNodeFromParent(currentNode);
                return;
            }
        }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

    insert(createSourceNode(), getChildCount());
  }
 
  private MutableTreeNode createSourceNode()
  {
    MutableTreeNode sourceNode = new DefaultMutableTreeNode("Source");
    sourceNode.insert(new DefaultMutableTreeNode("Name : " + mEvent.getComponentName()), sourceNode.getChildCount());
    sourceNode.insert(new DefaultMutableTreeNode("Class : " + mEvent.getSourceClass()), sourceNode.getChildCount());
    return sourceNode;
  }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

  }

  private EventNodeFactory(){}
 
  public MutableTreeNode createNode(Event pEvent, boolean pWithComponent, boolean pWithType) {
    MutableTreeNode node = new DefaultMutableTreeNode();
    MutableTreeNode source = new DefaultMutableTreeNode("Source");

    node.insert(source, node.getChildCount());
   
    MutableTreeNode value;
   
    if ( pWithComponent ) {
      value = new DefaultMutableTreeNode(getComponentDisplayName(pEvent.getComponentName()));
      source.insert(value, source.getChildCount());
    } else {
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

    super(pEvent);
    insert(createDataNode(), getChildCount());
  }

  private MutableTreeNode createDataNode() {
    MutableTreeNode dataNode = new DefaultMutableTreeNode("Data");
    dataNode.insert(new DefaultMutableTreeNode("selected path : "
        + ((TreeSelectionEvent) mEvent).getSelectedPath()),
        dataNode.getChildCount());
    return dataNode;
  }
View Full Code Here

Examples of javax.swing.tree.MutableTreeNode

    return INSTANCE;
  }

  @Override
  public MutableTreeNode buildRootTree(List<Event> pEvents) {
    MutableTreeNode root = new DefaultMutableTreeNode("Components");
    Map<String, Map<String,  List<Event>>> sortedEvents = sortData(pEvents);
   
    for( String componentName : sortedEvents.keySet() )
    {
      MutableTreeNode componentNode = null;
      boolean first=true;
      for ( String eventType : sortedEvents.get(componentName).keySet() )
      {
        for (Event evt : sortedEvents.get(componentName).get(eventType) )
        {
          if ( first )
          {
            first = false;
            MutableTreeNode classNode = new DefaultMutableTreeNode(evt.getSourceClass());
            componentNode  = new ComponentNode(getComponentDisplayName(componentName), evt.getSourceClass())
            componentNode.insert(classNode, componentNode.getChildCount());
          }
          MutableTreeNode eventNode = EventNodeFactory.getInstance().createNode(evt, false, true);
          componentNode.insert(eventNode, componentNode.getChildCount());
        }
      }
      root.insert(componentNode, root.getChildCount());
    }
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.