pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: TablePane concept...
Date Thu, 25 Jun 2009 12:56:13 GMT
TablePane has a "columns" collection and a "rows" collection. In WTKX,  
you might define a table pane as follows:

         <TablePane.Column width="120"/>
         <TablePane.Column width="240"/>
         <TablePane.Row height="80">
             <ImageView image="a.png"/>
             <ImageView image="b.png"/>
         <TablePane.Row height="160">
             <ImageView image="c.png"/>
             <ImageView image="d.png"/>

This table pane would contain 4 ImageView cells, with column widths  
and row heights as specified. It is analogous to defining a table in  
HTML, only we require you to define your columns up front (so we don't  
have to infer them) and we don't require the equivalent of <td> tags  
(any component can be a cell).

In Java, it would look like this:

TablePane tablePane = new TablePane();
tablePane.getColumns().add(new TablePane.Column(120));
tablePane.getColumns().add(new TablePane.Column(240));

TablePane.Row row1 = new TablePane.Row(80);
row1.add(new ImageView(Image.load(getClass().getResource("a.png"))));
row1.add(new ImageView(Image.load(getClass().getResource("b.png"))));

TablePane.Row row2 = new TablePane.Row(160);
row2.add(new ImageView(Image.load(getClass().getResource("c.png"))));
row2.add(new ImageView(Image.load(getClass().getResource("d.png"))));

Hope this helps.

On Jun 25, 2009, at 6:17 AM, Niclas Hedhman wrote:

> (Sorry for posting here, but I am currently unable to post to
> pivot-user@. Raised INFRA-2109 about it)
> Guys,
> I am struggling with TablePane, as it consistently refuse to work in a
> fashion that I find "natural".
> If I add() the ImageView instances to it, they all show up in cell
> [0,0], and if I call setCellComponent() I get a
> IndexOutOfBoundsException, even though I have added 2 columns and 1
> row (in that order) before trying to set the cell.
> But before starting on the real deal, I created an example where the
> Rows were added before the Columns, and that worked.
> How is it really intended to work?
> Looking at the code, If one adds a Row, then all Components found in
> the Row is added to the Pane, but I one adds a Column this is not
> done.
> Why do I need to bother with these kinds of details at all? Shouldn't
> it be so much more natural to just have an indicator on how many rows
> and columns one want, and a easier way to insert a new empty row or
> column?
> I just don't understand the thinking here...
> Cheers
> -- 
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
> I  live here; http://tinyurl.com/2qq9er
> I  work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message