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

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


            currentRootNode = new BasicTreeNode();
            currentRootNode.setName("ERROR");
            currentRootNode.setImage(errorImage);
        }
        if ((deviceList != null) && (tree != null)) {
            ITreeNode rootNode = new BasicTreeNode();
            rootNode.setName(rootName);

            for (String path : deviceList) {
                String[] pathSplit = path.split("/");
                ITreeNode currentNode = rootNode;
                String nodePath = null;
                String el = null;
                for (String element : pathSplit) {
                    el = element;
                    ITreeNode node = null;
                    for (ITreeNode child : currentNode.getChildren()) {
                        if (child.getName().equals(el)) {
                            node = child;
                        }
                    }
                    if (node == null) {
                        node = new BasicTreeNode();
                    }
                    node.setName(el);
                    ITreeNode[] childToAdd = new ITreeNode[1];
                    childToAdd[0] = node;
                    currentNode.addNodes(childToAdd);

                    if (nodePath == null) {
                        nodePath = el;
                    } else {
                        nodePath = nodePath + "/" + el;
                    }
                    node.setData(nodePath);
                    currentNode = node;
                }
            }
            tree.setRootNode(rootNode);
            setRootImage(rootImage);
View Full Code Here


        return CometeWidgetFactory.createTree(this, childStyle);
    }

    @Override
    public ITreeNode getRootNode() {
        ITreeNode node = null;
        if(component instanceof ITree) {
            node= ((ITree) component).getRootNode();
        }
        return node;
    }
View Full Code Here

        }
    }

    @Override
    public ITreeNode getNodeAt(int x, int y) {
        ITreeNode node = null;
        if (component instanceof ITree) {
            node = ((ITree) component).getNodeAt(x, y);
        }
        return node;
    }
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

    }

    public void setRootImage(CometeImage image) {
        this.rootImage = image;
        if (tree != null) {
            ITreeNode rootNode = tree.getRootNode();
            if (rootNode != null) {
                rootNode.setName(rootName);
                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

    }

    private void fillTree() {
        List<String> deviceList = match();
        if ((deviceList != null) && (tree != null)) {
            ITreeNode rootNode = new BasicTreeNode();
            rootNode.setName(rootName);
            rootNode.setImage(rootImage);

            for (String path : deviceList) {

                String[] pathSplit = path.split("/");
                ITreeNode currentNode = rootNode;
                String nodePath = null;
                for (String el : pathSplit) {
                    ITreeNode node = null;
                    for (ITreeNode child : currentNode.getChildren()) {
                        if (child.getName().equals(el)) {
                            node = child;
                        }
                    }
                    if (node == null) {
                        node = new BasicTreeNode();
                    }
                    node.setName(el);
                    node.setImage(nodeImage);

                    ITreeNode[] childToAdd = new ITreeNode[1];
                    childToAdd[0] = node;
                    currentNode.addNodes(childToAdd);

                    if (nodePath == null) {
                        nodePath = el;
                    } else {
                        nodePath = nodePath + "/" + el;
                    }
                    node.setData(nodePath);
                    currentNode = node;
                }
                currentNode.setImage(leafImage);
            }
            tree.setRootNode(rootNode);
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

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.