use of net.sourceforge.nattable.selection.command.SelectRowsCommand in project translationstudio8 by heartsome.
the class RowSelectionProvider method setSelection.
@SuppressWarnings("unchecked")
public void setSelection(ISelection selection) {
if (selectionLayer != null && selection instanceof IStructuredSelection) {
selectionLayer.clear();
List<Integer> rowIndexs = ((IStructuredSelection) selection).toList();
Set<Integer> rowPositions = new HashSet<Integer>();
for (Integer rowIndex : rowIndexs) {
int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
rowPositions.add(Integer.valueOf(rowPosition));
}
selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, ObjectUtils.asIntArray(rowPositions), false, true));
}
}
use of net.sourceforge.nattable.selection.command.SelectRowsCommand in project translationstudio8 by heartsome.
the class RowSelectionProvider method setSelection.
@SuppressWarnings("unchecked")
public void setSelection(ISelection selection) {
if (selectionLayer != null && selection instanceof IStructuredSelection) {
selectionLayer.clear();
List<T> rowObjects = ((IStructuredSelection) selection).toList();
Set<Integer> rowPositions = new HashSet<Integer>();
for (T rowObject : rowObjects) {
int rowIndex = rowDataProvider.indexOfRowObject(rowObject);
int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
rowPositions.add(Integer.valueOf(rowPosition));
}
selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, ObjectUtils.asIntArray(rowPositions), false, true));
}
}
use of net.sourceforge.nattable.selection.command.SelectRowsCommand in project translationstudio8 by heartsome.
the class SelectRowAction method run.
@Override
public void run(NatTable natTable, MouseEvent event) {
super.run(natTable, event);
natTable.doCommand(new SelectRowsCommand(natTable, getGridColumnPosition(), getGridRowPosition(), isWithShiftMask(), isWithControlMask()));
}
use of net.sourceforge.nattable.selection.command.SelectRowsCommand in project translationstudio8 by heartsome.
the class ViewportSelectRowCommandHandler method doCommand.
@Override
protected boolean doCommand(ViewportSelectRowCommand command) {
IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
int scrollableColumnPosition = viewportLayer.getOriginColumnPosition();
int scrollableRowPosition = viewportLayer.localToUnderlyingRowPosition(command.getRowPosition());
scrollableLayer.doCommand(new SelectRowsCommand(scrollableLayer, scrollableColumnPosition, new int[] { scrollableRowPosition }, command.isWithShiftMask(), command.isWithControlMask()));
return true;
}
Aggregations