Class TableLayout

  extended by thinwire.ui.layout.AbstractLayout
      extended by thinwire.ui.layout.TableLayout
All Implemented Interfaces:
Layout, Grid<TableLayout.Row,TableLayout.Column>

public final class TableLayout
extends AbstractLayout
implements Grid<TableLayout.Row,TableLayout.Column>

A layout that manages Components in a table structure that is backed by a Grid. You can use this rapidly and easily layout user interfaces of almost any complexity. Additionaly, since this layout is backed by a Grid, you can dynamically manipulate the layout to accomplish sophisticated user interfaces.

The general concepts of this layout are adapted directly from the TableLayout project at While, the TableLayout project at is for the Java Swing UI framework, the basic idea behind the layout is applicable to any user interface framework. In general, you can use a good portion of the documentation from that project to guide you in using this layout.

There are two primary differences to keep in mind. First, ThinWire layout's use 'limits', whereas Swing layouts use 'constraints'. The concept is the same, but in ThinWire you set a limit by calling the "setLimit()" method on a Component. Second, since this layout is backed by a ThinWire Grid, row/column additions and removals are done entirely different then how the TableLayout project handles it.

With this layout, almost any Grid operation that the GridBox component supports can be performed. This gives you extensive flexibility in how forms are laid out and manipulated. Essentially, you can treat a TableLayout that's been set on a Panel as an extremely flexible GridBox. It takes a little more setup then a GridBox because you have to create instances of the components you want to display in each cell. Additionally, the overall performance will be lower if you have 100's of rows of information. However, in exchange for those issues you can use this layout to pull off complex data grids that approach the capability of a modern spreadsheet.

Nested Class Summary
static class TableLayout.Column
static class TableLayout.Justify
static class TableLayout.Range
static class TableLayout.Row
Field Summary
Fields inherited from class thinwire.ui.layout.AbstractLayout
autoLayout, autoLayoutProps, container, limitLayout, margin, spacing
Constructor Summary
TableLayout(double[][] sizes)
TableLayout(double[][] sizes, int margin)
TableLayout(double[][] sizes, int margin, int spacing)
Method Summary
protected  void addComponent(Component comp)
 java.util.List<TableLayout.Column> getColumns()
          Get the Columns belonging to this Grid.
protected  java.lang.Object getFormalLimit(Component comp)
 java.util.List<TableLayout.Row> getRows()
          Get the Rows belonging to this Grid.
 java.util.SortedSet<TableLayout.Column> getVisibleColumns()
 java.util.SortedSet<TableLayout.Row> getVisibleRows()
protected  void limitChanged(Component comp, java.lang.Object oldLimit)
protected  void removeComponent(Component comp)
 java.lang.String toString()
protected  void update()
Methods inherited from class thinwire.ui.layout.AbstractLayout
apply, getContainer, getMargin, getSpacing, isAutoApply, setAutoApply, setContainer, setMargin, setSpacing
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public TableLayout(double[][] sizes)


public TableLayout(double[][] sizes,
                   int margin)


public TableLayout(double[][] sizes,
                   int margin,
                   int spacing)


public TableLayout()
Method Detail


protected void addComponent(Component comp)
addComponent in class AbstractLayout


protected void removeComponent(Component comp)
removeComponent in class AbstractLayout


protected void limitChanged(Component comp,
                            java.lang.Object oldLimit)
limitChanged in class AbstractLayout


protected java.lang.Object getFormalLimit(Component comp)
getFormalLimit in class AbstractLayout


protected void update()
update in class AbstractLayout


public java.util.List<TableLayout.Column> getColumns()
Description copied from interface: Grid
Get the Columns belonging to this Grid.

Specified by:
getColumns in interface Grid<TableLayout.Row,TableLayout.Column>
a list of all the columns in the Grid.


public java.util.List<TableLayout.Row> getRows()
Description copied from interface: Grid
Get the Rows belonging to this Grid.

Specified by:
getRows in interface Grid<TableLayout.Row,TableLayout.Column>
a list of all the rows in the Grid.


public java.util.SortedSet<TableLayout.Column> getVisibleColumns()


public java.util.SortedSet<TableLayout.Row> getVisibleRows()


public java.lang.String toString()
toString in class java.lang.Object

ThinWire® is a registered of Custom Credit Systems  Copyright © 2007 All rights reserved.
ThinWire_is_Open_Source_under_the_terms_of_the_LGPLv2.1 SourceForge.net_Project_Page java.net_Member Support_ThinWire,_Digg_our_Story