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 = 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

    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("description")) {
        DESCRIPTION = childNode.getFirstChild().getNodeValue();
      }else if (childNode.getNodeName().equals("operation")) {
        Operation operation = new Operation();
        operation.NAME = childNode.getAttributes().item(0).getNodeValue();
        operation.COMMAND = childNode.getAttributes().item(1).getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().item(2).getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().item(3).getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().item(4).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().item(0).getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().item(1).getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().item(2).getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().item(3).getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().item(4).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().item(3).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().item(0).getNodeValue();
        operation.COMMAND = childNode.getAttributes().item(1).getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().item(2).getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().item(3).getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().item(4).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().item(0).getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().item(1).getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().item(2).getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().item(3).getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().item(4).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().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().item(0).getNodeValue();
        int height = Integer.parseInt(childNode.getAttributes().item(1).getNodeValue());
        int width = Integer.parseInt(childNode.getAttributes().item(2).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().item(0).getNodeValue();
        operation.COMMAND = childNode.getAttributes().item(1).getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().item(2).getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().item(3).getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().item(4).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().item(0).getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().item(1).getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().item(2).getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().item(3).getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().item(4).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().item(3).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().item(0).getNodeValue();
        operation.COMMAND = childNode.getAttributes().item(1).getNodeValue();
        operation.HEIGHT = Integer.parseInt(childNode.getAttributes().item(2).getNodeValue());
        operation.WIDTH = Integer.parseInt(childNode.getAttributes().item(3).getNodeValue());
        if(childNode.getAttributes().getLength()>4)
          operation.ICON = childNode.getAttributes().item(4).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().item(0).getNodeValue();
            operation.COMMAND = relationshipNode.getAttributes().item(1).getNodeValue();
            operation.HEIGHT = Integer.parseInt(relationshipNode.getAttributes().item(2).getNodeValue());
            operation.WIDTH = Integer.parseInt(relationshipNode.getAttributes().item(3).getNodeValue());
            if(relationshipNode.getAttributes().getLength()>4)
              operation.ICON = relationshipNode.getAttributes().item(4).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

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.