Package org.apache.wicket.markup

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


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

      if (children_size() != 0)
      {
        buffer.append(", children = ");
View Full Code Here

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

  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)
    {
      e.printStackTrace();
View Full Code Here

  {
    // Configure response object with locale and content type
    configureResponse();

    // Loop through the markup in this container
    MarkupStream markupStream = new MarkupStream(getMarkup());
    renderAll(markupStream, null);
  }
View Full Code Here

    return new PanelMarkupSourcingStrategy()
    {
      @Override
      public IMarkupFragment getMarkup(final MarkupContainer parent, final Component child)
      {
        MarkupStream markup = parent.getAssociatedMarkupStream(true);
        markup.skipRawMarkup();
        return markup.getMarkupFragment();
      }

      @Override
      public void onComponentTagBody(Component component, MarkupStream markupStream,
        ComponentTag openTag)
View Full Code Here

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

            .append(isVersioned());
        }

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

      buffer.append(']');
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.