Example usage for org.apache.wicket.markup.parser XmlTag put

List of usage examples for org.apache.wicket.markup.parser XmlTag put

Introduction

In this page you can find the example usage for org.apache.wicket.markup.parser XmlTag put.

Prototype

public Object put(final String key, final StringValue value) 

Source Link

Document

Puts a StringValue attribute.

Usage

From source file:org.wicketstuff.minis.apanel.GridLayout.java

License:Apache License

private void writeOutput(final StringBuilder stringBuilder) {
    stringBuilder.append("<table>");

    final GridConstraintIterator iterator = new GridConstraintIterator(constraintsMap.entrySet());
    while (iterator.hasNext()) {
        final Map.Entry<GridLayoutConstraint, Component> entry = iterator.next();
        final GridLayoutConstraint constraint = entry.getKey();
        final Component component = entry.getValue();

        CharSequence markup = "";
        if (component != EMPTY_CELL_COMPONENT) {
            final IComponentRenderer<Component> componentRenderer = renderersList
                    .findRendererForClass(component.getClass());
            markup = componentRenderer.getMarkup(component);
        }/*  w  w  w. j a v a 2s .c  om*/

        if (iterator.isNewRow())
            stringBuilder.append("</tr>");
        if (iterator.isNewRow() || iterator.isAtFirstConstraint()) {
            final XmlTag xmlTag = createXmlTag("tr", XmlTag.TagType.OPEN);
            onGridRow(xmlTag);
            stringBuilder.append(xmlTag.toCharSequence());
        }

        final XmlTag xmlTag = createXmlTag("td", XmlTag.TagType.OPEN);
        onGridCell(component, xmlTag);
        if (constraint.getColSpan() > 1)
            xmlTag.put("colspan", constraint.getColSpan());
        if (constraint.getRowSpan() > 1)
            xmlTag.put("rowspan", constraint.getRowSpan());
        stringBuilder.append(xmlTag.toCharSequence());

        stringBuilder.append(markup);

        stringBuilder.append("</td>");
    }

    stringBuilder.append("</tr>");
    stringBuilder.append("</table>");
}