Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.ComponentTag


      if (contains(name))
      {
        if (onFound(tag))
        {
          next = new ComponentTag(tag.getName(), TagType.CLOSE);
          if (getWicketNamespace().equals(tag.getNamespace()))
          {
            next = new WicketTag(next);
          }
          next.setNamespace(tag.getNamespace());
View Full Code Here


  /**
   * @return The 'id' attribute from the associated markup tag
   */
  public final String getMarkupIdFromMarkup()
  {
    ComponentTag tag = getMarkupTag();
    if (tag != null)
    {
      String id = tag.getAttribute("id");
      if (Strings.isEmpty(id) == false)
      {
        return id.trim();
      }
    }
View Full Code Here

   *
   * @return markup attributes
   */
  public final ValueMap getMarkupAttributes()
  {
    ComponentTag tag = getMarkupTag();
    if (tag != null)
    {
      ValueMap attrs = new ValueMap(tag.getAttributes());
      attrs.makeImmutable();
      return attrs;
    }
    return ValueMap.EMPTY_MAP;
  }
View Full Code Here

    }

    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
        // onComponentTagBody() implementation.
        getMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag);

        // Render close tag
        if (openTag.isOpen())
        {
          renderClosingComponentTag(markupStream, tag, getRenderBodyOnly());
        }
        else if (getRenderBodyOnly() == false)
        {
          if (needToRenderTag(openTag))
          {
            // Close the manually opened tag. And since the user might have changed the
            // tag name ...
            getResponse().write(tag.syntheticCloseTagString());
          }
        }
      }
    }
    catch (WicketRuntimeException wre)
View Full Code Here

  protected final void replaceComponentTagBody(final MarkupStream markupStream,
    final ComponentTag tag, final CharSequence body)
  {
    // The tag might have been changed from open-close to open. Hence
    // we'll need what was in the markup itself
    ComponentTag markupOpenTag = null;

    // If tag has a body
    if (tag.isOpen())
    {
      // Get what tag was in the markup; not what the user it might
      // have changed it to.
      markupOpenTag = markupStream.getPreviousTag();

      // If it was an open tag in the markup as well, than ...
      if (markupOpenTag.isOpen())
      {
        // skip any raw markup in the body
        markupStream.skipRawMarkup();
      }
    }

    if (body != null)
    {
      // Write the new body
      getResponse().write(body);
    }

    // If we had an open tag (and not an openclose tag) and we found a
    // close tag, we're good
    if (tag.isOpen())
    {
      // If it was an open tag in the markup, than there must be
      // a close tag as well.
      if ((markupOpenTag != null) && markupOpenTag.isOpen() && !markupStream.atCloseTag())
      {
        // There must be a component in this discarded body
        markupStream.throwMarkupException("Expected close tag for '" + markupOpenTag +
          "' Possible attempt to embed component(s) '" + markupStream.get() +
          "' in the body of this component which discards its body");
View Full Code Here

          {
            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

    String namespace = markup.getMarkupResourceStream().getWicketNamespace() + ":";

    MarkupElement elem = markup.get(0);
    if (elem instanceof ComponentTag)
    {
      ComponentTag panelTag = (ComponentTag)elem;
      for (String key : panelTag.getAttributes().keySet())
      {
        // exclude "wicket:XX" attributes
        if (key.startsWith(namespace) == false)
        {
          tag.append(key, panelTag.getAttribute(key), ", ");
        }
      }
    }
    else
    {
View Full Code Here

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

          noMoreWicketHeadTagsAllowed = true;
        }
      }
      else if (elem instanceof ComponentTag)
      {
        ComponentTag tag = (ComponentTag)elem;
        // wicket:head must be before </head>
        // @TODO why??
        if (tag.isClose() && TagUtils.isHeadTag(tag))
        {
          noMoreWicketHeadTagsAllowed = true;
        }
        // wicket:head must be before <body>
        // @TODO why??
        else if (tag.isOpen() && TagUtils.isBodyTag(tag))
        {
          noMoreWicketHeadTagsAllowed = true;
        }
      }
      elem = associatedMarkupStream.next();
View Full Code Here

  {
    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 (wtag.isPanelTag())
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.ComponentTag

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.