Package javax.swing.tree

Examples of javax.swing.tree.DefaultMutableTreeNode$PostorderEnumeration


     * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
     */
    public void valueChanged(TreeSelectionEvent e) {
        TransformTarget selected = null;
        if (e.getPath().getLastPathComponent() instanceof DefaultMutableTreeNode) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath()
                    .getLastPathComponent();
            if (node.getUserObject() instanceof TransformTarget) {
                selected = (TransformTarget) node.getUserObject();
                try {
                    description.getDocument().remove(0,
                            description.getDocument().getLength());
                    description.getDocument().insertString(0,
                            selected.getDescription(),
View Full Code Here


        /** Expansion */
        public void treeExpanded(TreeExpansionEvent e) {
            if (area != null) {
                area.repaint();
            }
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()
                    .getLastPathComponent());
            Task task = (Task) node.getUserObject();

            /*
             * if(!expand.contains(new Integer(task.getTaskID()))) {
             * expand.add(new Integer(task.getTaskID()));
             * appli.setAskForSave(true); }
View Full Code Here

        public void treeCollapsed(TreeExpansionEvent e) {
            if (area != null) {
                area.repaint();
            }

            DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()
                    .getLastPathComponent());
            Task task = (Task) node.getUserObject();

            /*
             * int index = expand.indexOf(new Integer(task.getTaskID())); if
             * (index >= 0) { expand.remove(index); appli.setAskForSave(true); }
             */
 
View Full Code Here

        }

        /** Insert a new node. */
        public void treeNodesInserted(TreeModelEvent e) {

            DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e
                    .getTreePath().getLastPathComponent());
            Task task = (Task) node.getUserObject();

            /*
             * if (!expand.contains(new Integer(task.getTaskID()))) {
             * expand.add(new Integer(task.getTaskID())); }
             */
 
View Full Code Here

    }

    /** Construct the menu settings. */
    public void constructSections() {
        addPagesFromProviders();
        DefaultMutableTreeNode projectNode = addObject(GanttProject
                .correctLabel(language.getText("project")), null);
        DefaultMutableTreeNode generalNode = addObject(language
                .getText("general"), null);
        DefaultMutableTreeNode exportNode = addObject(GanttProject
                .correctLabel(language.getText("export")), null);
        DefaultMutableTreeNode roleNode = addObject(language
                .getText("resourceRole"), null);

        // general section
        addObject(language.getText("parameters"), generalNode);
        addObject(language.getText("looknfeel"), generalNode);
View Full Code Here

    /** Callback for the tree selection event. */
    public void valueChanged(TreeSelectionEvent e) {
        if (reinit)
            return;
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()
                .getLastPathComponent());
        boolean bHasChange = settingPanel.applyChanges(true);

        // construct the sections
        if ((settingPanel instanceof LanguageSettingsPanel) && bHasChange) {
            reinit = true;
            rootNode.removeAllChildren();
            treeModel.setRoot(rootNode);
            treeModel.reload();
            constructSections();
            reinit = false;
        }

        // - remove the settingPanel
        mainPanel2.remove(0);
       
        Box vb = Box.createVerticalBox();       
        Object userObject = node.getUserObject();
        if (userObject instanceof OptionPageProvider) {
            settingPanel = new OptionPageProviderPanel((OptionPageProvider) userObject, getProject(), getUIFacade());
        }
        else {

        // - ask the settingPanel if parameters are changed

        // - Create the new panel
            String sNode = (String) (node.getUserObject());
            if (sNode.equals(language.getText("languages")))
                settingPanel = new LanguageSettingsPanel(appli);
   
            else if (sNode.equals(GanttProject.correctLabel(language
                    .getText("project"))))
View Full Code Here

                DataFlavor flavor = flavors[i];
                if (flavor
                        .isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
                    try {
                        Point pt = dtde.getLocation();
                        DefaultMutableTreeNode target = (DefaultMutableTreeNode) treetable
                                .getTree()
                                .getClosestPathForLocation(pt.x, pt.y)
                                .getLastPathComponent();
                        TreePath pathSource = (TreePath) transferable
                                .getTransferData(flavor);
                        DefaultMutableTreeNode source = (DefaultMutableTreeNode) pathSource
                                .getLastPathComponent();

                        TreePath pathNewChild = null;

                        TreeNode sourceFather = source.getParent();
                        int index = sourceFather.getIndex(source);
                        source.removeFromParent();

                        treeModel.nodesWereRemoved(sourceFather,
                                new int[] { index }, new Object[] { source });

                        ((GanttTreeTableModel) treeModel).insertNodeInto(
View Full Code Here

    }

    /** Create a new Human */
    public void newHuman(HumanResource people) {
        if (people != null) {
            DefaultMutableTreeNode result = model.addResource(people);
            table.getTree().scrollPathToVisible(new TreePath(result.getPath()));
        }
    }
View Full Code Here

      }
    }

    public void saveSelectionToClipboard(boolean cut)
    {
      DefaultMutableTreeNode selectedNodes[] = this.table.getSelectedNodes();

      if(selectedNodes == null)
        return;

      /*count instances of ResourceNode*/
 
View Full Code Here

   *
   */
  public MyTreeModel(File f) {
    //cr�ation du premier noeud
   
    super(new DefaultMutableTreeNode(f));
   
//    Appele de la fonction addChildren de la classe TreeUtil
    //Elle demande en param�tre DefaultTreeModel, DefaultMutableTreeNode
    TreeUtil.addChildren(this,(DefaultMutableTreeNode)getRoot());
    /*
 
View Full Code Here

TOP

Related Classes of javax.swing.tree.DefaultMutableTreeNode$PostorderEnumeration

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.