vaadinvaadin7

Vaadin Table Collapse Column Listener


I want to know which columns are collapsed & uncollapsed, in vaadin. Is there a listener for this, I could not found?


Solution

  • It's not supported out the box. However you could extends Table to support it.

    Something like

    public class ColumnCollapsedObservableTable extends Table {
    
        private List<ColumCollapsedListener> collapseListeners = new ArrayList<ColumCollapsedListener>();
    
        @Override
        public void setColumnCollapsed(Object propertyId, boolean collapsed)
                throws IllegalStateException {
    
            super.setColumnCollapsed(propertyId, collapsed);
            fireColumnCollapsedEvent(new ColumnCollapsedEvent(this, propertyId, collapsed));
        }
    
        public void addColumnCollapsedListener(ColumnCollapsedListener l) {
            ...
        }
    
        public void removeColumnCollapsedListener(ColumnCollapsedListener l) {
            ...
        }
    
        private fireColumnCollapsedEvent(ColumCollapsedEvent event) {
            ...
        }   
    
    }