Search in sources :

Example 1 with CellStyleGenerator

use of com.vaadin.ui.Grid.CellStyleGenerator in project VaadinUtils by rlsutton1.

the class GridHeadingV2PropertySet method addActionColumn.

@SuppressWarnings("unchecked")
private void addActionColumn() {
    ((GeneratedPropertyListContainer<E>) grid.getContainerDataSource()).addGeneratedProperty(ACTION_MENU_PROPERTY_ID, getActionMenuColumnGenerator());
    final Column actionMenuColumn = grid.addColumn(ACTION_MENU_PROPERTY_ID);
    grid.setFrozenColumnCount(1);
    actionMenuColumn.setHeaderCaption("");
    actionMenuColumn.setRenderer(new ComponentRenderer());
    actionMenuColumn.setWidth(40);
    actionMenuColumn.setResizable(false);
    grid.setCellStyleGenerator(new CellStyleGenerator() {

        /**
         */
        private static final long serialVersionUID = 1L;

        @Override
        public String getStyle(CellReference event) {
            String style = "";
            if (event.getPropertyId().equals(ACTION_MENU_PROPERTY_ID)) {
                style = "grid-actionmenu";
            }
            return style;
        }
    });
}
Also used : ComponentRenderer(de.datenhahn.vaadin.componentrenderer.ComponentRenderer) Column(com.vaadin.ui.Grid.Column) CellStyleGenerator(com.vaadin.ui.Grid.CellStyleGenerator) CellReference(com.vaadin.ui.Grid.CellReference) GeneratedPropertyListContainer(org.vaadin.viritin.grid.GeneratedPropertyListContainer)

Aggregations

CellReference (com.vaadin.ui.Grid.CellReference)1 CellStyleGenerator (com.vaadin.ui.Grid.CellStyleGenerator)1 Column (com.vaadin.ui.Grid.Column)1 ComponentRenderer (de.datenhahn.vaadin.componentrenderer.ComponentRenderer)1 GeneratedPropertyListContainer (org.vaadin.viritin.grid.GeneratedPropertyListContainer)1