Example usage for org.apache.wicket.markup MarkupStream get

List of usage examples for org.apache.wicket.markup MarkupStream get

Introduction

In this page you can find the example usage for org.apache.wicket.markup MarkupStream get.

Prototype

public MarkupElement get(final int index) 

Source Link

Usage

From source file:com.servoy.j2db.server.headlessclient.dataui.SortableCellViewHeaders.java

License:Open Source License

private void renderSortableCellViewHeaderTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    renderColumnIdx = 0;/*w w w  .  ja  v  a 2s .c om*/
    headerMarkupStartIdx = markupStream.getCurrentIndex();
    orderedHeaders = view.getOrderedHeaders();
    orderedHeaderIds = view.getOrderedHeaderIds();

    if ((markupStream != null) && (markupStream.getCurrentIndex() > 0)) {
        // If the original tag has been changed from open-close to open-body-close,
        // than historically renderComponentTagBody gets called, but actually
        // it shouldn't do anything since there is no body for that tag.
        ComponentTag origOpenTag = (ComponentTag) markupStream.get(markupStream.getCurrentIndex() - 1);
        if (origOpenTag.isOpenClose()) {
            return;
        }
    }

    // If the open tag requires a close tag
    boolean render = openTag.requiresCloseTag();
    if (render == false) {
        // Tags like <p> do not require a close tag, but they may have.
        render = !openTag.hasNoCloseTag();
    }

    if (render == true) {
        // Loop through the markup in this container
        while (markupStream.hasMore() && !markupStream.get().closes(openTag)) {
            // Render markup element. Doing so must advance the markup
            // stream
            final int index = markupStream.getCurrentIndex();
            _renderNext(markupStream);
            if (index == markupStream.getCurrentIndex()) {
                markupStream.throwMarkupException(
                        "Markup element at index " + index + " failed to advance the markup stream"); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
    }
}

From source file:jp.xet.uncommons.wicket.gp.BookmarkableForm.java

License:Apache License

private void renderComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    if ((markupStream != null) && (markupStream.getCurrentIndex() > 0)) {
        ComponentTag origOpenTag = (ComponentTag) markupStream.get(markupStream.getCurrentIndex() - 1);
        if (origOpenTag.isOpenClose()) {
            return;
        }// w  w  w.  j a  v a 2s . c  om
    }
    boolean render = openTag.requiresCloseTag();
    if (render == false) {
        render = !openTag.hasNoCloseTag();
    }
    if (render == true) {
        renderAll(markupStream, openTag);
    }
}