Package com.touchgraph.linkbrowser

Examples of com.touchgraph.linkbrowser.LBNode


            boolean urlIsXML = getBooleanAttr(node, "urlIsXML", false)
            String nodeID = node.getAttribute("nodeID",null);
            if (nodeID==null)
                throw new TGException(TGException.NODE_NO_ID, "node has no ID");
            
            LBNode newNode = new LBNode(nodeID, nodeName, nodeUrl);
            newNode.setVisible(true);
            newNode.setURLIsLocal(urlIsLocal);
            newNode.setURLIsXML(urlIsXML);
            newNode.setLocation(new Point(x,y));           
            newNode.setHint(nodeHint);
           
           
            switch (col) {
                case 0:  newNode.setBackColor(color); break;
                case 1:  newNode.setBackColor(new Color(160, 64, 0)); break;
                case 2:  newNode.setBackColor(new Color(64, 160, 0)); break;
                case 3:  newNode.setBackColor(new Color(0, 0, 224)); break;
                default:  newNode.setBackColor(color); break;
            }  
                      
            graphEltSet.addNode(newNode);
        }

        IXMLElement edgeSet =
            (IXMLElement) tglbXML.getChildrenNamed("EDGESET").firstElement();
       
        Enumeration edgeEnum = (edgeSet).enumerateChildren();
                   
        while (edgeEnum.hasMoreElements()) {
            IXMLElement edge = (IXMLElement)(edgeEnum.nextElement());
            String fromID = edge.getAttribute("fromID",null);
            String toID = edge.getAttribute("toID",null);
            int tension = edge.getAttribute("tension", 4000); //For backward compatibility
            int length = edge.getAttribute("length", 4000);
            int edgeType = edge.getAttribute("type", 1);
            if (length ==0) length= tension;
            Color color= Edge.DEFAULT_COLOR;
            try {
                String colorString = edge.getAttribute("color",null);
                if (colorString!=null) color = Color.decode(colorString);               
            }
            catch ( NumberFormatException ex) {};
            LBNode fromNode = (LBNode) graphEltSet.findNode(fromID);
            LBNode toNode = (LBNode) graphEltSet.findNode(toID);
            LBEdge newEdge = new LBEdge(fromNode,toNode, length/100);
            newEdge.setVisible(true);
            newEdge.setColor(color);
           
            switch (edgeType) {
View Full Code Here


        final XMLElement nodeSet = new XMLElement("NODESET");               
        tglbXML.addChild(nodeSet);
               
        TGForEachNode fen = new TGForEachNode() {
            public void forEachNode( Node node ) {
                LBNode lbNode = (LBNode) node;
                XMLElement nodeElt = new XMLElement("NODE");
                nodeElt.setAttribute("nodeID", lbNode.getID());
               
                XMLElement nodeLocation = new XMLElement("NODE_LOCATION");
                nodeLocation.setAttribute("x", ""+(int) lbNode.getLocation().getX());
                nodeLocation.setAttribute("y", ""+(int) lbNode.getLocation().getY());
                nodeLocation.setAttribute("visible", lbNode.isVisible() ? "true" : "false");
                nodeElt.addChild(nodeLocation);
               
                XMLElement nodeLabel = new XMLElement("NODE_LABEL");
                nodeLabel.setAttribute("label", lbNode.getLabel());
                nodeLabel.setAttribute("shape", ""+lbNode.getType());
                nodeLabel.setAttribute("backColor", encodeColor(lbNode.getBackColor()));
                nodeLabel.setAttribute("textColor", encodeColor(lbNode.getTextColor()));
                nodeLabel.setAttribute("fontSize", ""+lbNode.getFont().getSize());
                nodeElt.addChild(nodeLabel);
               
                XMLElement nodeURL = new XMLElement("NODE_URL");
                nodeURL.setAttribute("url", lbNode.getURL());
                nodeURL.setAttribute("urlIsLocal", lbNode.getURLIsLocal() ? "true" : "false");
                nodeURL.setAttribute("urlIsXML", lbNode.getURLIsXML() ? "true" : "false");
                nodeElt.addChild(nodeURL);
               
                XMLElement nodeHint = new XMLElement("NODE_HINT");
                nodeHint.setAttribute("hint", lbNode.getHint());
                nodeHint.setAttribute("width", ""+lbNode.getHintWidth());
                nodeHint.setAttribute("height", ""+lbNode.getHintHeight());
                nodeHint.setAttribute("isHTML", lbNode.getHintIsHTML() ? "true" : "false");
                nodeElt.addChild(nodeHint);
                               
                nodeSet.addChild(nodeElt);
            }
        };
View Full Code Here

TOP

Related Classes of com.touchgraph.linkbrowser.LBNode

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.