thinwire.ui.layout
Class TableLayout
java.lang.Object
thinwire.ui.layout.AbstractLayout
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 http://tablelayout.dev.java.net/. While, the TableLayout project
at java.net 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TableLayout
public TableLayout(double[][] sizes)
TableLayout
public TableLayout(double[][] sizes,
int margin)
TableLayout
public TableLayout(double[][] sizes,
int margin,
int spacing)
TableLayout
public TableLayout()
addComponent
protected void addComponent(Component comp)
- Overrides:
addComponent
in class AbstractLayout
removeComponent
protected void removeComponent(Component comp)
- Overrides:
removeComponent
in class AbstractLayout
limitChanged
protected void limitChanged(Component comp,
java.lang.Object oldLimit)
- Overrides:
limitChanged
in class AbstractLayout
getFormalLimit
protected java.lang.Object getFormalLimit(Component comp)
- Overrides:
getFormalLimit
in class AbstractLayout
update
protected void update()
- Overrides:
update
in class AbstractLayout
getColumns
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>
- Returns:
- a list of all the columns in the Grid.
getRows
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>
- Returns:
- a list of all the rows in the Grid.
getVisibleColumns
public java.util.SortedSet<TableLayout.Column> getVisibleColumns()
getVisibleRows
public java.util.SortedSet<TableLayout.Row> getVisibleRows()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object