Examples of CollectorNode


Examples of org.openquark.gems.client.ArgumentTreeNode.CollectorNode

     * @param collectorGem the collector to be represented.
     * @return an CollectorNode to use for that argument. 
     *   If possible, any CollectorNode previously used to represent the collector will be reused.
     */
    CollectorNode getCollectorNode(CollectorGem collectorGem) {
        CollectorNode collectorNode = collectorToNodeMap.get(collectorGem);
        if (collectorNode == null) {
            collectorNode = new CollectorNode(collectorGem);
            collectorToNodeMap.put(collectorGem, collectorNode);
        }
        return collectorNode;
    }
View Full Code Here

Examples of org.openquark.gems.client.ArgumentTreeNode.CollectorNode

     *   After populating with the current collector gem, populate() will be called recursively on targeting collectors.
     */
    private void populate(CollectorGem collectorGem, Map<CollectorGem, Set<CollectorGem>> targetToCollectorMap) {
       
        // Create a node for the collector, and add it to the parent.
        CollectorNode collectorNode = getCollectorNode(collectorGem);
        ((ArgumentTreeNode)getRoot()).add(collectorNode);
        collectorNode.removeAllChildren();
       
        // Add node for the arguments.
        List<Gem.PartInput> reflectedInputs = collectorGem.getReflectedInputs();
        for (final Gem.PartInput reflectedInput : reflectedInputs) {
            ArgumentNode reflectedInputNode = getArgumentNode(reflectedInput);
            collectorNode.add(reflectedInputNode);
        }
       
        if (displayUnusedArguments) {
            // Get the unused arguments.
            Set<PartInput> unusedArgumentSet = new HashSet<PartInput>(collectorGem.getTargetArguments());
            unusedArgumentSet.removeAll(reflectedInputs);
           
            // Sort them.
            List<PartInput> unusedArgumentList = new ArrayList<PartInput>(unusedArgumentSet);
            Collections.sort(unusedArgumentList, argumentComparatorByName);
           
            // Add the nodes.
            for (final PartInput unusedArgument : unusedArgumentList) {
                ArgumentNode unusedInputArgumentNode = getArgumentNode(unusedArgument);
                collectorNode.add(unusedInputArgumentNode);
            }
        }
       
        // Call recursively on targeting collectors.
        Set<CollectorGem> targetingCollectors = targetToCollectorMap.get(collectorGem);
View Full Code Here

Examples of org.openquark.gems.client.ArgumentTreeNode.CollectorNode

            // Ignore if the changed collector gem is not displayed.
            if (!(collectorToDisplay == null || collectorToDisplay == changedCollector)) {
                return;
            }
           
            CollectorNode collectorNode = collectorToNodeMap.get(changedCollector);
            nodeChanged(collectorNode);
           
            // If we are displaying multiple collectors, ensure that they remain in order.
            // Don't reposition the target though.
            CollectorGem targetCollectorGem = gemGraph.getTargetCollector();
            if (collectorToDisplay == null && changedCollector != targetCollectorGem) {
                // Check vs. siblings.
               
                ArgumentTreeNode rootNode = (ArgumentTreeNode)getRoot();
                CollectorNode targetCollectorNode = getCollectorNode(targetCollectorGem);

                // Get the collector node which should precede this collector's node.
                CollectorNode precedingNode = (CollectorNode)collectorNode.getPreviousSibling();
                while (precedingNode != null && precedingNode != targetCollectorNode &&
                        collectorComparatorByName.compare(changedCollector, precedingNode.getCollectorGem()) < 0) {
               
                    precedingNode = (CollectorNode)precedingNode.getPreviousSibling();
                }
               
                // If it's not equal to the node which currently precedes it, reposition.
                if (precedingNode != collectorNode.getPreviousSibling()) {
                    removeNodeFromParent(collectorNode);
                    int insertIndex = (precedingNode == null) ? 0 : rootNode.getIndex(precedingNode) + 1;
                    insertNodeInto(collectorNode, rootNode, insertIndex);
                   
                    // We can skip the check against the following node, if the nodes are always sorted.
                    return;
                }
               
                // Get the collector node which should follow this collector's node.
                CollectorNode followingNode = (CollectorNode)collectorNode.getNextSibling();
                while (followingNode != null && collectorComparatorByName.compare(followingNode.getCollectorGem(), changedCollector) < 0) {
                    followingNode = (CollectorNode)followingNode.getNextSibling();
                }
               
                // If it's not equal to the node which currently follows it, reposition.
                if (followingNode != collectorNode.getNextSibling()) {
                    removeNodeFromParent(collectorNode);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.