Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.MarkupStream


   * render() does seem to work, it will fail for panel children.
   */
  public final void render()
  {
    // Allow currently invisible components to be re-rendered as well
    MarkupStream markupStream = null;
    if (getParent() != null)
    {
      markupStream = findMarkupStream();
    }

View Full Code Here


    }
    else
    {
      // Save the parent's markup stream to re-assign it at the end
      MarkupContainer parent = getParent();
      MarkupStream originalMarkupStream = parent.getMarkupStream();
      MarkupStream markupStream = locateMarkupStream();

      try
      {
        // Make sure that while rendering the markup stream is found
        parent.setMarkupStream(markupStream);
View Full Code Here

        // <wicket:head> components are handled differently. We can
        // not use the container, because it is the container the
        // header has been added to (e.g. the Page). What we need
        // however, is the component (e.g. a Panel) which
        // contributed it.
        MarkupStream markupStream = new MarkupStream(container.getMarkup());
        Class<? extends Component> clazz = markupStream.getContainerClass();

        // However if the markup stream is a merged markup stream (inheritance), than we
        // need the class of the markup file which contained the tag.
        if ((markupStream.get() instanceof ComponentTag) &&
          (markupStream.getTag().getMarkupClass() != null))
        {
          clazz = markupStream.getTag().getMarkupClass();
        }

        // Create the component implementing the link
        ResourceReferenceAutolink autoLink = new ResourceReferenceAutolink(autoId, clazz,
          pathInfo.reference, attribute, container);
View Full Code Here

        if (container.getParent() != null)
        {
          parentWithContainer = container.findParentWithAssociatedMarkup();
        }
        if ((parentWithContainer instanceof Page) && !pathInfo.path.startsWith("/") &&
          new MarkupStream(page.getMarkup()).isMergedMarkup())
        {
          Class<? extends Page> clazz = (Class<? extends Page>)new MarkupStream(
            container.getMarkup()).getTag().getMarkupClass();
          if (clazz != null)
          {
            // Href is relative. Resolve the url given relative to
            // the current page
View Full Code Here

      if ((parentMarkup != null) && (markup != parentMarkup))
      {
        // The component's markup must be in the same file as its parent
        if (markup.getMarkupResourceStream() == parentMarkup.getMarkupResourceStream())
        {
          MarkupStream stream = new MarkupStream(markup);
          stream.skipUntil(ComponentTag.class);
          ComponentTag openTag = stream.getTag();
          if (openTag != null)
          {
            MarkupStream parentStream = new MarkupStream(parentMarkup);
            if (parentStream.skipUntil(ComponentTag.class))
            {
              parentStream.next();
            }

            Stack<ComponentTag> stack = new Stack<ComponentTag>();
            while (parentStream.skipUntil(ComponentTag.class))
            {
              ComponentTag tag = parentStream.getTag();
              if (openTag == tag)
              {
                if (stack.isEmpty() == false)
                {
                  // This tag belong to the real parent
                  final ComponentTag lastTag = stack.pop();
                  parent.visitChildren(MarkupContainer.class,
                    new IVisitor<MarkupContainer, Void>()
                    {
                      public void component(final MarkupContainer component,
                        final IVisit<Void> visit)
                      {
                        IMarkupFragment m = component.getMarkup();
                        MarkupStream ms = new MarkupStream(m);
                        ms.skipUntil(ComponentTag.class);
                        if (ms.hasMore() && (lastTag == ms.getTag()))
                        {
                          component.add(Component.this);
                          visit.stop();
                        }
                      }
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 stated 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

   *         we ask this component's parent to search for it.
   * @TODO can be removed in 1.5
   */
  protected final MarkupStream findMarkupStream()
  {
    return new MarkupStream(getMarkup());
  }
View Full Code Here

  /**
   * @return Component's markup stream
   */
  protected MarkupStream locateMarkupStream()
  {
    return new MarkupStream(getMarkup());
  }
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

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.