Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Problem with resizing table after scrollbar is hidden
Problem with resizing table after scrollbar is hidden [message #1698600] Tue, 16 June 2015 15:10 Go to next message
Eugeniusz Kalafior is currently offline Eugeniusz KalafiorFriend
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
Re: Problem with resizing table after scrollbar is hidden [message #1698626 is a reply to message #1698600] Tue, 16 June 2015 18:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Please open a ticket and contribute a fix. Seems you have found the reason and the solution for the issue already
Re: Problem with resizing table after scrollbar is hidden [message #1698712 is a reply to message #1698626] Wed, 17 June 2015 11:53 Go to previous messageGo to next message
Eugeniusz Kalafior is currently offline Eugeniusz KalafiorFriend
Messages: 9
Registered: June 2015
Junior Member
Bug reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470338 Hope it's, the right place, and the description is sufficient.
Re: Problem with resizing table after scrollbar is hidden [message #1698722 is a reply to message #1698712] Wed, 17 June 2015 12:36 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Yes, but a Gerrit contribution of the code would be also nice.
Re: Problem with resizing table after scrollbar is hidden [message #1698781 is a reply to message #1698722] Wed, 17 June 2015 21:03 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I had a quick look into this, and I have to tell you that your proposed solution doesn't work. It looks like you don't have a GridLayer composition and therefore your workaround works for you. But it doesn't work for a grid, because in that case the available area is less than the client area.

Also moving the mentioned lines of code doesn't have an effect. And if you look at the code comments, they are placed there by intention.

Nevertheless I can confirm that something isn't correct here. Looks like an issue on calculating the remaining space. Maybe a rounding issue. I need to dig deeper into this.
Re: Problem with resizing table after scrollbar is hidden [message #1698826 is a reply to message #1698781] Thu, 18 June 2015 08:49 Go to previous messageGo to next message
Eugeniusz Kalafior is currently offline Eugeniusz KalafiorFriend
Messages: 9
Registered: June 2015
Junior Member
You're right, I'm displaying only column headers and table body, that may be the reason why it's working for me. I forgot about possibility of displaying row headers.
Re: Problem with resizing table after scrollbar is hidden [message #1699093 is a reply to message #1698826] Sat, 20 June 2015 19:18 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Looks like I've found the solution. Could you try to test the Gerrit patch?
Previous Topic:I can't get Nattable working
Next Topic:Odd row spacing on large table
Goto Forum:
  


Current Time: Fri Apr 26 03:21:32 GMT 2024

Powered by FUDForum. Page generated in 0.03854 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top