pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Fixed Column Table
Date Mon, 21 Mar 2011 13:10:43 GMT
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 <rborrelli@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.
>

Mime
View raw message