Table2GridBag expects the layout to be specified as an (X)HTML table. It does not matter whether the input file contains just a table definition or a complete HTML document (in the later case, all tags except TABLE, TR and TD are silently ignored). Nevertheless, some constraints apply:
- When a complete HTML document is given, it must be well formed.
- The input file must contain exactly one table definition. Nesting within each other tables is not allowed.
- At least one table cell must have a width and a height attribute. Otherwise, the resulting layout code will clump all components together in one place.
- Table cells may span rows or columns as long as they remain rectangular. Cells may not overlap each other or have gaps in between them.
- Cells must only contain the name of the component, they are referring to. The name may be surrounded by whitespace.
- Cells may be left "empty" by immediately closing the TD tag or by only putting spaces in them to indicate that this cell should automatically be populated by a filler component.
Attributes of the TABLE tag
- border
-
The border attribute is ignored by Table2GridBag, but should be given anyway, so the table shows properly in a web browser.
- cellpadding
- Global value for
GridBagConstraints.ipadxand code>GridBagConstraints.ipady field.
- cellspacing
- Global default value for
GridBagConstraints.insets(same on all four sides). This can be overridden individually for each table cell.
The use of attributes other than border is discouraged.
Attributes of the TR tag
The table row tag does not support any attributes.
Attributes of the TD tag
- rowspan
- Value for the
GridBagConstraints.gridwidthfield. The default value is "1".
- colspan
- Value for the
GridBagConstraints.gridheightfield. The default value is "1".
- width
- Value for the
GridBagConstraints.weigthxfield. The default value is "0". At least one cell must specify a non zero value for this attribute. Values must be specified in percent.
- height
- Value for the
GridBagConstraints.weigthyfield. The default value is "0". At least one cell must specify a non zero value for this attribute. Values must be specified in percent.
- align
- Specifies the horizontal anchor alignment. The use of this attribute is deprecated. Use the
styleattribute instead.
- valign
- Specifies the vertical anchor alignment. The use of this attribute is deprecated. Use the
styleattribute instead.
- style
-
This attribute allows for the individual styling of the component. The aspects that can be styled are the anchor position, the way the component expands and it's insets. By default, components are centered, stretch in both directions and have a zero pixel padding. This is equivalent to giving the style as:
style="fill:both ; anchor:center ; insets:0,0,0,0"
The value of the style attribute is case insensitive, parameters may be given in any order (or not be present at all) and can be separated from each other by any amount of white space (including none).
The optional CAPTION tag
You may use the HTML caption tag to give the table a caption. When you do, that tag must contain a fully qualified class name and table2gridbag will automatically produce a complete Java class by that name. Example:
<table> <caption>de.onyxbits.Layout</caption> <tr> <td width="100%" height="100%">myComponent</td> </tr> </table>
The caption can always be overridden on the commandline via the -Dclass= argument.
