Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Minimum number of rows visible (Is there a way to set the minimum number of rows that should be visible prior to the scrollbar being added?)
Minimum number of rows visible [message #1278801] Thu, 27 March 2014 21:47 Go to next message
John Steele is currently offline John SteeleFriend
Messages: 50
Registered: January 2010
Member
I'd like the nattable to only display it's scrollbars (from the ViewportLayer presumably) once it has a maximum number of rows visible.

If my NatTable is a child of a scrollable composite, I'd like the parent scrollable composite to display it's scrollbars up until the nattable displays it's maximum number of rows. The table's scrollbars should only be visible if the table has visible row count > max visible row count.

Has anyone accomplished this?
Re: Minimum number of rows visible [message #1279067 is a reply to message #1278801] Fri, 28 March 2014 07:38 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
I'd like the nattable to only display it's scrollbars (from the ViewportLayer presumably) once it has a maximum number of rows visible


That's NatTable default behaviour! The scrollbars will only be visible in case they are necessary.

If you want to exchange the scrollbar of the NatTable, you will be able to do this with ViewportLayer#setHorizontalScroller() and ViewportLayer#setVerticalScroller() which will be introduced in NatTable 1.1. So ATM you can find them in the development snapshots.

Greez,
Dirk
Re: Minimum number of rows visible [message #1279392 is a reply to message #1279067] Fri, 28 March 2014 17:22 Go to previous messageGo to next message
John Steele is currently offline John SteeleFriend
Messages: 50
Registered: January 2010
Member
Ooops. I said that backwards. I mean "minimum" number of rows. So I only want the scrollbars visible if a certain minimum number of rows is visible. I imagine this number would be used during the computation of the size of the natTable (e.g., natTable.size= (minimumNumberOfRowsToBeVisible * sizeof(oneRow)).
Re: Minimum number of rows visible [message #1279406 is a reply to message #1279392] Fri, 28 March 2014 17:52 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Sorry I don't understand what you mean. Have a look at the scrollbar listeners in the ViewportLayer. They are responsible for showing or hiding the scrollbars. Maybe that gives you a clue.
Re: Minimum number of rows visible [message #1280030 is a reply to message #1279406] Sat, 29 March 2014 17:28 Go to previous message
John Steele is currently offline John SteeleFriend
Messages: 50
Registered: January 2010
Member
I believe the solution I'm looking for would be integrated in the NatTable's computeSize method.

So, for example, when the parent of the NatTable calls on it's child (the NatTable) to compute its size:

computeSize (int wHint, int yHint, boolean changed)


the NatTable, would return a size for example:

NatTable natTable = new NatTable (...) {

    Point computeSize (....) {
        
        int height = getColumnHeaderHeight() + (numberOfMinimumVisibleRows * getSizeOfSingleRow()); 

        ...

        return size;
    }
};



With this type of configuration I could allow the user to specify how many rows they want visible prior to showing the scroll bar (e.g., show 10, 20, ALL rows).

Of course if the height of the rows were modifiable it would be accounted for in the algorithm for computing the total height.

Previous Topic:NatTable : Table level validations
Next Topic:VerticalTextPainter update
Goto Forum:
  


Current Time: Thu Mar 28 16:58:06 GMT 2024

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

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

Back to the top