Package org.exoplatform.services.token.attribute

Examples of org.exoplatform.services.token.attribute.Attributes


      node = NodePathUtil.lookFor(document.getRoot(), path);
      assertNotNull(node);

      //Gets all the attributes of the Node object in the HTML document.
      //simultaneously checks the existing of an Attribute of this Node.
      Attributes attributes = AttributeParser.getAttributes(node);
      assertEquals(attributes.get("size").getValue(), "4");

      //Removes an Attribute of a Node.
      //and then checks the existing of this Attribute in the attribute collection of the Node.
      attributes.remove("size");
      System.out.println(node.getTextValue());
      //assertNotNull(attributes.get("size"));  
   }
View Full Code Here


      System.out.println("NODE-NAME: " + node.getName());
      System.out.println("NODE-VALUE: " + new String(node.getValue()));
      System.out.println("NODE-TEXT VALUE: " + node.getTextValue());

      //Attributes.
      Attributes attrs = AttributeParser.getAttributes(node);
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }
      //Modify the value of an Atribute.
      System.out.println("\n\nModify: ");
      for (int j = 0; j < attrs.size(); j++)
      {
         if (attrs.get(j).getName().equals("caption"))
         {
            attrs.get(j).setValue("Sets a new Caption to the Table!");
            //attrs.set(attrs.get(j));
         }
         if (attrs.get(j).getName().equals("border"))
         {
            //System.out.println("\n\n\n\n= ===s=fsdf\n\n");
            //sysout
            attrs.get(j).setValue("0");
            //attrs.set(attrs.get(j));
         }
      }
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }

      //Add a new Attribute to the attribute collection of the Node.
      Attribute newAttr = new Attribute("bgcolor", "red");
      attrs.set(newAttr);
      assertEquals(newAttr.getName(), "bgcolor");
      assertEquals(newAttr.getValue(), "red");
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }

      //Clear (remove) an Attribute in the attribute collection of the Node.
      System.out.println("\n\nRemove:");
      assertEquals(true, attrs.contains(new Attribute("bgcolor", "red")));
      attrs.remove(new Attribute("bgcolor", "red"));
      assertNull(attrs.get("bgcolor"));
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }
      //Clear all the attributes of the Node.
      attrs.clear();
      assertEquals(true, attrs.isEmpty());
      //assertEquals(attrs,null);

      //Add a new Atribute collection to the Node.
      System.out.println("\n\nAdd:");
      List<Attribute> attrList = new ArrayList<Attribute>();
      attrList.add(new Attribute("caption", "New Table"));
      attrList.add(1, new Attribute("border", "2"));
      attrList.add(2, new Attribute("bgcolor", "blue"));
      assertEquals(true, attrs.addAll(0, attrList));
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }

      //Insert a new Attribute to the attribute collection of the Node.
      attrs.add(attrs.size() - 1, new Attribute("cellspacing", "2"));
      //assertEquals(attrs.get(attrs.size()-1),new Attribute("cellspacing","2"));
      assertNotNull(attrs.get(attrs.size() - 1));
      System.out.println("\n\nInsert:");
      for (Attribute attr : attrs)
      {
         System.out.println("NAME: " + attr.getName() + " & " + "VALUE: " + attr.getValue());
      }
View Full Code Here

      builder.append("name=\"hu query\" size=\"\'15\'\" maxlength=30\" ");
      builder.append("onmouseover=\"this.style.visibility='visible';\"");
      builder.append(" src='http://www.ddth.com/banners/trananh.gif='");

      node.setValue(builder.toString().toCharArray());
      Attributes attrs = AttributeParser.getAttributes(node);
      for (Attribute attr : attrs)
      {
         //assertEquals(attr.getName() + " : " + attr.getValue().toString(), builder.toString());
         //System.out.println(attr.getName()+" : "+attr.getValue());
         assertEquals(attr.getName() + " : " + attr.getValue(), attr.getName() + " : " + attr.getValue());
View Full Code Here

               // item.setLink(ele.getChild(0).getNodeValue());
               item.setLink(removeCData(ele.getChild(0).getNodeValue()));
            }
            else
            {
               Attributes attributes = AttributeParser.getAttributes(ele);
               // item.setLink(attributes.getAttributeValue("href"));
               item.setLink(removeCData(attributes.getAttributeValue("href")));
            }
         }
         else if ((ele.isNode("pubDate") || ele.isNode("issued")) && ele.getTotalChildren() > 0)
            item.setTime(removeCData(ele.getChild(0).getNodeValue().trim()));
         else if (ele.isNode("image") && ele.getTotalChildren() > 0)
View Full Code Here

      toXMLValue(clazz, object, node);
   }

   private void toXMLValue(Class<?> clazz, Object bean, XMLNode node) throws Exception
   {
      Attributes attrs = AttributeParser.getAttributes(node);
      for (Attribute attr : attrs)
      {
         Field field = getField(attr.getName(), clazz);
         if (field == null)
            continue;
View Full Code Here

      children.add(node);
   }

   private void setAttribute(XMLNode parent, String name, String value)
   {
      Attributes attrs = AttributeParser.getAttributes(parent);
      for (Attribute ele : attrs)
      {
         if (ele.getName().equals(name))
         {
            ele.setValue(value);
            return;
         }
      }
      Attribute attr = new Attribute(name, value);
      attrs.set(attr);
   }
View Full Code Here

      while (iter.hasNext())
      {
         String key = iter.next();
         if (!node.isNode(key))
            continue;
         Attributes attrs = AttributeParser.getAttributes(node);
         int idx = attrs.indexOf(map.get(key));
         if (idx < 0)
            continue;
         attr = attrs.get(idx);
         String value = attr.getValue();
         if (verifier != null && !verifier.verify(value))
            return;
         value = creator.createURL(home, value);
         attr.setValue(value);
         attrs.set(attr);
         return;
      }
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.token.attribute.Attributes

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.