/** * @param that * The markup to compare with * @return True if the two markups are equal */ public boolean equalTo(final Markup that) { final MarkupStream thisStream = new MarkupStream(this); final MarkupStream thatStream = new MarkupStream(that); // Compare the streams return thisStream.equalTo(thatStream); }
/** * @param that * The markup to compare with * @return True if the two markups are equal */ public boolean equalTo(final Markup that) { final MarkupStream thisStream = new MarkupStream(this); final MarkupStream thatStream = new MarkupStream(that); // Compare the streams return thisStream.equalTo(thatStream); }
/** * Finds the markup stream for this component. * * @return The markup stream for this component. Since a Component cannot have a markup stream, * we ask this component's parent to search for it. */ protected final MarkupStream findMarkupStream() { return new MarkupStream(getMarkup()); }
/** * Finds the markup stream for this component. * * @return The markup stream for this component. Since a Component cannot have a markup stream, * we ask this component's parent to search for it. */ protected final MarkupStream findMarkupStream() { return new MarkupStream(getMarkup()); }
/** * Handle tag <body> */ private void handleBodyTag() { // 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) { insertHeadTag(); } // <head> must always be before <body> ignoreTheRest = true; }
/** * Handle tag <body> */ private void handleBodyTag() { // 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) { insertHeadTag(); } // <head> must always be before <body> ignoreTheRest = true; }
/** * Construct. * * @param markup * @param message * @param cause */ public MarkupException(final Markup markup, final String message, final Throwable cause) { this(new MarkupStream(markup).setCurrentIndex(markup.size() - 1), message, cause); }
@Override protected void onRender() { // Loop through the markup in this container MarkupStream markupStream = new MarkupStream(getMarkup()); renderAll(markupStream, null); }
/** * Construct. * * @param markup * @param message * @param cause */ public MarkupException(final Markup markup, final String message, final Throwable cause) { this(new MarkupStream(markup).setCurrentIndex(markup.size() - 1), message, cause); }
/** * {@inheritDoc} */ @Override public ComponentTag getComponentTag(Component c) { IMarkupFragment markup = c.getMarkup(); MarkupStream stream = new MarkupStream(markup); return stream.getTag(); }
@Override protected void onRender() { // Loop through the markup in this container MarkupStream markupStream = new MarkupStream(getMarkup()); renderAll(markupStream, null); }
/** * {@inheritDoc} */ @Override public ComponentTag getComponentTag(Component c) { IMarkupFragment markup = c.getMarkup(); MarkupStream stream = new MarkupStream(markup); return stream.getTag(); }
/** * Handle tag <wicket:header-items> * * @param tag */ private void handleHeaderItemsTag(ComponentTag tag) { if ((tag.isOpen() || tag.isOpenClose()) && 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); tag.setAutoComponentFactory(HTML_HEADER_ITEMS_FACTORY); }
/** * Handle tag <wicket:header-items> * * @param tag */ private void handleHeaderItemsTag(ComponentTag tag) { if ((tag.isOpen() || tag.isOpenClose()) && 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); tag.setAutoComponentFactory(HTML_HEADER_ITEMS_FACTORY); }
protected final Component getChild() { if (childComponent == null) { // try to find child when queued childComponent = resolveChild(this); } if (childComponent == null) { // try to find child when resolved childComponent = getChildComponent(new MarkupStream(getMarkup()), getEnclosureParent()); } return childComponent; }
protected final Component getChild() { if (childComponent == null) { // try to find child when queued childComponent = resolveChild(this); } if (childComponent == null) { // try to find child when resolved childComponent = getChildComponent(new MarkupStream(getMarkup()), getEnclosureParent()); } return childComponent; }
@Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { // skip the <wicket:body> body if (markupStream.getPreviousTag().isOpen()) { // Only RawMarkup is allowed within the preview region, // which gets stripped from output markupStream.skipRawMarkup(); } // Get the <span wicket:id="myBorder"> markup and render that instead IMarkupFragment markup = Border.this.getMarkup(); MarkupStream stream = new MarkupStream(markup); ComponentTag tag = stream.getTag(); stream.next(); super.onComponentTagBody(stream, tag); }
/** * Skip the body markup associated with the 'component'. The body markup is expected to be raw * markup only, not containing an wicket component. The body markup may serve documentary * purposes for the developer / designer. * <p> * Than search for the markup of the fragment, effectively replacing the original markup. */ @Override public void onComponentTagBody(final Component component, final MarkupStream markupStream, final ComponentTag openTag) { // 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); } }
@Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { // skip the <wicket:body> body if (markupStream.getPreviousTag().isOpen()) { // Only RawMarkup is allowed within the preview region, // which gets stripped from output markupStream.skipRawMarkup(); } // Get the <span wicket:id="myBorder"> markup and render that instead IMarkupFragment markup = Border.this.getMarkup(); MarkupStream stream = new MarkupStream(markup); ComponentTag tag = stream.getTag(); stream.next(); super.onComponentTagBody(stream, tag); }
/** * Skip the body markup associated with the 'component'. The body markup is expected to be raw * markup only, not containing an wicket component. The body markup may serve documentary * purposes for the developer / designer. * <p> * Than search for the markup of the fragment, effectively replacing the original markup. */ @Override public void onComponentTagBody(final Component component, final MarkupStream markupStream, final ComponentTag openTag) { // 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); } }