yetAnotherSE
yetAnotherSE

Reputation: 3268

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?

Upvotes: 0

Views: 1146

Answers (2)

Steffen
Steffen

Reputation: 2662

Currently (Vaadin 7.7.5 may be also in versions before) there is a ColumnCollapseListener for that.

Table.addColumnCollapseListener(Table.ColumnCollapseListener listener)

EDIT

For uncollapsed events the listener method above will be called again (unfortunately with exact same arguments of the given Event object so that there is no way to make a difference between collapsing and uncollapsing event)

Upvotes: 0

Jose Luis Martin
Jose Luis Martin

Reputation: 10709

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) {
        ...
    }   

}

Upvotes: 3

Related Questions