You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Scott Lanham <li...@sael.com.au> on 2009/08/26 03:33:57 UTC

TableView in a ScrollPane

Hi,

I am using a  TableView in a ScrollPane. The contents is large enough to need 
a vertical scrollbar. Even though the width of the TableView is resizing to 
accomodate it's contents there is still a horizontal scroll bar appearing that 
pretty much scrolls the distance that the vertical scroll bar is taking up. Is 
there any way I can get the ScrollPane to increase it's width when adding a 
vertical scroll bar rather than taking up the TableView space?

Oh and it would be a very cool thing if the TableView could support automatic 
widths :-)

Thanks,

Scott.

Re: TableView in a ScrollPane

Posted by Greg Brown <gk...@mac.com>.
> There's also been talk a long time ago about adding the ability for  
> the user to double-click in between column headers to size the  
> column to fit.  This wouldn't impose a big performance penalty  
> because it would be a one-time hit, as opposed to something that  
> were calculated every time the TableView were asked for its  
> preferred size.  Would this feature meet your needs here?

I think it would actually be easier (and preferable) to simply add  
support for default-sized columns in TableView.

G



Re: TableView in a ScrollPane

Posted by Scott Lanham <li...@sael.com.au>.
If I was to have a  list of emails in a TableView I would want the date column 
to automatically size but the subject to take a relative amount of the 
remaining space. If the user did double click on the column then it would be 
nice to define how the column was resize based on information from the API.

On Wed, 26 Aug 2009 01:13:38 pm Todd Volkert wrote:
> One of the UI problems that I see with default sized table view columns is
> that it would be disconcerting to the user if the table view's columns were
> resizing dynamically.  Imagine if your rich email client resized its column
> when a new email came in with a large subject.  We could provide an API way
> to either (a) get the default width of a column [then you could set the
> column width to that width], or (b) size a column to its default.  With
> either option, the skin could hook into the API upon double click if and
> when we add that feature, but you could also call the API to size the
> columns when you set up and populate the table.  Thoughts?
> -T
>
> On Tue, Aug 25, 2009 at 8:01 PM, Scott Lanham <li...@sael.com.au> wrote:
> > One of the problems I have always had with creating UI's has been dealing
> > with
> > variations in font sizes across different systems. Best practice for me
> > is if I
> > can write a UI without specifying a single dimension in pixels. So any
> > feature
> > that can give automatic or relative sizes is a very good thing :-)
> >
> > On Wed, 26 Aug 2009 12:49:24 pm Todd Volkert wrote:
> > > > Oh and it would be a very cool thing if the TableView could support
> > > >
> > > >> automatic
> > > >> widths :-)
> > > >
> > > > By "automatic", do you mean "size to fit"? In other words, make the
> > > > column width the max. width of all the cells in a particular column?
> > > >
> > > > If so, we don't currently support that. We could conceivably do so by
> > > > supporting a value of -1 for column width (like TablePane columns),
> > > > but we didn't think there was a strong use case for that. TablePanes
> > > > generally have a small number of rows, so calculating this width
> >
> > doesn't
> >
> > > > impose a performance penalty. However, TableViews are intended to
> >
> > display
> >
> > > > a large number of rows and it could be costly to determine this
> > > > value.
> > > >
> > > > On the other hand, if you know you are only going to have a small
> >
> > number
> >
> > > > of rows in your TableView, it might be a useful feature. Please feel
> >
> > free
> >
> > > > to submit a feature request for this (in JIRA).
> > >
> > > There's also been talk a long time ago about adding the ability for
> > > the user to double-click in between column headers to size the column
> > > to fit.  This wouldn't impose a big performance penalty because it
> > > would be a one-time hit, as opposed to something that were calculated
> > > every time the
> > > TableView were asked for its preferred size.  Would this feature meet
> >
> > your
> >
> > > needs here?
> > >
> > > > Greg


Re: TableView in a ScrollPane

Posted by Todd Volkert <tv...@gmail.com>.
One of the UI problems that I see with default sized table view columns is
that it would be disconcerting to the user if the table view's columns were
resizing dynamically.  Imagine if your rich email client resized its column
when a new email came in with a large subject.  We could provide an API way
to either (a) get the default width of a column [then you could set the
column width to that width], or (b) size a column to its default.  With
either option, the skin could hook into the API upon double click if and
when we add that feature, but you could also call the API to size the
columns when you set up and populate the table.  Thoughts?
-T

