Problem with resizing table after scrollbar is hidden [message #1698600] |
Tue, 16 June 2015 15:10 |
Eugeniusz Kalafior Messages: 9 Registered: June 2015 |
Junior Member |
|
|
Hi, I've spotted a problem with resizing table after scrollbar is hidden. I use percentage column sizing, when the scrollbar was displayed and I remove some rows from the table so that it dissapears I get an white stripe on the right side of the table where the scrollbar was displayed. I think that the problem is in ClientAreaResizeCommand handling in ViewportLayer .
Calling this:
Rectangle calcArea = clientAreaResizeCommand.getCalcArea();
before the scroll bar handling:
if (this.hBarListener == null && this.horizontalScrollbarEnabled) {
ScrollBar hBar = scrollable.getHorizontalBar();
if (this.horizontalScroller != null) {
hBar.setEnabled(false);
hBar.setVisible(false);
} else {
this.horizontalScroller = new ScrollBarScroller(hBar);
}
this.hBarListener = new HorizontalScrollBarHandler(this, this.horizontalScroller);
if (scrollable instanceof NatTable) {
this.hBarListener.setTable((NatTable) scrollable);
}
}
if (this.vBarListener == null && this.verticalScrollbarEnabled) {
ScrollBar vBar = scrollable.getVerticalBar();
if (this.verticalScroller != null) {
vBar.setEnabled(false);
vBar.setVisible(false);
} else {
this.verticalScroller = new ScrollBarScroller(vBar);
}
this.vBarListener = new VerticalScrollBarHandler(this, this.verticalScroller);
if (scrollable instanceof NatTable) {
this.vBarListener.setTable((NatTable) scrollable);
}
}
causes that in ClientAreaResizeCommand calcArea field is set to current clientArea of the table, before updating visibility of the scrollbars . All the resize commands set while updating the scorllbars are ignored by line 992 in ViewportLayer:
if (this.processingClientAreaResizeCommand)
return false;
so the DataLayer which calls recalculation of percentage sizes gets the table width from before the scrollbars update via the ClientAreaResizeCommand.
Correct me if I'm wrong, but I think that this block of code:
Scrollable scrollable = clientAreaResizeCommand.getScrollable();
Rectangle clientArea = scrollable.getClientArea();
Rectangle calcArea = clientAreaResizeCommand.getCalcArea();
int widthDiff = clientArea.width - calcArea.width;
int heightDiff = clientArea.height - calcArea.height;
should be moved few lines down, to be called after scrollbar handling is done.
If somebody have the same problem, I've temporarily resolved this issue by extending DataLaye class, and overriding public boolean doCommand(ILayerCommand command) { method to use
clientAreaResizeCommand.getScrollable().getClientArea().width
instead of
clientAreaResizeCommand.getCalcArea().width
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08640 seconds