Example usage for com.vaadin.ui Grid removeColumn

List of usage examples for com.vaadin.ui Grid removeColumn

Introduction

In this page you can find the example usage for com.vaadin.ui Grid removeColumn.

Prototype

public void removeColumn(String columnId) 

Source Link

Document

Removes the column with the given column id.

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.common.gridfactory.impl.GridFactoryImpl.java

License:Apache License

/**
 * Configure column orders and hidden fields.
 *
 * @param columnOrder//  w  ww. j a  v a2s .  c o  m
 *            the column order
 * @param hideColumns
 *            the hide columns
 * @param grid
 *            the grid
 */
private static void configureColumnOrdersAndHiddenFields(final Object[] columnOrder, final Object[] hideColumns,
        final Grid grid) {
    if (columnOrder != null) {
        grid.setColumnOrder(columnOrder);
    }

    if (hideColumns != null) {
        for (final Object o : hideColumns) {
            grid.removeColumn(o);
        }
    }
}

From source file:probe.com.view.core.MultiSelectionTable.java

/**
 *
 *//*from ww  w  . java  2 s . c  om*/

public MultiSelectionTable() {
    setSpacing(true);
    // Set up combo boxes with possible values         
    setWidth(100, Unit.PERCENTAGE);
    // Editor is not enabled when
    setEnabled(false);

    Indexed datares = new BeanContainer(null);

    // Create new Grid with BeanItemContainer filled with BugEntries
    Grid grid = new Grid(datares);
    grid.setSizeFull();

    // Hide the "changed" property
    grid.removeColumn("changed");

    // Activate multi selection mode
    grid.setSelectionMode(SelectionMode.MULTI);

    // Add a rowstyle generator to display recently changed items.
    // Also uses another style for closed entries
    grid.setRowStyleGenerator(new RowStyleGenerator() {

        @Override
        public String getStyle(RowReference rowReference) {
            Item item = rowReference.getItem();
            boolean closed = item.getItemProperty("status").getValue() == Status.CLOSED;
            boolean changed = (Boolean) item.getItemProperty("changed").getValue();
            if (closed) {
                if (changed) {
                    // Combined style
                    return "changed closed";
                }
                // Closed style
                return "closed";
            } else if (changed) {
                // Modified style
                return "changed";
            }
            // No style
            return null;
        }
    });

    // Make Editor listen to changes in the selection of this Grid
    grid.addSelectionListener(this);

}