我正在尝试使用“ComboBoxFilterRowHeaderComposite”实现 nattable。
过滤工作正常,但是当我尝试分组时过滤行后,它会引发以下异常
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)
这是我的 ComboBoxFilterRowHeaderComposite 结构:
filterRowHeaderLayer = new ComboBoxFilterRowHeaderComposite<T>(
bodyLayerStack.getFilterList(),
bodyLayerStack.getGlazedListsEventLayer(), bodyLayerStack.getSortedList(),
columnAccessor, columnHeaderLayer, dataProvider, configRegistry);
在哪里,
columnAccessor = new ReflectiveColumnPropertyAccessor(propertyNames);
columnGroupHeaderLayer = new DynamicColumnGroupHeaderLayer(sortHeaderLayerStack, bodyLayerStack.getSelectionLayer(), bodyLayerStack.getColumnGroupModel(), tr);
DataProvider 是 com.vanguard.tip.epm.platform.ui.grid.next.DynamicColumnHeaderDataProvider;
在那之后
CornerLayerStack cornerLayerStack = new CornerLayerStack(rowHeaderLayerStack, filterRowHeaderLayer);
CompositeLayer gridLayer = new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayerStack, cornerLayerStack);
然后在 GroupByHeaderLayer 中添加 gridLayer:
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);
我希望这能让您清楚地了解我对 Nattable 的使用。
当我使用具有相同结构的文本库过滤器时,分组工作正常:
filterStrategy = new DefaultGlazedListsFilterStrategy<T>(bodyLayerStack.getFilterList(), columnAccessor, configRegistry);
this.filterRowHeaderLayer = new FilterRowHeaderComposite<T>(filterStrategy, columnHeaderLayer, dataProvider, configRegistry);
如果您需要更多信息,请与我们联系。