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

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


                    currentNodes[0].addNodes(data);
                    isModified = true;
                }
            }
            else {
                ITreeNode rootNode = getRootNode();
                if (rootNode != null) {
                    if (useChildren) {
                        isModified = addChildrenNodes(rootNode, data);
                    }
                    else {
                        rootNode.addNodes(data);
                        isModified = true;
                    }
                }
            }
        }
View Full Code Here


            else if (currentNodes.length == 1) {
                currentNodes[0].addNodes(data);
                isModified = true;
            }
            else {
                ITreeNode rootNode = getRootNode();
                if (rootNode != null) {
                    rootNode.addNodes(data);
                    isModified = true;
                }
            }
            if (isModified) {
                Object key = data.getData();
View Full Code Here

    private List<ITreeNode> extractTreeNodes(List<?> selection) {
        List<ITreeNode> nodes = new ArrayList<ITreeNode>();
        if (getModel() != null) {
            for (Object child : selection) {
                if (child instanceof DefaultMutableTreeNode) {
                    ITreeNode node = getModel().getTreeNode((DefaultMutableTreeNode) child);
                    if (node.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) node.getData();
                        if (entity.getDirectory() != null) {
                            nodes.add(node);
                        }
                    }
                }
View Full Code Here

                }
            }
            else {
                toDrop = nodes;
            }
            ITreeNode realTarget = TreeNodeUtils.findDirectoryNode(target);
            if (realTarget != null) {
                realTarget.addNodes(toDrop.toArray(new ITreeNode[toDrop.size()]));
                IDirectory directory = (IDirectory) realTarget.getData();
                for (ITreeNode node : toDrop) {
                    if (node.getData() instanceof IEntity) {
                        ((IEntity) node.getData()).setDirectory(directory);
                    }
                }
View Full Code Here

    /**
     * Notifies mediators for the need to save all nodes
     */
    public void notifySaveAll() {
        ITreeNode rootNode = getRootNode();
        if (rootNode != null) {
            targetDelegate.warnMediators(new NodeInformation(this, rootNode));
        }
        repaint();
    }
View Full Code Here

    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

            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

    private 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

    public void selectionChanged(TreeNodeSelectionEvent event) {
        if ((event != null) && (view != null) && (view.getConfigTree() != null)
                && (event.getSource() == view.getConfigTree())) {
            ITreeNode[] selectedNodes = view.getConfigTree().getSelectedNodes();
            if ((selectedNodes != null) && (selectedNodes.length > 0)) {
                ITreeNode toCheck = selectedNodes[0];
                if (toCheck.getData() instanceof IConfig<?>) {
                    notifyListeners((IConfig<?>) toCheck.getData());
                }
            }
        }
    }
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.