table

A table is a grid of rows and columns.  A cell in the table can span any number of rows or columns.  Each cell in a table contains a component defined in a child tag.  Similar to HTML, each row of cells in a table must be encapsulated in a tr tag.  Each element inside of a tr tag defines a component to be placed inside a cell.  For simple grids with fixed-sized cells, the simplegrid container may be used instead.

Syntax

<table container attributes>

<tr>

    <component child component attributes> </component>

    <component child component attributes> </component>

. . .

</tr>

<tr>

    <component child component attributes> </component>

    <component child component attributes> </component>

. . .

</tr>

. . .   

</table>

Child Tags

Tag

Values

Restrictions

Description

<tr>

 

 

Encapsulates a row.

<component>

Any valid component tag

 

Defines the component for a table cell. Must be a child of a tr tag.

Container Attributes

See General Attributes.

Child Component Attributes

The following set of attributes controls the layout of cells and components. To control the appearance of the table contents, these additional attributes should be defined in the child tags that define the content of the table cells.

Attribute

Values

Restrictions

Description

fill

 

 

Controls how the component inside of a table cell fills the cell itself.

none

Uses the component’s natural width and height and floats it inside of the cell.

Horizontal

Uses the component’s natural height but fills the horizontal space.

Vertical

Uses the component’s natural width but fills the vertical space.

both

Ignores the  component’s natural width and fills the entire cell.

anchor

center

north

northeast

east

southeast

south

southwest

west

northwest

 

If the fill is set to anything other than both, this controls where the component is attached to the cell.

MC900329243[1]

rowspan

Positive integer

Cells must not collide

The number of rows spanned by a cell.

colspan

Positive integer

Cells must not collide

The number of columns spanned by a cell.

insets

4 positive integers separated by commas.

e.g. “5,5,5,5”

 

Specifies padding around the component.  The 4 numbers represent the top, left, bottom, and right padding.  The insets are specified in pixels.

weightx

Double value between +0.0 and 1.0

 

Specifies how to distribute extra horizontal space.

 

The table calculates the weight of a column to be the maximum weightx of all the components in a column. If the resulting layout is smaller horizontally than the area it needs to fill, the extra space is distributed to each column in proportion to its weight. A column that has a weight of zero receives no extra space.

 

If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.

weighty

Double value between +0.0 and 1.0

 

Specifies how to distribute extra vertical space.

 

The table calculates the weight of a row to be the maximum weighty of all the components in a row. If the resulting layout is smaller vertically than the area it needs to fill, the extra space is distributed to each row in proportion to its weight. A row that has a weight of zero receives no extra space.

 

If all the weights are zero, all the extra space appears between the grids of the cell and the top and bottom edges.

orientation

horizontal

vertical

Only applies to element tags that return multiple components.

If a tag returns multiple components (e.g. a param tag for an array parameter), this specifies whether the returned components should be in the same row (horizontal) or in the same column (vertical).

minw

Positive integer

 

The minimum width of the component in pixels.  This is considered a hint and may or may not be honored by DashBoard.

minh

Positive integer

 

The minimum height of the component in pixels.  This is considered a hint and may or may not be honored by DashBoard.

maxw

Positive integer

 

The maximum width of the component in pixels.  This is considered a hint and may or may not be honored by DashBoard.

maxh

Positive integer

 

The maximum height of the component in pixels.  This is considered a hint and may or may not be honored by DashBoard.

placeholders

Positive integer

Default 0

 

This tag specifies the minimum number of elements which are expected to be returned by a tag.  If a tag returns fewer than the specified number of elements, placeholder elements are created and added to the layout in their place.

 

A value of 0 means that the tag is ignored if no elements were returned (or the tag is undefined).

maxperrow

Positive integer

Default -1

 

A value > 0 defines the maximum number of elements in a row.  Additional elements will be placed on the next row.

Default values shown in bold.

Note:            DashBoard uses a Java Swing GridBagLayout internally.  For more information about GridBagLayout, please see http://docs.oracle.com/javase/8/docs/api/java/awt/GridBagLayout.html

Example

The following sample utilizes a table to create a numeric keypad.

<table height="300" left="16" top="16" width="300">

<tr>

    <button buttontype="push" fill="both" name="1"> </button>

    <button buttontype="push" fill="both" name="2"> </button>

    <button buttontype="push" fill="both" name="3"> </button>

</tr>

<tr>

    <button buttontype="push" fill="both" name="4"> </button>

    <button buttontype="push" fill="both" name="5"> </button>

    <button buttontype="push" fill="both" name="6"> </button>

</tr>

<tr>

    <button buttontype="push" fill="both" name="7"> </button>

    <button buttontype="push" fill="both" name="8"> </button>

    <button buttontype="push" fill="both" name="9"> </button>

</tr>

<tr>

    <button buttontype="push" fill="both" name="*"> </button>

    <button buttontype="push" fill="both" name="0"> </button>

    <button buttontype="push" fill="both" name="#"> </button>

</tr>

</table>