Vaadin Table Collapse Column Listener

被刻印的时光 ゝ 提交于 2019-12-13 04:24:33

问题


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


回答1:


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

}



回答2:


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)



来源:https://stackoverflow.com/questions/23905411/vaadin-table-collapse-column-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!