Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.MarkupStream


   */
  @Override
  protected void onRender()
  {
    // Loop through the markup in this container
    MarkupStream markupStream = new MarkupStream(getMarkup());
    renderAll(markupStream, null);
  }
View Full Code Here


    {
      throw new MarkupNotFoundException("Markup not found for Component: " + toString());
    }

    // MarkupStream is an Iterator for the markup
    MarkupStream markupStream = new MarkupStream(markup);

    // Flag: we started the render process
    markRendering(true);

    MarkupElement elem = markup.get(0);
View Full Code Here

    if (markup == null)
    {
      throw new MarkupException("Markup not found. Component: " + toString());
    }

    final MarkupStream markupStream = new MarkupStream(markup);

    // Get mutable copy of next tag
    final ComponentTag openTag = markupStream.getTag();
    final ComponentTag tag = openTag.mutable();

    // Call any tag handler
    onComponentTag(tag);

    // If we're an openclose tag
    if (!tag.isOpenClose() && !tag.isOpen())
    {
      // We were something other than <tag> or <tag/>
      markupStream.throwMarkupException("Method renderComponent called on bad markup element: " +
        tag);
    }

    if (tag.isOpenClose() && openTag.isOpen())
    {
      markupStream.throwMarkupException("You can not modify a open tag to open-close: " + tag);
    }

    try
    {
      // Render open tag
      if (getRenderBodyOnly() == false)
      {
        renderComponentTag(tag);
      }
      markupStream.next();

      // Render the body only if open-body-close. Do not render if open-close.
      if (tag.isOpen())
      {
        // Render the body. The default strategy will simply call the component's
View Full Code Here

            .append(isVersioned());
        }

        if (markup != null)
        {
          buffer.append(", markup = ").append(new MarkupStream(getMarkup()).toString());
        }
      }

      buffer.append(']');
View Full Code Here

   * @return The markup stream for this component. Since a Component cannot have a markup stream,
   *         we ask this component's parent to search for it.
   */
  protected final MarkupStream findMarkupStream()
  {
    return new MarkupStream(getMarkup());
  }
View Full Code Here

  {
    // Skip the body markup making sure it contains only raw markup
    super.onComponentTagBody(component, markupStream, openTag);

    // Get the fragments open tag
    MarkupStream stream = new MarkupStream(getMarkup((MarkupContainer)component, null));
    ComponentTag fragmentOpenTag = stream.getTag();

    // if it is an open close tag, skip this fragment.
    if (!fragmentOpenTag.isOpenClose())
    {
      // We'll completely ignore the fragments open tag. It'll not be rendered
      stream.next();

      // Render the body of the fragment
      component.onComponentTagBody(stream, fragmentOpenTag);
    }
  }
View Full Code Here

        markupStream.skipRawMarkup();
      }

      // Get the <span wicket:id="myBorder"> markup and render that instead
      IMarkupFragment markup = Border.this.getMarkup();
      MarkupStream stream = new MarkupStream(markup);
      ComponentTag tag = stream.getTag();
      stream.next();

      super.onComponentTagBody(stream, tag);
    }
View Full Code Here

     */
    private final IMarkupFragment findByName(final IMarkupFragment markup, final String name)
    {
      Args.notEmpty(name, "name");

      MarkupStream stream = new MarkupStream(markup);

      // Skip any raw markup
      stream.skipUntil(ComponentTag.class);

      // Skip <wicket:border>
      stream.next();

      while (stream.skipUntil(ComponentTag.class))
      {
        ComponentTag tag = stream.getTag();
        if (tag.isOpen() || tag.isOpenClose())
        {
          if (TagUtils.isWicketBodyTag(tag))
          {
            return stream.getMarkupFragment();
          }
        }

        stream.next();
      }

      return null;
    }
View Full Code Here

   * @param markup
   * @return null, if not found
   */
  private final IMarkupFragment findStartTag(final IMarkupFragment markup)
  {
    MarkupStream stream = new MarkupStream(markup);

    while (stream.skipUntil(ComponentTag.class))
    {
      ComponentTag tag = stream.getTag();
      if (tag.isOpen() || tag.isOpenClose())
      {
        if (tag instanceof WicketTag)
        {
          WicketTag wtag = (WicketTag)tag;
          if (tagName.equalsIgnoreCase(wtag.getName()))
          {
            return stream.getMarkupFragment();
          }
        }

        stream.skipToMatchingCloseTag(tag);
      }

      stream.next();
    }

    return null;
  }
View Full Code Here

    // Get the associated markup
    IMarkupFragment markup = container.getAssociatedMarkup();
    IMarkupFragment childMarkup = null;

    // MarkupStream is good at searching markup
    MarkupStream stream = new MarkupStream(markup);
    while (stream.skipUntil(ComponentTag.class) && (childMarkup == null))
    {
      ComponentTag tag = stream.getTag();
      if (TagUtils.isWicketHeadTag(tag))
      {
        if (tag.getMarkupClass() == null)
        {
          // find() can still fail an return null => continue the search
          childMarkup = stream.getMarkupFragment().find(child.getId());
        }
      }
      else if (TagUtils.isHeadTag(tag))
      {
        // find() can still fail an return null => continue the search
        childMarkup = stream.getMarkupFragment().find(child.getId());
      }

      // Must be a direct child. We are not interested in grand children
      if (tag.isOpen() && !tag.hasNoCloseTag())
      {
        stream.skipToMatchingCloseTag(tag);
      }
      stream.next();
    }

    return childMarkup;
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.MarkupStream

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.