Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.MarkupStream


   * @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


   * @deprecated Use findMarkupStream() instead.
   */
  @Deprecated
  protected MarkupStream locateMarkupStream()
  {
    return new MarkupStream(getMarkup());
  }
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

    // reset for each render in case the strategy is re-used
    noMoreWicketHeadTagsAllowed = false;

    // Gracefully getAssociateMarkupStream. Throws no exception in case
    // markup is not found
    final MarkupStream markupStream = container.getAssociatedMarkupStream(false);
    if (markupStream == null)
    {
      return;
    }

    // Position pointer at current (first) header
    noMoreWicketHeadTagsAllowed = false;
    while (nextHeaderMarkup(markupStream) != -1)
    {
      // found <wicket:head>
      String headerId = getHeaderId(container, markupStream);

      // Create a HeaderPartContainer and associate the markup
      HeaderPartContainer headerPart = getHeaderPart(container, headerId,
        markupStream.getMarkupFragment());
      if (headerPart != null)
      {
        // A component's header section must only be added once,
        // no matter how often the same Component has been added
        // to the page or any other container in the hierarchy.
        if (htmlContainer.okToRenderComponent(headerPart.getScope(), headerPart.getId()))
        {
          // make sure the Page is accessible
          headerPart.setParent(htmlContainer);
          headerPart.render();
        }
      }

      // Position the stream after <wicket:head>
      markupStream.skipComponent();
    }
  }
View Full Code Here

    IMarkupFragment markup = getAssociatedMarkup();

    // If we found markup for this container
    if (markup != null)
    {
      return new MarkupStream(markup);
    }

    if (throwException == true)
    {
      // throw exception since there is no associated markup
View Full Code Here

   *            message that will be used for exceptions
   */
  public final void renderAssociatedMarkup(final String openTagName, final String exceptionMessage)
  {
    // Get associated markup file for the Border or Panel component
    final MarkupStream associatedMarkupStream = new MarkupStream(getMarkup(null));

    // Get open tag in associated markup of border component
    MarkupElement elem = associatedMarkupStream.get();
    if ((elem instanceof ComponentTag) == false)
    {
      associatedMarkupStream.throwMarkupException("Expected the open tag. " +
        exceptionMessage);
    }

    // Check for required open tag name
    ComponentTag associatedMarkupOpenTag = (ComponentTag)elem;
    if (!(associatedMarkupOpenTag.isOpen() && (associatedMarkupOpenTag instanceof WicketTag)))
    {
      associatedMarkupStream.throwMarkupException(exceptionMessage);
    }

    try
    {
      setIgnoreAttributeModifier(true);
      renderComponentTag(associatedMarkupOpenTag);
      associatedMarkupStream.next();

      String className = null;

      final boolean outputClassName = getApplication().getDebugSettings()
        .isOutputMarkupContainerClassName();
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 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

  private static boolean compareMarkup(final String a, final String b)
  {
    try
    {
      // Parse a and b into markup and compare
      final MarkupStream amarkup = new MarkupStream(new MarkupParser(a).parse());
      final MarkupStream bmarkup = new MarkupStream(new MarkupParser(b).parse());
      return amarkup.equalTo(bmarkup);
    }
    catch (IOException e)
    {
      log.error(e.getMessage(), e);
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.