Package org.apache.wicket.markup.parser

Examples of org.apache.wicket.markup.parser.XmlTag$TextSegment


   * Test that a null model does not throw null pointers.
   */
  public void testNullModel()
  {
    AttributeModifier modifier = new AttributeModifier("test", null);
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("foo");
    tag.setName("test");
    modifier.replaceAttributeValue(null, tag);
    Map<String, Object> attributes = tag.getAttributes();
View Full Code Here


            protected String newValue(String currentValue, String replacementValue)
      {
        return "the replacement";
      }
    };
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    modifier.replaceAttributeValue(null, tag);
    Map<String,Object> attributes = tag.getAttributes();
View Full Code Here

   */
  public void testModelReplacement()
  {
    AttributeModifier modifier = new AttributeModifier("test", true, new Model<String>(
        "Ellioth Smith Rocks"));
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    modifier.replaceAttributeValue(null, tag);
    Map<String,Object> attributes = tag.getAttributes();
View Full Code Here

   */
  public void testNoModelReplacementForNonExistingAttributeValue()
  {
    AttributeModifier modifier = new AttributeModifier("test", false, new Model<String>(
        "Ellioth Smith Rocks"));
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    modifier.replaceAttributeValue(null, tag);
    Map<String, Object> attributes = tag.getAttributes();
View Full Code Here

   */
  public MarkupElement nextTag() throws ParseException
  {
    // Get the next tag from the markup.
    // If null, no more tags are available
    XmlTag xmlTag = (XmlTag)getParent().nextTag();
    if (xmlTag == null)
    {
      return xmlTag;
    }

    final String namespace = markup.getWicketNamespace();

    // Identify tags with Wicket namespace
    ComponentTag tag;
    if (namespace.equalsIgnoreCase(xmlTag.getNamespace()))
    {
      // It is <wicket:...>
      tag = new WicketTag(xmlTag);

      // Make it a Wicket component. Otherwise it would be RawMarkup
      tag.setId("_" + tag.getName());
      tag.setAutoComponentTag(true);
      tag.setModified(true);

      // If the tag is not a well-known wicket namespace tag
      if (!isWellKnown(xmlTag))
      {
        // give up
        throw new ParseException("Unknown tag name with Wicket namespace: '" +
          xmlTag.getName() +
          "'. Might be you haven't installed the appropriate resolver?", tag.getPos());
      }
    }
    else
    {
View Full Code Here

      // Pop any simple tags off the top of the stack
      if (requiresOpenBodyCloseTag(name))
      {
        tag.setType(XmlTag.OPEN);
        XmlTag closeTag = new XmlTag();
        closeTag.setType(XmlTag.CLOSE);
        closeTag.setName(tag.getName());
        closeTag.setNamespace(tag.getNamespace());
        closeTag.closes(tag);

        stack.push(new ComponentTag(closeTag));
      }
    }
View Full Code Here

   * Test that the current attribute is overwritten by the one that the model provides.
   */
  public void testModelReplacementOverwritingExistingAttributeValue()
  {
    AttributeModifier modifier = new AttributeModifier("test", new Model<String>("Ellioth Smith Rocks"));
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    Map<String,Object> attributes = tag.getAttributes();
    attributes.put("test", "My mother rocks");
View Full Code Here

   */
  public void testNoNewValueWhenNotEnabled()
  {
    AttributeModifier modifier = new AttributeModifier("test", new Model<String>("Ellioth Smith Rocks"));
    modifier.setEnabled(false);
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    Map<String,Object> attributes = tag.getAttributes();
    attributes.put("test", "My mother rocks");
View Full Code Here

            protected String newValue(String currentValue, String replacementValue)
      {
        return replacementValue + " together";
      }
    };
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    modifier.replaceAttributeValue(null, tag);
    Map<String,Object> attributes = tag.getAttributes();
View Full Code Here

            protected String newValue(String currentValue, String replacementValue)
      {
        return currentValue + " two";
      }
    };
    XmlTag xmlTag = new XmlTag();
    ComponentTag tag = new ComponentTag(xmlTag);
    tag.setId("test");
    tag.setName("id");
    Map<String,Object> attributes = tag.getAttributes();
    attributes.put("test", "one");
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.parser.XmlTag$TextSegment

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.