Example usage for org.apache.wicket.markup.html.list AbstractItem setRenderBodyOnly

List of usage examples for org.apache.wicket.markup.html.list AbstractItem setRenderBodyOnly

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.list AbstractItem setRenderBodyOnly.

Prototype

public final Component setRenderBodyOnly(final boolean renderTag) 

Source Link

Document

If false the component's tag will be printed as well as its body (which is default).

Usage

From source file:net.unbewaff.wicketcrudr.components.StyledHeadersToolbar.java

License:Apache License

/**
 * Constructor//from  ww w  .  j a  v  a2  s  .c  o  m
 *
 * @param <T>
 *            the column data type
 * @param table
 *            data table this toolbar will be attached to
 * @param stateLocator
 *            locator for the ISortState implementation used by sortable
 *            headers
 */
public <T> StyledHeadersToolbar(final DataTable<T> table, final ISortStateLocator stateLocator) {
    super(table);

    RepeatingView headers = new RepeatingView("headers");
    add(headers);

    final List<IColumn<T>> columns = table.getColumns();
    for (final IColumn<T> column : columns) {
        AbstractItem item = new AbstractItem(headers.newChildId());
        headers.add(item);

        WebMarkupContainer header = null;
        if (column.isSortable()) {
            header = newSortableHeader("header", column.getSortProperty(), stateLocator);
        } else {
            header = new WebMarkupContainer("header");
        }

        if (column instanceof IMultipleStyledColumn) {
            AttributeAppender classAppender = new AttributeAppender("class",
                    ((IMultipleStyledColumn<?>) column).getCssClassForHeader()).setSeparator(" ");

            header.add(classAppender);
        } else if (column instanceof IStyledColumn) {
            AttributeAppender classAppender = new AttributeAppender("class",
                    ((IStyledColumn<?>) column).getCssClass()).setSeparator(" ");

            header.add(classAppender);
        }

        item.add(header);
        item.setRenderBodyOnly(true);
        header.add(column.getHeader("label"));
    }
}