On Tue, Aug 25, 2009 at 8:01 PM, Scott Lanham <li...@sael.com.au> wrote:

> One of the problems I have always had with creating UI's has been dealing
> with
> variations in font sizes across different systems. Best practice for me is
> if I
> can write a UI without specifying a single dimension in pixels. So any
> feature
> that can give automatic or relative sizes is a very good thing :-)
>
> On Wed, 26 Aug 2009 12:49:24 pm Todd Volkert wrote:
> > > Oh and it would be a very cool thing if the TableView could support
> > >
> > >> automatic
> > >> widths :-)
> > >
> > > By "automatic", do you mean "size to fit"? In other words, make the
> > > column width the max. width of all the cells in a particular column?
> > >
> > > If so, we don't currently support that. We could conceivably do so by
> > > supporting a value of -1 for column width (like TablePane columns), but
> > > we didn't think there was a strong use case for that. TablePanes
> > > generally have a small number of rows, so calculating this width
> doesn't
> > > impose a performance penalty. However, TableViews are intended to
> display
> > > a large number of rows and it could be costly to determine this value.
> > >
> > > On the other hand, if you know you are only going to have a small
> number
> > > of rows in your TableView, it might be a useful feature. Please feel
> free
> > > to submit a feature request for this (in JIRA).
> >
> > There's also been talk a long time ago about adding the ability for
> > the user to double-click in between column headers to size the column
> > to fit.  This wouldn't impose a big performance penalty because it
> > would be a one-time hit, as opposed to something that were calculated
> > every time the
> > TableView were asked for its preferred size.  Would this feature meet
> your
> > needs here?
> >
> > > Greg
>
>

Re: TableView in a ScrollPane

Posted by Todd Volkert <tv...@gmail.com>.
One of the UI problems that I see with default sized table view columns is
that it would be disconcerting to the user if the table view's columns were
resizing dynamically.  Imagine if your rich email client resized its column
when a new email came in with a large subject.  We could provide an API way
to either (a) get the default width of a column [then you could set the
column width to that width], or (b) size a column to its default.  With
either option, the skin could hook into the API upon double click if and
when we add that feature, but you could also call the API to size the
columns when you set up and populate the table.  Thoughts?
-T

On Tue, Aug 25, 2009 at 8:01 PM, Scott Lanham <li...@sael.com.au> wrote:

> One of the problems I have always had with creating UI's has been dealing
> with
> variations in font sizes across different systems. Best practice for me is
> if I
> can write a UI without specifying a single dimension in pixels. So any
> feature
> that can give automatic or relative sizes is a very good thing :-)
>
> On Wed, 26 Aug 2009 12:49:24 pm Todd Volkert wrote:
> > > Oh and it would be a very cool thing if the TableView could support
> > >
> > >> automatic
> > >> widths :-)
> > >
> > > By "automatic", do you mean "size to fit"? In other words, make the
> > > column width the max. width of all the cells in a particular column?
> > >
> > > If so, we don't currently support that. We could conceivably do so by
> > > supporting a value of -1 for column width (like TablePane columns), but
> > > we didn't think there was a strong use case for that. TablePanes
> > > generally have a small number of rows, so calculating this width
> doesn't
> > > impose a performance penalty. However, TableViews are intended to
> display
> > > a large number of rows and it could be costly to determine this value.
> > >
> > > On the other hand, if you know you are only going to have a small
> number
> > > of rows in your TableView, it might be a useful feature. Please feel
> free
> > > to submit a feature request for this (in JIRA).
> >
> > There's also been talk a long time ago about adding the ability for
> > the user to double-click in between column headers to size the column
> > to fit.  This wouldn't impose a big performance penalty because it
> > would be a one-time hit, as opposed to something that were calculated
> > every time the
> > TableView were asked for its preferred size.  Would this feature meet
> your
> > needs here?
> >
> > > Greg
>
>

Re: TableView in a ScrollPane

Posted by Scott Lanham <li...@sael.com.au>.
One of the problems I have always had with creating UI's has been dealing with 
variations in font sizes across different systems. Best practice for me is if I 
can write a UI without specifying a single dimension in pixels. So any feature 
that can give automatic or relative sizes is a very good thing :-)

