【发布时间】:2014-08-29 03:56:49
【问题描述】:
我想以编程方式选择 NatTable 中的某些行
NatTable example program 中有一些示例代码(在 Classic Examples -> Selection -> Get and set selected objects 下)使用 ISelectionProvider(在这种情况下为 org.eclipse.nebula.widgets.nattable.selection.RowSelectionProvider )。
ISelectionProvider selectionProvider = new RowSelectionProvider(gridLayer.getBodyLayer().getSelectionLayer(), bodyDataProvider, false);
selectionProvider.setSelection(new StructuredSelection(new Person[] { homer, smithers, nelson }));
我从另一个来源找到了一种更简单的选择行的方法:
natTable.doCommand(new SelectRowsCommand(ILayer layer, int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask));
有什么理由不使用第二种方法吗?
【问题讨论】:
标签: eclipse selection nattable