List of usage examples for org.apache.wicket.markup MarkupStream MarkupStream
public MarkupStream(final IMarkupFragment markup)
From source file:com.aplombee.RepeaterUtil.java
License:Apache License
/** * {@inheritDoc}/*from ww w .ja v a 2 s .c o m*/ */ @Override public ComponentTag getComponentTag(Component c) { IMarkupFragment markup = c.getMarkup(); MarkupStream stream = new MarkupStream(markup); return stream.getTag(); }
From source file:com.servoy.j2db.server.headlessclient.WebForm.java
License:Open Source License
/** * @see org.apache.wicket.MarkupContainer#getAssociatedMarkupStream(boolean) *///from w w w .j av a2s .c om @Override public MarkupStream getAssociatedMarkupStream(boolean throwException) { if (markup == null) { markup = getApplication().getMarkupSettings().getMarkupCache().getMarkup(this, getClass(), false); } return new MarkupStream(markup); }
From source file:org.efaps.ui.wicket.components.AbstractParentMarkupContainer.java
License:Apache License
/** * @see org.apache.wicket.MarkupContainer#onRender(org.apache.wicket.markup.MarkupStream) *///from www. j a v a 2s .co m @Override public void onRender() { final IMarkupFragment markup = getMarkup(); final MarkupStream markupStream = new MarkupStream(markup); final int markupStart = markupStream.getCurrentIndex(); // Get mutable copy of next tag final ComponentTag openTag = markupStream.getTag(); final ComponentTag tag = openTag.mutable(); // Call any tag handler onComponentTag(tag); // Render open tag if (!getRenderBodyOnly()) { renderComponentTag(tag); } markupStream.next(); // Render the body only if open-body-close. Do not render if // open-close. if (tag.isOpen()) { // Render the body onComponentTagBody(markupStream, tag); } markupStream.setCurrentIndex(markupStart); final Iterator<?> childs = this.iterator(); while (childs.hasNext()) { markupStream.setCurrentIndex(markupStart); final Component child = (Component) childs.next(); child.rendered(); } markupStream.setCurrentIndex(markupStart); markupStream.next(); // Render close tag if (tag.isOpen()) { if (openTag.isOpen()) { // Get the close tag from the stream ComponentTag closeTag = markupStream.getTag(); // If the open tag had its id changed if (tag.isAutoComponentTag()) { // change the id of the close tag closeTag = closeTag.mutable(); closeTag.setName(tag.getName()); } // Render the close tag renderComponentTag(closeTag); markupStream.next(); } } }
From source file:org.efaps.ui.wicket.components.LabelComponent.java
License:Apache License
/** * Method is overwritten to prevent the annoing warnings from Component to come up. * The warning come up due to the reason that this component moves the tags from parent * element to its child./* w ww .j a v a 2s. c o m*/ */ @Override protected void onRender() { final IMarkupFragment markup = getMarkup(); 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); } markupStream.next(); getMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag); }