Examples of MarkupElement


Examples of org.apache.wicket.markup.MarkupElement

      };

      ComponentTag tag = new ComponentTag(htmlVoidElement, XmlTag.TagType.OPEN_CLOSE);
      expander.onComponentTag(tag);

      MarkupElement markupElement = expander.nextElement();

      // assert the next element is returned by the parent
      assertTrue(markupElement instanceof TestMarkupElement);
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

    ComponentTag tag = new ComponentTag(HtmlHeaderResolver.HEADER_ITEMS, XmlTag.TagType.OPEN_CLOSE);
    tag.setNamespace(namespace);
    expander.onComponentTag(tag);

    MarkupElement markupElement = expander.nextElement();

    assertThat(markupElement, CoreMatchers.instanceOf(WicketTag.class));
    assertTrue(markupElement.closes(tag));
    assertEquals(namespace, ((ComponentTag) markupElement).getNamespace());
  }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

      tag = null;
    }

    while (markupStream.hasMore())
    {
      final MarkupElement cursor = markupStream.next();

      if (cursor.closes(parent))
      {
        // parent close tag found, we are done
        break;
      }

      if (tag != null && cursor.closes(tag))
      {
        // child tag is closed, next tag is either parent-close or next direct child
        tag = null;
      }
      else if (tag == null && cursor instanceof ComponentTag)
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

  @Override
  public void postProcess(Markup markup)
  {
    for (int i = 0; i < markup.size(); i++)
    {
      MarkupElement elem = markup.get(i);
      if (elem instanceof ComponentTag)
      {
        ComponentTag open = (ComponentTag)elem;
        if (open.getUserData("STYLE_OR_SCRIPT") != null)
        {
          if (open.isOpen() && ((i + 2) < markup.size()))
          {
            MarkupElement body = markup.get(i + 1);
            MarkupElement tag2 = markup.get(i + 2);

            if ((body instanceof RawMarkup) && (tag2 instanceof ComponentTag))
            {
              ComponentTag close = (ComponentTag)tag2;
              if (close.closes(open))
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

  public MarkupElement nextElement() throws ParseException
  {
    // Did we hold back an elem? Than return that first
    if (next != null)
    {
      MarkupElement rtn = next;
      next = null;
      return rtn;
    }

    return super.nextElement();
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

    IMarkupFragment markup = getMarkup();
    if (markup != null)
    {
      for (int i = 0; i < markup.size(); i++)
      {
        MarkupElement elem = markup.get(i);
        if (elem instanceof ComponentTag)
        {
          return (ComponentTag)elem;
        }
      }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

    MarkupStream markupStream = new MarkupStream(markup);

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

    MarkupElement elem = markup.get(0);
    if (elem instanceof ComponentTag)
    {
      // Guarantee that the markupStream is set and determineVisibility not yet tested
      // See WICKET-2049
      ((ComponentTag)elem).onBeforeRender(this, markupStream);
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

  {
    // 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);
    }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

   * @return true, if element was rendered as RawMarkup
   */
  protected final boolean renderNext(final MarkupStream markupStream)
  {
    // Get the current markup element
    final MarkupElement element = markupStream.get();

    // If it's a tag like <wicket..> or <span wicket:id="..." >
    if ((element instanceof ComponentTag) && !markupStream.atCloseTag())
    {
      // Get element as tag
      final ComponentTag tag = (ComponentTag)element;

      // Get component id
      final String id = tag.getId();

      // Get the component for the id from the given container
      Component component = get(id);
      if (component == null)
      {
        component = ComponentResolvers.resolve(this, markupStream, tag, null);
        if ((component != null) && (component.getParent() == null))
        {
          autoAdd(component, markupStream);
        }
      }

      // Failed to find it?
      if (component != null)
      {
        component.render();
      }
      else if (tag.getFlag(ComponentTag.RENDER_RAW))
      {
        // No component found, but "render as raw markup" flag found
        getResponse().write(element.toCharSequence());
        return true;
      }
      else
      {
        if (tag instanceof WicketTag)
        {
          if (((WicketTag)tag).isChildTag())
          {
            markupStream.throwMarkupException("Found " + tag.toString() +
              " but no <wicket:extend>");
          }
          else
          {
            markupStream.throwMarkupException("Failed to handle: " +
              tag.toString() +
              ". It might be that no resolver has been registered to handle this special tag. " +
              " But it also be that you declared wicket:id=" + id +
              " in your markup, but that you either did not add the " +
              "component to your page at all, or that the hierarchy does not match.");
          }
        }

        // No one was able to handle the component id
        markupStream.throwMarkupException("Unable to find component with id '" + id +
          "' in " + this + ". This means that you declared wicket:id=" + id +
          " in your markup, but that you either did not add the " +
          "component to your page at all, or that the hierarchy does not match.");
      }
    }
    else
    {
      // Render as raw markup
      getResponse().write(element.toCharSequence());
      return true;
    }

    return false;
  }
View Full Code Here

Examples of org.apache.wicket.markup.MarkupElement

      boolean rawMarkup = renderNext(markupStream);

      // Go back to where we were and move the markup stream forward to whatever the next
      // element is.
      markupStream.setCurrentIndex(index);
      MarkupElement elem = markupStream.get();
      if (rawMarkup)
      {
        markupStream.next();
      }
      else if (!markupStream.getTag().isClose())
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.