Package org.cybergarage.xml

Examples of org.cybergarage.xml.Node


  //  UserData
  ////////////////////////////////////////////////

  private ArgumentData getArgumentData()
  {
    Node node = getArgumentNode();
    ArgumentData userData = (ArgumentData)node.getUserData();
    if (userData == null) {
      userData = new ArgumentData();
      node.setUserData(userData);
      userData.setNode(node);
    }
    return userData;
  }
View Full Code Here


  {
    iconNode = node;
  }

  public Icon() {
    this(new Node(ELEM_NAME));
  }
View Full Code Here

  //  Constructor
  ////////////////////////////////////////////////
  public Action(Node serviceNode){
    //TODO Test
    this.serviceNode = serviceNode;
    this.actionNode = new Node(Action.ELEM_NAME);   
  }
View Full Code Here

  ////////////////////////////////////////////////

  public ArgumentList getArgumentList()
  {
    ArgumentList argumentList = new ArgumentList();
    Node argumentListNode = getActionNode().getNode(ArgumentList.ELEM_NAME);
    if (argumentListNode == null)
      return argumentList;
    int nodeCnt = argumentListNode.getNNodes();
    for (int n=0; n<nodeCnt; n++) {
      Node node = argumentListNode.getNode(n);
      if (Argument.isArgumentNode(node) == false)
        continue;
      Argument argument = new Argument(getServiceNode(), node);
      argumentList.add(argument);
    }
View Full Code Here

    }
    return argumentList;
 
 
  public void setArgumentList(ArgumentList al){
    Node argumentListNode = getActionNode().getNode(ArgumentList.ELEM_NAME);
    if (argumentListNode == null){
      argumentListNode = new Node(ArgumentList.ELEM_NAME);
      getActionNode().addNode(argumentListNode);
    }else{
      argumentListNode.removeAllNodes();
    }
    Iterator i = al.iterator();
    while (i.hasNext()) {
      Argument a = (Argument) i.next();
      a.setService(getService());
      argumentListNode.addNode(a.getArgumentNode());
    }
   
  }
View Full Code Here

  //  UserData
  ////////////////////////////////////////////////

  private ActionData getActionData()
  {
    Node node = getActionNode();
    ActionData userData = (ActionData)node.getUserData();
    if (userData == null) {
      userData = new ActionData();
      node.setUserData(userData);
      userData.setNode(node);
    }
    return userData;
  }
View Full Code Here

   * @author Stefano "Kismet" Lenzi - kismet-sl@users.sourceforge.net  - 2005
   */
  public AllowedValue(String value) {

    //TODO Some test are done not stable
    allowedValueNode = new Node(ELEM_NAME); //better (twa)
    setValue(value);            //better (twa)
  }
View Full Code Here

        String image = "PNG";
        assertNull(icon.getBytes());
        icon.setBytes(image.getBytes());
        assertNotNull(icon.getBytes());
       
        Device dev = new Device(new Node());
        assertFalse(dev.isIconBytesURI(url));
        assertNull(dev.getIconByURI(url));
        IconList iconList = dev.getIconList();
        assertEquals(iconList.size(), 0);
       
View Full Code Here

        return new TestSuite( NodeTest.class );
    }

    public void testSetChildNode()
    {
      Node parentNode = new Node();
      String childNodeName;
      String childNodeValue;
      Node childNode;
     
      assertEquals(0, parentNode.getNNodes());
     
      childNodeName = "cnode1";
      childNodeValue = "cvalue1";
     
      parentNode.setNode(childNodeName, childNodeValue);
      assertTrue(parentNode.hasNode(childNodeName));
      assertEquals(1, parentNode.getNNodes());
      childNode = parentNode.getNode(childNodeName);
      assertNotNull(childNode);
      assertEquals(childNodeName, childNode.getName());
      assertEquals(childNodeValue, childNode.getValue());
     
      parentNode.setNode(childNodeName);
      assertTrue(parentNode.hasNode(childNodeName));
      assertEquals(1, parentNode.getNNodes());
      childNode = parentNode.getNode(childNodeName);
      assertNotNull(childNode);
      assertEquals(childNodeName, childNode.getName());
      assertEquals(childNodeValue, childNode.getValue());
     
      childNodeName = "cnode2";
      childNodeValue = "cvalue2";
     
      parentNode.setNode(childNodeName);
      assertTrue(parentNode.hasNode(childNodeName));
      assertEquals(2, parentNode.getNNodes());
      childNode = parentNode.getNode(childNodeName);
      assertNotNull(childNode);
      assertEquals(childNodeName, childNode.getName());
     
      parentNode.setNode(childNodeName, childNodeValue);
      assertTrue(parentNode.hasNode(childNodeName));
      assertEquals(2, parentNode.getNNodes());
      childNode = parentNode.getNode(childNodeName);
      assertNotNull(childNode);
      assertEquals(childNodeName, childNode.getName());
      assertEquals(childNodeValue, childNode.getValue());
    }
View Full Code Here

      assertEquals(childNodeName, childNode.getName());
      assertEquals(childNodeValue, childNode.getValue());
    }

    public void testEquals() {
      Node node1 = new Node();
      Node node2 = new Node();

      assertTrue(node1.equals(node2));
      assertTrue(node2.equals(node1));
      assertFalse(node1.equals(null));
      assertFalse(node2.equals(null));

      String nodeName = "node";
      String nodeValue = "value";
     
      node1.setName(nodeName);
      assertFalse(node1.equals(node2));
      assertFalse(node2.equals(node1));

      node1.setValue(nodeValue);
      assertFalse(node1.equals(node2));
      assertFalse(node2.equals(node1));

      node2.setName(nodeName);
      assertFalse(node1.equals(node2));
      assertFalse(node2.equals(node1));

      node2.setValue(nodeValue);
      assertTrue(node1.equals(node2));
      assertTrue(node2.equals(node1));
    }
View Full Code Here

TOP

Related Classes of org.cybergarage.xml.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.