if (this.processingClientAreaResizeCommand)
return false;
this.processingClientAreaResizeCommand = true;
ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
// remember the difference from client area to body region area
// needed because the scrollbar will be removed and therefore the
// client area will become bigger
Scrollable scrollable = clientAreaResizeCommand.getScrollable();
Rectangle clientArea = scrollable.getClientArea();
Rectangle calcArea = clientAreaResizeCommand.getCalcArea();
int widthDiff = clientArea.width - calcArea.width;
int heightDiff = clientArea.height - calcArea.height;
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);
}
}
handleGridResize();
// after handling the scrollbars recalculate the area to use for
// percentage calculation
Rectangle possibleArea = clientArea;
possibleArea.width = possibleArea.width - widthDiff;
possibleArea.height = possibleArea.height - heightDiff;
clientAreaResizeCommand.setCalcArea(possibleArea);
this.processingClientAreaResizeCommand = false;
// we don't return true here because the ClientAreaResizeCommand
// needs to be handled
// by the DataLayer in case percentage sizing is enabled