Search in sources :

Example 1 with PropertyValueGenerator

use of com.vaadin.data.util.PropertyValueGenerator in project VaadinUtils by rlsutton1.

the class GridHeadingV2PropertySet method getActionMenuColumnGenerator.

private PropertyValueGenerator<Component> getActionMenuColumnGenerator() {
    return new PropertyValueGenerator<Component>() {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public Component getValue(Item item, Object itemId, Object propertyId) {
            final Button actionMenuButton = new Button(FontAwesome.ELLIPSIS_H);
            actionMenuButton.addStyleName(ValoTheme.BUTTON_QUIET);
            actionMenuButton.addStyleName(ValoTheme.BUTTON_SMALL);
            final ButtonContextMenu<E> contextMenu = new ButtonContextMenu<>();
            actionMenuProvider.setup(contextMenu);
            contextMenu.setAsButtonContextMenu(actionMenuButton, (E) itemId);
            actionMenuButton.addClickListener(new ClickListener() {

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

                @Override
                public void buttonClick(ClickEvent event) {
                    contextMenu.openContext(event);
                }
            });
            return actionMenuButton;
        }

        @Override
        public Class<Component> getType() {
            return Component.class;
        }
    };
}
Also used : Item(com.vaadin.data.Item) PropertyValueGenerator(com.vaadin.data.util.PropertyValueGenerator) Button(com.vaadin.ui.Button) ButtonContextMenu(au.com.vaadinutils.fields.contextmenu.ButtonContextMenu) ClickEvent(com.vaadin.ui.Button.ClickEvent) Component(com.vaadin.ui.Component) ClickListener(com.vaadin.ui.Button.ClickListener)

Aggregations

ButtonContextMenu (au.com.vaadinutils.fields.contextmenu.ButtonContextMenu)1 Item (com.vaadin.data.Item)1 PropertyValueGenerator (com.vaadin.data.util.PropertyValueGenerator)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 Component (com.vaadin.ui.Component)1