@Override public Action createAction(ListComponent holder) { if (holder instanceof Table || holder instanceof DataGrid) return ExcelAction.create(holder); else throw new IllegalArgumentException("Only Table and DataGrid can contain EXCEL action"); } };
protected Table createTable(String dataSetName, GroupDatasource dataSource) { Table table = componentsFactory.createComponent(GroupTable.class); table.setId(dataSetName + "Table"); createColumns(dataSource, table); table.setDatasource(dataSource); table.setWidth("100%"); table.setMultiSelect(true); ExcelAction excelAction = ExcelAction.create(table); excelAction.setFileName(dataSetName); Button excelButton = componentsFactory.createComponent(Button.class); excelButton.setAction(excelAction); ButtonsPanel buttonsPanel = componentsFactory.createComponent(ButtonsPanel.class); table.setButtonsPanel(buttonsPanel); table.addAction(excelAction); buttonsPanel.add(excelButton); return table; }