Examples of MarkupStream


Examples of org.apache.wicket.markup.MarkupStream

    // 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

Examples of org.apache.wicket.markup.MarkupStream

    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

Examples of org.apache.wicket.markup.MarkupStream

   *            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 != null) && 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

Examples of org.apache.wicket.markup.MarkupStream

  {
    // Markup must be available
    IMarkupFragment markup = getMarkup();
    if ((markup != null) && (markup.size() > 1))
    {
      MarkupStream stream = new MarkupStream(markup);

      // Skip the first component tag which already belongs to 'this' container
      if (stream.skipUntil(ComponentTag.class))
      {
        stream.next();
      }

      // Search for <wicket:xxx> in the remaining markup and try to resolve the component
      while (stream.skipUntil(ComponentTag.class))
      {
        ComponentTag tag = stream.getTag();
        if (tag.isOpen() || tag.isOpenClose())
        {
          if (tag instanceof WicketTag)
          {
            Component component = ComponentResolvers.resolve(this, stream, tag, null);
            if ((component != null) && (component.getParent() == null))
            {
              if (component.getId().equals(tag.getId()) == false)
              {
                // make sure we are able to get() the component during rendering
                tag.setId(component.getId());
                tag.setModified(true);
              }
              add(component);
            }
          }

          if (tag.isOpen())
          {
            stream.skipToMatchingCloseTag(tag);
          }
        }
        stream.next();
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupStream

          if (childMarkup != null && childMarkup.size() > 0)
          {
            IComponentResolver componentResolver = (IComponentResolver)resolvingContainer;

            MarkupStream stream = new MarkupStream(childMarkup);

            ComponentTag tag = stream.getTag();

            Component resolvedComponent = resolvingContainer.get(tag.getId());
            if (resolvedComponent == null)
            {
              resolvedComponent = componentResolver.resolve(resolvingContainer, stream, tag);
View Full Code Here

Examples of org.apache.wicket.markup.MarkupStream

  {
    // 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

Examples of org.apache.wicket.markup.MarkupStream

    {
      throw new MarkupException("Unable to get page markup: " + getPage().toString());
    }

    // Find the markup fragment
    MarkupStream stream = new MarkupStream(markup);
    IMarkupFragment headerMarkup = null;
    while (stream.skipUntil(ComponentTag.class) && (headerMarkup == null))
    {
      ComponentTag tag = stream.getTag();
      if (tag.isOpen() || tag.isOpenClose())
      {
        if (tag instanceof WicketTag)
        {
          WicketTag wtag = (WicketTag)tag;
          if (wtag.isHeadTag() || wtag.isHeaderItemsTag())
          {
            headerMarkup = stream.getMarkupFragment();
            break;
          }
        }
        else if (tag.getName().equalsIgnoreCase("head") && tag.isAutoComponentTag())
        {
          headerMarkup = stream.getMarkupFragment();
          break;
        }
      }

      stream.next();
    }

    setMarkup(headerMarkup);
    return headerMarkup;
  }
View Full Code Here

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

Examples of org.apache.wicket.markup.MarkupStream

    else if (HtmlHeaderResolver.HEADER_ITEMS.equalsIgnoreCase(tag.getName()) &&
        tag.getNamespace().equalsIgnoreCase(getWicketNamespace()))
    {
      if (foundHeaderItemsTag)
      {
        throw new MarkupException(new MarkupStream(markup),
            "More than one <wicket:header-items/> detected in the <head> element. Only one is allowed.");
      }
      else if (foundClosingHead)
      {
        throw new MarkupException(new MarkupStream(markup),
            "Detected <wicket:header-items/> after the closing </head> element.");
      }

      foundHeaderItemsTag = true;
      tag.setId(HEADER_ID);
      tag.setAutoComponentTag(true);
      tag.setModified(true);

      return tag;
    }
    else if (BODY.equalsIgnoreCase(tag.getName()) && (tag.getNamespace() == null))
    {
      // WICKET-4511: We found <body> inside <head> tag. Markup is not valid!
      if (foundHead && !foundClosingHead)
      {
        throw new MarkupException(new MarkupStream(markup),
          "Invalid page markup. Tag <BODY> found inside <HEAD>");
      }

      // We found <body>
      if (foundHead == false)
View Full Code Here

Examples of org.apache.wicket.markup.MarkupStream

    {
      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
TOP
Copyright © 2018 www.massapi.com. 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.