Search in sources :

Example 1 with GridHeadingPropertySet

use of au.com.vaadinutils.crud.GridHeadingPropertySet in project VaadinUtils by rlsutton1.

the class TwinColumnSelect method createAvailableGrid.

@SuppressWarnings("deprecation")
protected void createAvailableGrid() {
    createAvailableContainer();
    // TODO: Add proper uniqueId
    availableGrid = new SearchableGrid<C, JPAContainer<C>>(this.getClass().getSimpleName(), itemClass) {

        private static final long serialVersionUID = 1L;

        @Override
        public GridHeadingPropertySet<C> getHeadingPropertySet() {
            return createAvailableHeadings();
        }

        @Override
        public JPAContainer<C> getContainer() {
            return availableContainer;
        }

        @Override
        protected Filter getContainerFilter(String filterString, boolean advancedSearchActive) {
            Filter searchFilter = null;
            if (filterString != null && filterString.length() > 0) {
                searchFilter = getSearchFilter(filterString);
            }
            return NullFilter.and(baselineFilter, selectedFilter, searchFilter);
        }

        @Override
        protected String getTitle() {
            return null;
        }
    };
    // Needs to be here after availableContainer creation,
    // otherwise sorting goes away
    sortAvailableContainer();
    availableGrid.addItemClickListener(new ItemClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                addButton.click();
            }
        }
    });
    availableGrid.setWidth(DEFAULT_COLUMN_WIDTH, Unit.PIXELS);
    availableGrid.setHeight(DEFAULT_COLUMN_HEIGHT, Unit.PIXELS);
}
Also used : ItemClickListener(com.vaadin.event.ItemClickEvent.ItemClickListener) Filter(com.vaadin.data.Container.Filter) NullFilter(au.com.vaadinutils.dao.NullFilter) SimpleStringFilter(com.vaadin.data.util.filter.SimpleStringFilter) JPAContainer(com.vaadin.addon.jpacontainer.JPAContainer) ItemClickEvent(com.vaadin.event.ItemClickEvent) GridHeadingPropertySet(au.com.vaadinutils.crud.GridHeadingPropertySet)

Aggregations

GridHeadingPropertySet (au.com.vaadinutils.crud.GridHeadingPropertySet)1 NullFilter (au.com.vaadinutils.dao.NullFilter)1 JPAContainer (com.vaadin.addon.jpacontainer.JPAContainer)1 Filter (com.vaadin.data.Container.Filter)1 SimpleStringFilter (com.vaadin.data.util.filter.SimpleStringFilter)1 ItemClickEvent (com.vaadin.event.ItemClickEvent)1 ItemClickListener (com.vaadin.event.ItemClickEvent.ItemClickListener)1