Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.Node


     
      try{
        Document doc = XMLParser.parse(map);
        XMLParser.removeWhitespace(doc);
        if (doc != null) {
          Node rootnode = null;
          for(int ii = 0; ii < doc.getChildNodes().getLength(); ii++){
            if(doc.getChildNodes().item(ii).getNodeName().equals("graph"))
              rootnode = doc.getChildNodes().item(ii);
          }
          if(rootnode != null){
            for(int i = 0;i < rootnode.getAttributes().getLength();i++){
              if(rootnode.getAttributes().item(i).getNodeName().equals("levels")){
                levels = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
                Navigator.DEPTH.setValue(String.valueOf(levels));
              }
              if(rootnode.getAttributes().item(i).getNodeName().equals("radius")){
                RADIUS = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
                Position.setB();
              }
              if(rootnode.getAttributes().item(i).getNodeName().equals("viewlevel"))
                VIEW = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
              if(rootnode.getAttributes().item(i).getNodeName().equals("imgsizeatview"))
                IMAGE_PIXEL_SIZE = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
              if(rootnode.getAttributes().item(i).getNodeName().equals("forces"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y")){
                  Position.AUTO = true;
                  Navigator.AUTO.setValue(true);
                }
              if(rootnode.getAttributes().item(i).getNodeName().equals("threedimension"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y")){
                  Position.GRAPH_3D = true;
                  Navigator.GRAPH_3D.setValue(true);
                }
              if(rootnode.getAttributes().item(i).getNodeName().equals("wrapoperation"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y"))
                  Operations.WRAP = true;
            }
            Node node = rootnode.getFirstChild();
            if(node.getNodeName().equals("focus"))
              load(node,levels);
            else if(node.getNodeName().equals("update")){
              if(FOCUS != null){
                reload(node);
              }
            }
            else
              webError("XML Error, check schema at " + node.getNodeName());
          }else
            webError("XML Error, check schema at graph " + rootnode.getNodeName());
        }else
          webError("Document Error.");
      }catch(Exception e){
View Full Code Here


   * @param node XML node representing the update required.
     */
    public static void reload(Node node) {
     
      for(int i = 0; i < node.getChildNodes().getLength(); i++){
      Node childNode = node.getChildNodes().item(i);
      if(childNode.getNodeName().equals("add")){
        int parentID = Integer.parseInt(childNode.getAttributes().getNamedItem("parent_id").getNodeValue());
        MindMap entity = MindMap.get(parentID);
        if(entity!=null)
          entity.add(childNode.getChildNodes().item(0));
      }else if(childNode.getNodeName().equals("remove")){
        String string = childNode.getFirstChild().getNodeValue();
        String[] values = string.split("\\s");
        for(String id : values){
          MindMap entity = MindMap.get(Integer.parseInt(id));
          if(entity!=null)
            entity.remove();
        }
        Connection.update(MindMap.CONNECTIONS.values());
      }else if(childNode.getNodeName().equals("set")){
        for(int ii = 0; ii<childNode.getChildNodes().getLength(); ii++){
          Node setNode = childNode.getChildNodes().item(ii);
          if(setNode.getNodeName().equals("entity")){
            int id = Integer.parseInt(setNode.getAttributes().getNamedItem("id").getNodeValue());
            MindMap entity = MindMap.get(id);
            if(entity!=null)
              entity.set(setNode);
          }
        }
View Full Code Here

    DRAWN = false;
    LEVEL = level;
     
    int childIndex = 0;
      for (int i = 0; i < node.getChildNodes().getLength(); i++) {
      Node childNode = node.getChildNodes().item(i);
      if (childNode.getNodeName().equals("initial")) {
        com.smartgwt.client.widgets.Window window = new com.smartgwt.client.widgets.Window();
        String command = childNode.getAttributes().getNamedItem("command").getNodeValue();
        int height = Integer.parseInt(childNode.getAttributes().getNamedItem("height").getNodeValue());
        int width = Integer.parseInt(childNode.getAttributes().getNamedItem("width").getNodeValue());
        String description;
        if (childNode.hasChildNodes() && childNode.getChildNodes().item(0).getNodeName().equals("description"))
          description = childNode.getChildNodes().item(0).getFirstChild().getNodeValue();
        else
          description = "Welcome Note";
        int left = Window.getScrollLeft() + (Home.WIDTH/2) - (width/2);
        int top = Window.getScrollTop() + (Home.HEIGHT/2) - (height/2);
        RootPanel.get().add(window, left, top);
        window.setShowMinimizeButton(false);
        window.setSize(String.valueOf(width),String.valueOf(height));
        window.setCanDragReposition(true);
        window.setCanDrop(true);
        window.setTitle(description);
        window.setSrc(command);
        window.draw();
      }else if (childNode.getNodeName().equals("description")) {
        DESCRIPTION = childNode.getFirstChild().getNodeValue();
      }else if (childNode.getNodeName().equals("operation")) {
        Operation operation = new Operation();
        operation.NAME = childNode.getAttributes().getNamedItem("name").getNodeValue();
        operation.COMMAND = childNode.getAttributes().getNamedItem("command").getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().getNamedItem("height").getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().getNamedItem("width").getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().getNamedItem("icon").getNodeValue();
        else
          operation.ICON = ICON;
        if (childNode.hasChildNodes() && childNode.getChildNodes().item(0).getNodeName().equals("description"))
          operation.DESCRIPTION = childNode.getChildNodes().item(0).getFirstChild().getNodeValue();
        OPERATIONS.add(operation);
      }else if (childNode.getNodeName().equals("relationship")) {
        RELATIONSHIP = new Operations();
        for(int ii = 0; ii <childNode.getChildNodes().getLength();ii++){
          Node relationshipNode = childNode.getChildNodes().item(ii);
          if (relationshipNode.getNodeName().equals("operation")) {
            Operation operation = new Operation();
            operation.NAME = relationshipNode.getAttributes().getNamedItem("name").getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().getNamedItem("command").getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().getNamedItem("height").getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().getNamedItem("width").getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().getNamedItem("icon").getNodeValue();
            else
              operation.ICON = null;
            if (relationshipNode.hasChildNodes() && relationshipNode.getChildNodes().item(0).getNodeName().equals("description"))
              operation.DESCRIPTION = relationshipNode.getChildNodes().item(0).getFirstChild().getNodeValue();
            RELATIONSHIP.add(operation);
          }
        }
      }else if (childNode.getNodeName().equals("entity")) {
          MindMap childEntity;
View Full Code Here

      ICON = node.getAttributes().getNamedItem("icon").getNodeValue();
      OPERATIONS.clear();
    Home.CANVAS.removeChild(NODE);
   
      for (int i = 0; i < node.getChildNodes().getLength(); i++) {
      Node childNode = node.getChildNodes().item(i);
      if (childNode.getNodeName().equals("description")) {
        DESCRIPTION = childNode.getFirstChild().getNodeValue();
      }else if (childNode.getNodeName().equals("operation")) {
        Operation operation = new Operation();
        operation.NAME = childNode.getAttributes().getNamedItem("name").getNodeValue();
        operation.COMMAND = childNode.getAttributes().getNamedItem("command").getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().getNamedItem("height").getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().getNamedItem("width").getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().getNamedItem("icon").getNodeValue();
        else
          operation.ICON = ICON;
        if (childNode.hasChildNodes() && childNode.getChildNodes().item(0).getNodeName().equals("description"))
          operation.DESCRIPTION = childNode.getChildNodes().item(0).getFirstChild().getNodeValue();
        OPERATIONS.add(operation);
      }else if (childNode.getNodeName().equals("relationship")) {
        RELATIONSHIP = new Operations();
        for(int ii = 0; ii <childNode.getChildNodes().getLength();ii++){
          Node relationshipNode = childNode.getChildNodes().item(ii);
          if (relationshipNode.getNodeName().equals("operation")) {
            Operation operation = new Operation();
            operation.NAME = relationshipNode.getAttributes().getNamedItem("name").getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().getNamedItem("command").getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().getNamedItem("height").getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().getNamedItem("width").getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().getNamedItem("icon").getNodeValue();
            else
              operation.ICON = null;
            if (relationshipNode.hasChildNodes() && relationshipNode.getChildNodes().item(0).getNodeName().equals("description"))
              operation.DESCRIPTION = relationshipNode.getChildNodes().item(0).getFirstChild().getNodeValue();
            RELATIONSHIP.add(operation);
          }
        }
      }else
        Home.webError(childNode.getNodeName());
View Full Code Here

     
      try{
        Document doc = XMLParser.parse(map);
        XMLParser.removeWhitespace(doc);
        if (doc != null) {
          Node rootnode = doc.getFirstChild();
          if (rootnode.getNodeName().equals("graph")){
            Node node = rootnode.getFirstChild();
            if(node.getNodeName().equals("focus"))
              load(node,levels);
            else if(node.getNodeName().equals("update"))
              if(FOCUS != null)
              reload(node);
            else
              webError("XML Error, check schema at " + node.getNodeName());
          }else
            webError("XML Error, check schema at graph");
        }else
          webError("Document Error.");
      }catch(Exception e){
View Full Code Here

   * @param node XML node representing the update required.
     */
    public static void reload(Node node) {
     
      for(int i = 0; i < node.getChildNodes().getLength(); i++){
      Node childNode = node.getChildNodes().item(i);
      if(childNode.getNodeName().equals("add")){
        int parentID = Integer.parseInt(childNode.getAttributes().item(0).getNodeValue());
        MindMap entity = MindMap.get(parentID);
        if(entity!=null)
          entity.add(childNode.getChildNodes().item(0));
      }else if(childNode.getNodeName().equals("remove")){
        String string = childNode.getFirstChild().getNodeValue();
        String[] values = string.split("\\s");
        for(String id : values){
          MindMap entity = MindMap.get(Integer.parseInt(id));
          if(entity!=null)
            entity.remove();
        }
        Connection.update(MindMap.CONNECTIONS.values());
      }else if(childNode.getNodeName().equals("set")){
        for(int ii = 0; ii<childNode.getChildNodes().getLength(); ii++){
          Node setNode = childNode.getChildNodes().item(ii);
          if(setNode.getNodeName().equals("entity")){
            int id = Integer.parseInt(setNode.getAttributes().item(0).getNodeValue());
            MindMap entity = MindMap.get(id);
            if(entity!=null)
              entity.set(setNode);
          }
        }
View Full Code Here

   * @param node XML node representing the update required.
     */
    public static void reload(Node node) {
     
      for(int i = 0; i < node.getChildNodes().getLength(); i++){
      Node childNode = node.getChildNodes().item(i);
      if(childNode.getNodeName().equals("add")){
        int parentID = Integer.parseInt(childNode.getAttributes().getNamedItem("parent_id").getNodeValue());
        MindMap entity = MindMap.get(parentID);
        if(entity!=null)
          entity.add(childNode.getChildNodes().item(0));
      }else if(childNode.getNodeName().equals("remove")){
        String string = childNode.getFirstChild().getNodeValue();
        String[] values = string.split("\\s");
        for(String id : values){
          MindMap entity = MindMap.get(Integer.parseInt(id));
          if(entity!=null)
            entity.remove();
        }
        Connection.update(MindMap.CONNECTIONS.values());
      }else if(childNode.getNodeName().equals("set")){
        for(int ii = 0; ii<childNode.getChildNodes().getLength(); ii++){
          Node setNode = childNode.getChildNodes().item(ii);
          if(setNode.getNodeName().equals("entity")){
            int id = Integer.parseInt(setNode.getAttributes().getNamedItem("id").getNodeValue());
            MindMap entity = MindMap.get(id);
            if(entity!=null)
              entity.set(setNode);
          }
        }
View Full Code Here

     
      try{
        Document doc = XMLParser.parse(map);
        XMLParser.removeWhitespace(doc);
        if (doc != null) {
          Node rootnode = null;
          for(int ii = 0; ii < doc.getChildNodes().getLength(); ii++){
            if(doc.getChildNodes().item(ii).getNodeName().equals("graph"))
              rootnode = doc.getChildNodes().item(ii);
          }
          if(rootnode != null){
            for(int i = 0;i < rootnode.getAttributes().getLength();i++){
              if(rootnode.getAttributes().item(i).getNodeName().equals("levels")){
                levels = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
                Navigator.DEPTH.setValue(String.valueOf(levels));
              }
              if(rootnode.getAttributes().item(i).getNodeName().equals("radius")){
                RADIUS = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
                Position.setB();
              }
              if(rootnode.getAttributes().item(i).getNodeName().equals("viewlevel"))
                VIEW = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
              if(rootnode.getAttributes().item(i).getNodeName().equals("imgsizeatview"))
                IMAGE_PIXEL_SIZE = Integer.parseInt(rootnode.getAttributes().item(i).getNodeValue());
              if(rootnode.getAttributes().item(i).getNodeName().equals("forces"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y")){
                  Position.AUTO = true;
                  Navigator.AUTO.setValue(true);
                }
              if(rootnode.getAttributes().item(i).getNodeName().equals("threedimension"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y")){
                  Position.GRAPH_3D = true;
                  Navigator.GRAPH_3D.setValue(true);
                }
              if(rootnode.getAttributes().item(i).getNodeName().equals("wrapoperation"))
                if(rootnode.getAttributes().item(i).getNodeValue().equals("Y"))
                  Operations.WRAP = true;
            }
            Node node = rootnode.getFirstChild();
            if(node.getNodeName().equals("focus"))
              load(node,levels);
            else if(node.getNodeName().equals("update")){
              if(FOCUS != null){
                reload(node);
              }
            }else
              webError("XML Error, check schema at " + node.getNodeName());
          }else
            webError("XML Error, check schema at graph " + doc.getNodeName());
        }else
          webError("Document Error.");
      }catch(Exception e){
View Full Code Here

        private void parseEntries(@Nonnull final Document document) {
            NodeList entryNodes = document.getElementsByTagName(ENTRY_TAG);

            if (entryNodes != null) {
                Node entryNode;
                for (int i = 0; i < entryNodes.getLength(); i++) {
                    entryNode = entryNodes.item(i);
                    assert entryNode != null;
                   
                    if (entryNode.getNodeType() == ELEMENT_NODE) {
                        entries.add(new Entry(entryNodes.item(i)));
                    }
                }
                Collections.reverse(entries);
            }
View Full Code Here

        private void parseLinks(@Nonnull final Document document) {
            NodeList linkNodes = document.getElementsByTagName(LINK_TAG);

            if (linkNodes != null) {
                Node linkNode;
                for (int i = 0; i < linkNodes.getLength(); i++) {
                    linkNode = linkNodes.item(i);
                    if (isLinkBelongToFeed(linkNode)) {
                        setLink(linkNode);
                    }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.Node

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.