Package fr.soleil.comete.definition.widget.util

Examples of fr.soleil.comete.definition.widget.util.ITreeNode


            e1.printStackTrace();
        } catch (URISyntaxException e2) {
            e2.printStackTrace();
        }

        ITreeNode rootNode = new BasicTreeNode();
        constructTree(rootNode, dataset.getRootGroup());
        tree.setRootNode(rootNode);
        tree.addMouseListener(archivingListener);

        panel.add(tree, BorderLayout.CENTER);
View Full Code Here


    private static void constructTree(ITreeNode parentNode, IGroup group) {
        if (parentNode != null) {
            try {
                parentNode.setName(group.getName());
                for (IGroup tempGroup : group.getGroupList()) {
                    ITreeNode node = new BasicTreeNode();
                    parentNode.addNodes(node);
                    constructTree(node, tempGroup);
                }
                for (IDataItem dataItem : group.getDataItemList()) {
                    ITreeNode node = new BasicTreeNode();
                    node.setName(dataItem.getName());
                    node.setData(dataItem.getData());
                    parentNode.addNodes(node);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
View Full Code Here

            if (event.getClicks() > 1) {
                if (event.getSource() instanceof Tree) {
                    Tree tree = (Tree) event.getSource();
                    ITreeNode[] nodes = tree.getSelectedNodes();
                    if (nodes.length == 1) {
                        ITreeNode node = nodes[0];
                        if (node.getData() != null && !tablePanelOpen) {
                            tablePanelOpen = true;
                            openTableDialog(node.getName(), (IArray) node.getData());
                        }
                    }
                }
            }
        }
View Full Code Here

            if ((split != null) && (split.length > 0)) {
                // Search all the match tree path.
                // If several response do nothing
                // If one match Expend the match node
                // ITreeNode rootNode = configTree.getRootNode();
                ITreeNode node = configTree.getRootNode();
                int index = 0;
                if ((node != null) && node.getName().equals(split[index])) {
                    index++;
                    while ((node != null) && (index < split.length)) {
                        List<ITreeNode> childrenNode = node.getChildren();
                        for (ITreeNode childNode : childrenNode) {
                            if (childNode.getName().equals(split[index])) {
                                node = childNode;
                                index++;
                                break;
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                TreePath path = configTree.getSelectionPath();
                if (path != null) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                    String configPath = extractCompletePath(node);
                    ITreeNode treeNode = configTree.getModel().getTreeNode(node);
                    if (treeNode.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) treeNode.getData();
                        String entityName = askRenameEntityName(entity.getClass(), treeNode.getName());
                        if (entityName != null) {
                            // updating node name will generate an event, that
                            // will make the source
                            // save the entity with an updated name
                            treeNode.setName(entityName);
                            configTree.repaint();
                            DefaultMutableTreeNode newNode = (DefaultMutableTreeNode) path.getLastPathComponent();
                            String newConfigPath = extractCompletePath(newNode);
                            UIPreferences.getInstance().replaceEntryInBookmarks(configPath, newConfigPath);
                            buildBookmarks();
View Full Code Here

    public void deleteSelectedNodes() {
        List<ITreeNode> selection = configTree.getSelectedNodesSortedByPath();
        TreeNodeUtils.filterMultipleSelection(selection);
        for (ITreeNode node : selection) {
            if (node.getParent() != null) {
                ITreeNode parent = node.getParent();
                int ok = JOptionPane.YES_OPTION;
                if (node.getData() instanceof IEntity) {
                    ok = confirmDeleteEntity((IEntity) node.getData());
                }
                if (ok == JOptionPane.YES_OPTION) {
                    parent.removeNode(node);
                }
            }
        }
    }
View Full Code Here

     * @return A {@link String}
     */
    private String extractName(DefaultMutableTreeNode node) {
        String name = null;
        if ((node != null) && (configTree != null) && (configTree.getModel() != null)) {
            ITreeNode treeNode = configTree.getModel().getTreeNode(node);
            if (treeNode != null) {
                name = treeNode.getName();
            }
        }
        return name;
    }
View Full Code Here

    }

    private String extractCompletePath(DefaultMutableTreeNode node) {
        String name = null;
        if ((node != null) && (configTree != null) && (configTree.getModel() != null)) {
            ITreeNode treeNode = configTree.getModel().getTreeNode(node);
            if (treeNode != null) {
                name = treeNode.getName();
                ITreeNode parent = treeNode.getParent();
                while (parent != null) {
                    name = parent.getName() + "/" + name;
                    parent = parent.getParent();
                }
            }
        }
        return name;
    }
View Full Code Here

    }

    public void setRootImage(CometeImage image) {
        this.rootImage = image;
        if (tree != null) {
            ITreeNode rootNode = tree.getRootNode();
            if (rootNode != null) {
                rootNode.setImage(rootImage);
            }
        }
    }
View Full Code Here

        refreshNodeAndLeafImage();
    }

    private void refreshNodeAndLeafImage() {
        if (tree != null) {
            ITreeNode rootNode = tree.getRootNode();
            if (rootNode != null) {
                List<ITreeNode> children = rootNode.getChildren();
                refreshNodeAndLeafImage(children);
            }
        }
    }
View Full Code Here

TOP

Related Classes of fr.soleil.comete.definition.widget.util.ITreeNode

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.