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

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


            public void actionPerformed(ActionEvent e) {
                TreePath path = configTree.getSelectionPath();
                if (path != null) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
                            .getLastPathComponent();
                    ITreeNode treeNode = configTree.getModel().getTreeNode(node);
                    if (treeNode.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) treeNode.getData();
                        String entityName = askNewEntityName(entity.getClass());
                        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();
                        }
                    }
                }
            }
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

                actualSearchString = contains.trim().toLowerCase();
                // Search all the match tree path.
                // If several response do nothing
                // If one match Expend the match node
                // ITreeNode rootNode = configTree.getRootNode();
                ITreeNode iRootNode = configTree.getRootNode();
                buildFoundNode(iRootNode, actualSearchString);
            }

            if (!foundTreeNode.isEmpty()) {
                // System.out.println("nodeList=" + Arrays.toString(nodeList.toArray()));
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

     * @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

                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();
                            if (controller != null) {
                                DefaultMutableTreeNode newNode = (DefaultMutableTreeNode) path
                                        .getLastPathComponent();
                                String newConfigPath = extractCompletePath(newNode);
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

    @SuppressWarnings("unchecked")
    private void updateSelectedConfig() {
        IConfig<?> config = null;
        ITreeNode[] selectedNodes = view.getConfigTree().getSelectedNodes();
        if ((selectedNodes != null) && (selectedNodes.length > 0)) {
            ITreeNode toCheck = selectedNodes[0];
            if (toCheck != lastListenedNode) {
                if (lastListenedNode != null) {
                    lastListenedNode.removeTreeNodeListener(this);
                }
                lastListenedNode = toCheck;
                if (lastListenedNode != null) {
                    lastListenedNode.addTreeNodeListener(this);
                }
            }
            if (toCheck.getData() instanceof IConfig<?>) {
                config = (IConfig<?>) toCheck.getData();
            }
        }
        // if (config != null) {
        if (config != lastSelectedConfig) {
            if (lastSelectedConfig instanceof IEventSource<?>) {
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.