Performance for selection and scrolling [message #1403117] |
Mon, 21 July 2014 12:57 |
Alexander Klatt Messages: 59 Registered: April 2014 |
Member |
|
|
Hi,
NatTable provides exactly the functionality that I need for my application.
However, one drawback is that the cell selection and scrolling behavior is a bit
laggy. I did not find any information on this issue. Is there any way to boost
performance for this (e.g. disable font changing on selection) ?
I would appreciate any advice!
[Updated on: Mon, 21 July 2014 12:57] Report message to a moderator
|
|
|
|
|
|
Re: Performance for selection and scrolling [message #1403134 is a reply to message #1403126] |
Mon, 21 July 2014 15:18 |
Alexander Klatt Messages: 59 Registered: April 2014 |
Member |
|
|
I don't know where to open a ticket. But the reason for the slow selection performance is because of the default drag selection event.
With the following code, the selection is smooth:
This does not work yet though, if the table is not scrolled to the top.
private class BodyDragSelection implements IDragMode {
@Override
public void mouseUp(NatTable natTable, MouseEvent event) {
}
@Override
public void mouseMove(NatTable natTable, MouseEvent event) {
SelectionLayer selectionLayer = ((MyBodyLayerStack) gridLayer.getBodyLayer()).getSelectionLayer();
selectionLayer.getSelectionModel().clearSelection();
selectionLayer.selectCell(selectionLayer.getColumnPositionByX(event.x - gridLayer.getCornerLayer().getWidth()), selectionLayer.getRowPositionByY(event.y - gridLayer.getCornerLayer().getHeight()), true, false);
natTable.redraw();
}
@Override
public void mouseDown(NatTable natTable, MouseEvent event) {
SelectionLayer selectionLayer = ((MyBodyLayerStack) gridLayer.getBodyLayer()).getSelectionLayer();
int startRowIndex = selectionLayer.getRowPositionByY(event.y - gridLayer.getCornerLayer().getHeight());
int startColumnIndex = selectionLayer.getColumnPositionByX(event.x - gridLayer.getCornerLayer().getWidth());
selectionLayer.clear();
selectionLayer.moveSelectionAnchor(startColumnIndex, startRowIndex);
selectionLayer.selectCell(startColumnIndex, startRowIndex, true, false);
natTable.redraw();
}
}
[Updated on: Mon, 21 July 2014 15:22] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03433 seconds