nattable combobox filter header with group by

一世执手 提交于 2019-12-12 04:22:37

问题


I am trying to implement nattable with "ComboBoxFilterRowHeaderComposite".

Filtering is working fine but after filtering rows when I try to do group by, it throws following exception

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.remove(ArrayList.java:492) at ca.odell.glazedlists.FunctionList.listChanged(FunctionList.java:283) at ca.odell.glazedlists.event.ListEventAssembler$ListEventFormat.fire(ListEventAssembler.java:424) at ca.odell.glazedlists.event.ListEventAssembler$ListEventFormat.fire(ListEventAssembler.java:421) at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher$SubjectAndListener.firePendingEvent(SequenceDependenciesEventPublisher.java:445) at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher.fireEvent(SequenceDependenciesEventPublisher.java:344) at ca.odell.glazedlists.event.ListEventAssembler.commitEvent(ListEventAssembler.java:317) at ca.odell.glazedlists.TransformedList.clear(TransformedList.java:98) at org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer$1.run(GroupByDataLayer.java:286) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer.updateTree(GroupByDataLayer.java:272) at org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer.update(GroupByDataLayer.java:313) at java.util.Observable.notifyObservers(Observable.java:159) at java.util.Observable.notifyObservers(Observable.java:115) at org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel.update(GroupByModel.java:124) at org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel.addGroupByColumnIndex(GroupByModel.java:44)


Here is my structure for ComboBoxFilterRowHeaderComposite:

filterRowHeaderLayer = new ComboBoxFilterRowHeaderComposite<T>( bodyLayerStack.getFilterList(), bodyLayerStack.getGlazedListsEventLayer(), bodyLayerStack.getSortedList(), columnAccessor, columnHeaderLayer, dataProvider, configRegistry);

where,

columnAccessor = new ReflectiveColumnPropertyAccessor(propertyNames);

columnGroupHeaderLayer = new DynamicColumnGroupHeaderLayer(sortHeaderLayerStack, bodyLayerStack.getSelectionLayer(), bodyLayerStack.getColumnGroupModel(), tr);

DataProvider is com.vanguard.tip.epm.platform.ui.grid.next.DynamicColumnHeaderDataProvider;

After that

CornerLayerStack cornerLayerStack = new CornerLayerStack(rowHeaderLayerStack, filterRowHeaderLayer);

CompositeLayer gridLayer = new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayerStack, cornerLayerStack);

Then Add gridLayer in GroupByHeaderLayer:

groupByHeaderLayer = new GroupByHeaderLayer(bodyLayerStack.getGroupByModel(), gridLayer, columnHeaderLayerStack.getDataProvider(), new GroupByHeaderConfigurationWrapper(bodyLayerStack.getGroupByModel(), columnHeaderLayerStack.getDataProvider(), bodyLayerStack.getColumnGroupModel()));

CompositeLayer groupByComposite = new CompositeLayer(1, 2);

groupByComposite.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByHeaderLayer, 0, 0);

groupByComposite.setChildLayer("Grid", gridLayer, 0, 1);

I hope this will give you some clarity about my use of Nattable.

When I use text base filter with same structure Grouping is working fine:

filterStrategy = new DefaultGlazedListsFilterStrategy<T>(bodyLayerStack.getFilterList(), columnAccessor, configRegistry);

this.filterRowHeaderLayer = new FilterRowHeaderComposite<T>(filterStrategy, columnHeaderLayer, dataProvider, configRegistry);

Let me know if you need more information.


回答1:


Seems to be a bug for that combination. I created the following ticket for this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=508334



来源:https://stackoverflow.com/questions/40826504/nattable-combobox-filter-header-with-group-by

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