You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by lello <rb...@gmail.com> on 2011/03/21 10:08:48 UTC
Fixed Column Table
Hi All,
I would need something like a fixed column TableView, however I can't
understand how to implement it by looking at the example in the demos. Could
anyone please explain me how it works?
Thanks,
Lello
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2709228.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Re: Fixed Column Table
Posted by Chris Bartlett <cb...@gmail.com>.
No problem.
If you assign a column a relative width (like 1*) then you cannot resize it.
See this JIRA ticket that I raised a while ago, and the comments from Greg.
https://issues.apache.org/jira/browse/PIVOT-609
So for the moment you will have to calculate the initial widths yourself and
set them as absolute values (column1 = 100, column2 = 200) if you want them
to be resizeable later on.
Chris
On 22 March 2011 00:48, lello <rb...@gmail.com> wrote:
> Sorry,
> it was my fault...
> I just realized that if I want a resizable column I cannot set its width.
> So my question now is the following: suppose I have a table with two
> columns, A and B. when I open the table I'd like column A to have the
> double
> of the width of column B. I'd also like A and B to be resizable.
> However if I set the width of A to "2*" and the width of B to "1*" then
> they
> are not resizable.
>
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2710958.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>
Re: Fixed Column Table
Posted by lello <rb...@gmail.com>.
Sorry,
it was my fault...
I just realized that if I want a resizable column I cannot set its width.
So my question now is the following: suppose I have a table with two
columns, A and B. when I open the table I'd like column A to have the double
of the width of column B. I'd also like A and B to be resizable.
However if I set the width of A to "2*" and the width of B to "1*" then they
are not resizable.
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2710958.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Re: Fixed Column Table
Posted by Chris Bartlett <cb...@gmail.com>.
Ahh, did I just explain something that nobody asked for? Oh well! :)
Do you just want a TableView with a header that does not allow any columns
to be resized?
If so you should be able to set the 'columnsResizable' style of the
TableViewHeader provided by
org.apache.pivot.wtk.skin.terra.TerraTableViewHeaderSkin
Or possibly, that would only allow certain columns to be resized?
Or something else?
Chris
On 21 March 2011 21:04, lello <rb...@gmail.com> wrote:
> Chris,
> thanks for the exhaustive description of the example, however I still don't
> understand what is the
> mechanism behind column resizing, which is what I am really interested in.
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2710061.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>
Re: Fixed Column Table
Posted by lello <rb...@gmail.com>.
Chris,
thanks for the exhaustive description of the example, however I still don't
understand what is the
mechanism behind column resizing, which is what I am really interested in.
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2710061.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Re: Fixed Column Table
Posted by Chris Bartlett <cb...@gmail.com>.
Lello,
I assume that you are talkng aout this demo
http://pivot.apache.org/demos/fixed-column-table.html
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/tables/
It might seem confusing because it combines a few different things which you
may not have seen elsewhere or may not have considered, and also because it
demonstrates ScrollPanes as much as TableViews.
Put simply, the demo shows that 2 TableViews can be share the same data, be
kept in sync and appear to be a single TableView with a fixed column when
they are placed in a ScrollPane with a row header.
1. Multiple TableViews can share the same data model.
The BXML file defines some data (named id='tableData') that is used for both
TableViews (primaryTableView and fixedTableView).
This model consists of multiple 'rows' with 4 named 'columns'
2. ScrollPanes support row headers as well as column headers.
Column headers are commonly used when TableViews are placed in ScrollPanes.
They paint the header at the top of the ScrollPane, above the TableView (or
whatever other content the ScrollPane contains. Pivot provides a
org.apache.pivot.wtk.TableViewHeader class which will often be used for a
TableView's column header.
This demo shows the use of a row header which is painted on the left side of
the ScrollPane, before the ScrollPane's content.
The demo uses a second TableView (fixedTableView) as the row header, but
that TableView shares the same data model as the main one
(primaryTableView). 'fixedTableView' only shows the 'name' column from the
shared data, and 'primaryTableView' shows the remaining 3 columns.
You can experiment with adding or removing columns from the <columns>
elements of the 2 TableViews.
3. Use of ScrollPane.Corner
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ScrollPane.Corner.html
After the row header has been set, the data of the 'name' column will be
displayed, but there will be no column header. A ScrollPane.Corner is used
to place another TableViewHeader above the row header so that the 'name'
column has a header like all of the other columns.
You can comment out or remove the <corner> element from the BXML to see how
the demo looks without it.
Finally, the FixedColumnTableDemo class wires the 2 TableViews together by
ensuring that their row selections and sorts are kept in sync.
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/tables/FixedColumnTableDemo.java
Chris
On 21 March 2011 16:08, lello <rb...@gmail.com> wrote:
> Hi All,
>
> I would need something like a fixed column TableView, however I can't
> understand how to implement it by looking at the example in the demos.
> Could
> anyone please explain me how it works?
>
> Thanks,
> Lello
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Fixed-Column-Table-tp2709228p2709228.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>