On Wed, 26 Aug 2009 12:49:24 pm Todd Volkert wrote:
> > Oh and it would be a very cool thing if the TableView could support
> >
> >> automatic
> >> widths :-)
> >
> > By "automatic", do you mean "size to fit"? In other words, make the
> > column width the max. width of all the cells in a particular column?
> >
> > If so, we don't currently support that. We could conceivably do so by
> > supporting a value of -1 for column width (like TablePane columns), but
> > we didn't think there was a strong use case for that. TablePanes
> > generally have a small number of rows, so calculating this width doesn't
> > impose a performance penalty. However, TableViews are intended to display
> > a large number of rows and it could be costly to determine this value.
> >
> > On the other hand, if you know you are only going to have a small number
> > of rows in your TableView, it might be a useful feature. Please feel free
> > to submit a feature request for this (in JIRA).
>
> There's also been talk a long time ago about adding the ability for
> the user to double-click in between column headers to size the column
> to fit.  This wouldn't impose a big performance penalty because it
> would be a one-time hit, as opposed to something that were calculated
> every time the
> TableView were asked for its preferred size.  Would this feature meet your
> needs here?
>
> > Greg


Re: TableView in a ScrollPane

Posted by Todd Volkert <tv...@gmail.com>.
>
> Oh and it would be a very cool thing if the TableView could support
>> automatic
>> widths :-)
>>
>
> By "automatic", do you mean "size to fit"? In other words, make the column
> width the max. width of all the cells in a particular column?
>
> If so, we don't currently support that. We could conceivably do so by
> supporting a value of -1 for column width (like TablePane columns), but we
> didn't think there was a strong use case for that. TablePanes generally have
> a small number of rows, so calculating this width doesn't impose a
> performance penalty. However, TableViews are intended to display a large
> number of rows and it could be costly to determine this value.
>
> On the other hand, if you know you are only going to have a small number of
> rows in your TableView, it might be a useful feature. Please feel free to
> submit a feature request for this (in JIRA).


There's also been talk a long time ago about adding the ability for
the user to double-click in between column headers to size the column
to fit.  This wouldn't impose a big performance penalty because it
would be a one-time hit, as opposed to something that were calculated
every time the
TableView were asked for its preferred size.  Would this feature meet your
needs here?

>
>
> Greg
>
>

Re: TableView in a ScrollPane

Posted by Greg Brown <gk...@mac.com>.
> I am using a  TableView in a ScrollPane. The contents is large  
> enough to need
> a vertical scrollbar. Even though the width of the TableView is  
> resizing to
> accomodate it's contents there is still a horizontal scroll bar  
> appearing that
> pretty much scrolls the distance that the vertical scroll bar is  
> taking up. Is
> there any way I can get the ScrollPane to increase it's width when  
> adding a
> vertical scroll bar rather than taking up the TableView space?

There really isn't any way to make a ScrollPane increase its own  
width, since that is up to the scroll pane's parent. However, you  
might try setting the horizonalScrollBarPolicy to FILL or  
FILL_TO_CAPACITY to see if that meets your needs. FILL means - "always  
make the view the same width as the scroll pane". FILL_TO_CAPACITY  
means "make the view the same width as the scroll pane until its  
preferred width exceeds the width of the scroll pane. The default is  
AUTO, which means "show a horizontal scroll bar if the view's  
preferred width exceeds the width of the scroll pane; otherwise, hide  
it".

> Oh and it would be a very cool thing if the TableView could support  
> automatic
> widths :-)

By "automatic", do you mean "size to fit"? In other words, make the  
column width the max. width of all the cells in a particular column?

If so, we don't currently support that. We could conceivably do so by  
supporting a value of -1 for column width (like TablePane columns),  
but we didn't think there was a strong use case for that. TablePanes  
generally have a small number of rows, so calculating this width  
doesn't impose a performance penalty. However, TableViews are intended  
to display a large number of rows and it could be costly to determine  
this value.

On the other hand, if you know you are only going to have a small  
number of rows in your TableView, it might be a useful feature. Please  
feel free to submit a feature request for this (in JIRA).

Greg