use of net.sourceforge.nattable.coordinate.Range in project translationstudio8 by heartsome.
the class RowStructuralChangeEvent method getChangedPositionRectangles.
@Override
public Collection<Rectangle> getChangedPositionRectangles() {
Collection<Rectangle> changedPositionRectangles = new ArrayList<Rectangle>();
int columnCount = getLayer().getColumnCount();
int rowCount = getLayer().getRowCount();
for (Range range : getRowPositionRanges()) {
changedPositionRectangles.add(new Rectangle(0, range.start, columnCount, rowCount - range.start));
}
return changedPositionRectangles;
}
use of net.sourceforge.nattable.coordinate.Range in project translationstudio8 by heartsome.
the class SelectionModel method getSelectedRowCount.
public int getSelectedRowCount() {
Set<Range> selectedRows = getSelectedRows();
int count = 0;
for (Range range : selectedRows) {
count += range.end - range.start;
}
return count;
}
use of net.sourceforge.nattable.coordinate.Range in project translationstudio8 by heartsome.
the class SelectRowCommandHandler method selectRowWithCtrlKey.
private Range selectRowWithCtrlKey(int columnPosition, int rowPosition) {
Rectangle selectedRowRectangle = new Rectangle(0, rowPosition, selectionLayer.getColumnCount(), 1);
if (selectionLayer.isRowFullySelected(rowPosition)) {
selectionLayer.clearSelection(selectedRowRectangle);
if (selectionLayer.lastSelectedRegion != null && selectionLayer.lastSelectedRegion.equals(selectedRowRectangle)) {
selectionLayer.lastSelectedRegion = null;
}
} else {
// Preserve last selected region
if (selectionLayer.lastSelectedRegion != null) {
selectionLayer.selectionModel.addSelection(new Rectangle(selectionLayer.lastSelectedRegion.x, selectionLayer.lastSelectedRegion.y, selectionLayer.lastSelectedRegion.width, selectionLayer.lastSelectedRegion.height));
}
selectionLayer.selectRegion(0, rowPosition, selectionLayer.getColumnCount(), 1);
selectionLayer.moveSelectionAnchor(columnPosition, rowPosition);
}
return new Range(rowPosition, rowPosition + 1);
}
use of net.sourceforge.nattable.coordinate.Range in project translationstudio8 by heartsome.
the class SelectRowCommandHandler method internalSelectRow.
private Set<Range> internalSelectRow(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) {
Set<Range> changedRowRanges = new HashSet<Range>();
if (noShiftOrControl(withShiftMask, withControlMask)) {
changedRowRanges.addAll(selectionLayer.getSelectedRows());
selectionLayer.clear();
selectionLayer.selectCell(0, rowPosition, withShiftMask, withControlMask);
selectionLayer.selectRegion(0, rowPosition, selectionLayer.getColumnCount(), 1);
selectionLayer.moveSelectionAnchor(columnPosition, rowPosition);
changedRowRanges.add(new Range(rowPosition, rowPosition + 1));
} else if (bothShiftAndControl(withShiftMask, withControlMask)) {
changedRowRanges.add(selectRowWithShiftKey(rowPosition));
} else if (isShiftOnly(withShiftMask, withControlMask)) {
changedRowRanges.add(selectRowWithShiftKey(rowPosition));
} else if (isControlOnly(withShiftMask, withControlMask)) {
changedRowRanges.add(selectRowWithCtrlKey(columnPosition, rowPosition));
}
selectionLayer.lastSelectedCell.columnPosition = selectionLayer.getColumnCount() - 1;
selectionLayer.lastSelectedCell.rowPosition = rowPosition;
return changedRowRanges;
}
use of net.sourceforge.nattable.coordinate.Range in project translationstudio8 by heartsome.
the class ViewportLayer method processColumnSelection.
private void processColumnSelection(ColumnSelectionEvent selectionEvent) {
for (Range columnPositionRange : selectionEvent.getColumnPositionRanges()) {
moveColumnPositionIntoViewport(columnPositionRange.end - 1, false);
adjustHorizontalScrollBar();
}
}
Aggregations