Implements View interface for a table, that is composed of an element structure where the child elements of the element this view is responsible for represent rows and the child elements of the row elements are cells. The cell elements can have an arbitrary element structure under them, which will be built with the ViewFactory returned by the getViewFactory method.
TABLE ROW CELL CELL ROW CELL CELL
This is implemented as a hierarchy of boxes, the table itself is a vertical box, the rows are horizontal boxes, and the cells are vertical boxes. The cells are allowed to span multiple columns and rows. By default, the table can be thought of as being formed over a grid (i.e. somewhat like one would find in gridbag layout), where table cells can request to span more than one grid cell. The default horizontal span of table cells will be based upon this grid, but can be changed by reimplementing the requested span of the cell (i.e. table cells can have independent spans if desired).
View
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | TableView.
THIS IS NO LONGER USED, AND WILL BE REMOVED IN THE NEXT RELEASE. |
| public class | TableView.
Deprecated
A table cell can now be any View implementation.
|
| public class | TableView.
View of a row in a row-centric table. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int[] | |
| pack-priv SizeRequirements[] | |
| pack-priv int[] | |
| private static final BitSet | |
| pack-priv boolean | |
| pack-priv Vector | |
| pack-priv SizeRequirements |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| protected SizeRequirements | calculateMinorAxisRequirements(int axis, SizeRequirements r)
Overrides javax. Calculate the requirements for the minor axis. |
| pack-priv void | checkMultiColumnCell(int axis, int col, int ncols, View v)
check the requirements of a table cell that spans multiple columns. |
| pack-priv void | checkSingleColumnCell(int axis, int col, View v)
check the requirements of a table cell that spans a single column. |
| protected TableView. | createTableCell(Element
an element elem)
Deprecated
Table cells can now be any arbitrary
View implementation and should be produced by the
ViewFactory rather than the table.
Returns: the cell |
| protected TableView. | |
| protected void | forwardUpdate(DocumentEvent.
Overrides javax. Forwards the given |
| pack-priv int | |
| pack-priv int | getColumnsOccupied(View v)
Determines the number of columns occupied by the table cell represented by given element. |
| pack-priv int | |
| pack-priv TableView. | |
| pack-priv int | |
| pack-priv int | getRowsOccupied(View v)
Determines the number of rows occupied by the table cell represented by given element. |
| pack-priv int | |
| protected View | Returns: the view representing the given position, ornull if there isn't onethe search position >= 0 pos, Rectangle the allocation to the table on entry, and the
allocation of the view containing the position on exit a)Overrides javax. Fetches the child view that represents the given position in the model. |
| pack-priv void | |
| protected void | layoutColumns(int
the given span for total of all the table
columns targetSpan, int[] the return value of the offset from the
origin for each column offsets, int[] the return value of how much to allocated to
each column spans, SizeRequirements[] the requirements desired for each column. This
is the column maximum of the cells minimum, preferred, and
maximum requested span reqs)Lays out the columns to fit within the given target span. |
| protected void | layoutMinorAxis(int
the total span given to the view, which
would be used to layout the children. targetSpan, int the axis being laid out. axis, int[] the offsets from the origin of the view for
each of the child views. This is a return value and is
filled in by the implementation of this method. offsets, int[] the span of each child view. This is a return
value and is filled in by the implementation of this method. spans)Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents). |
| public void | replace(int offset, int length, View[] views)
Overrides javax. Change the child views. |
| pack-priv void | updateGrid()
Fill in the grid locations that are placeholders for multi-column, multi-row, and missing grid locations. |
| columnOffsets | back to summary |
|---|---|
| pack-priv int[] columnOffsets | |
| columnRequirements | back to summary |
|---|---|
| pack-priv SizeRequirements[] columnRequirements | |
| columnSpans | back to summary |
|---|---|
| pack-priv int[] columnSpans | |
| EMPTY | back to summary |
|---|---|
| private static final BitSet EMPTY | |
| gridValid | back to summary |
|---|---|
| pack-priv boolean gridValid | |
| rows | back to summary |
|---|---|
| pack-priv Vector<TableView. | |
| totalColumnRequirements | back to summary |
|---|---|
| pack-priv SizeRequirements totalColumnRequirements | |
| TableView | back to summary |
|---|---|
| public TableView(Element elem) Constructs a TableView for the given element.
| |
| addFill | back to summary |
|---|---|
| pack-priv void addFill(int row, int col) Mark a grid location as filled in for a cells overflow. | |
| calculateColumnRequirements | back to summary |
|---|---|
| pack-priv void calculateColumnRequirements(int axis) Calculate the requirements for each column. The calculation is done as two passes over the table. The table cells that occupy a single column are scanned first to determine the maximum of minimum, preferred, and maximum spans along the give axis. Table cells that span multiple columns are excluded from the first pass. A second pass is made to determine if the cells that span multiple columns are satisfied. If the column requirements are not satisfied, the needs of the multi-column cell is mixed into the existing column requirements. The calculation of the multi-column distribution is based upon the proportions of the existing column requirements and taking into consideration any constraining maximums. | |
| calculateMinorAxisRequirements | back to summary |
|---|---|
| protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) Overrides javax. Calculate the requirements for the minor axis. This is called by the superclass whenever the requirements need to be updated (i.e. a preferenceChanged was messaged through this view). This is implemented to calculate the requirements as the sum of the requirements of the columns. | |
| checkMultiColumnCell | back to summary |
|---|---|
| pack-priv void checkMultiColumnCell(int axis, int col, int ncols, View v) check the requirements of a table cell that spans multiple columns. | |
| checkSingleColumnCell | back to summary |
|---|---|
| pack-priv void checkSingleColumnCell(int axis, int col, View v) check the requirements of a table cell that spans a single column. | |
| createTableCell | back to summary |
|---|---|
| protected TableView. Deprecated Table cells can now be any arbitrary View implementation and should be produced by the ViewFactory rather than the table. | |
| createTableRow | back to summary |
|---|---|
| protected TableView. Creates a new table row. | |
| forwardUpdate | back to summary |
|---|---|
| protected void forwardUpdate(DocumentEvent. Overrides javax. Doc from javax. Forwards the given | |
| getColumnCount | back to summary |
|---|---|
| pack-priv int getColumnCount() The number of columns in the table. | |
| getColumnsOccupied | back to summary |
|---|---|
| pack-priv int getColumnsOccupied(View v) Determines the number of columns occupied by the table cell represented by given element. | |
| getColumnSpan | back to summary |
|---|---|
| pack-priv int getColumnSpan(int col) Fetches the span (width) of the given column. This is used by the nested cells to query the sizes of grid locations outside of themselves. | |
| getRow | back to summary |
|---|---|
| pack-priv TableView. | |
| getRowCount | back to summary |
|---|---|
| pack-priv int getRowCount() The number of rows in the table. | |
| getRowsOccupied | back to summary |
|---|---|
| pack-priv int getRowsOccupied(View v) Determines the number of rows occupied by the table cell represented by given element. | |
| getRowSpan | back to summary |
|---|---|
| pack-priv int getRowSpan(int row) Fetches the span (height) of the given row. | |
| getViewAtPosition | back to summary |
|---|---|
| protected View getViewAtPosition(int pos, Rectangle a) Overrides javax. Fetches the child view that represents the given position in the model. This is implemented to walk through the children looking for a range that contains the given position. In this view the children do not necessarily have a one to one mapping with the child elements. | |
| invalidateGrid | back to summary |
|---|---|
| pack-priv void invalidateGrid() | |
| layoutColumns | back to summary |
|---|---|
| protected void layoutColumns(int targetSpan, int[] offsets, int[] spans, SizeRequirements[] reqs) Lays out the columns to fit within the given target span.
Returns the results through
| |
| layoutMinorAxis | back to summary |
|---|---|
| protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the minor axis. This is called by the superclass whenever the layout needs to be updated along the minor axis.
This is implemented to call the
| |
| replace | back to summary |
|---|---|
| public void replace(int offset, int length, View[] views) Overrides javax. Change the child views. This is implemented to provide the superclass behavior and invalidate the grid so that rows and columns will be recalculated. | |
| updateGrid | back to summary |
|---|---|
| pack-priv void updateGrid() Fill in the grid locations that are placeholders for multi-column, multi-row, and missing grid locations. | |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of columnsGets the number of columns this cell spans (e.g. the grid width). |
| public int | |
| public int | |
| public int | Returns: the number of rowsGets the number of rows this cell spans (that is, the grid height). |
| public void |
| getColumnCount | back to summary |
|---|---|
| public int getColumnCount() Gets the number of columns this cell spans (e.g. the grid width).
| |
| getGridColumn | back to summary |
|---|---|
| public int getGridColumn() Gets the column of the grid location | |
| getGridRow | back to summary |
|---|---|
| public int getGridRow() Gets the row of the grid location | |
| getRowCount | back to summary |
|---|---|
| public int getRowCount() Gets the number of rows this cell spans (that is, the grid height).
| |
| setGridLocation | back to summary |
|---|---|
| public void setGridLocation(int row, int col) Sets the grid location.
| |
Deprecated
A table cell can now be any View implementation.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of columnsImplements javax. Gets the number of columns this cell spans (e.g. the grid width). |
| public int | getGridColumn()
Implements javax. Gets the column of the grid location |
| public int | getGridRow()
Implements javax. Gets the row of the grid location |
| public int | Returns: the number of rowsImplements javax. Gets the number of rows this cell spans (that is, the grid height). |
| public void | setGridLocation(int
the row >= 0 row, int the column >= 0 col)Implements javax. Sets the grid location. |
| TableCell | back to summary |
|---|---|
| public TableCell(Element elem) Constructs a TableCell for the given element.
| |
| getColumnCount | back to summary |
|---|---|
| public int getColumnCount() Implements javax. Gets the number of columns this cell spans (e.g. the grid width).
| |
| getGridColumn | back to summary |
|---|---|
| public int getGridColumn() Implements javax. Gets the column of the grid location | |
| getGridRow | back to summary |
|---|---|
| public int getGridRow() Implements javax. Gets the row of the grid location | |
| getRowCount | back to summary |
|---|---|
| public int getRowCount() Implements javax. Gets the number of rows this cell spans (that is, the grid height).
| |
| setGridLocation | back to summary |
|---|---|
| public void setGridLocation(int row, int col) Implements javax. Sets the grid location.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv BitSet | fillColumns
columns filled by multi-column or multi-row cells |
| pack-priv int | row
the row within the overall grid |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected SizeRequirements | calculateMajorAxisRequirements(int axis, SizeRequirements r)
Overrides javax. Calculates the size requirements for the major axis
|
| pack-priv void | |
| pack-priv void | |
| pack-priv int | |
| public float | getMaximumSpan(int axis)
Overrides javax. Determines the maximum span for this view along an axis. |
| public float | getMinimumSpan(int axis)
Overrides javax. Determines the minimum span for this view along an axis. |
| public float | getPreferredSpan(int axis)
Overrides javax. Determines the preferred span for this view along an axis. |
| public int | Returns: the resize weightmay be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the resizability of the view along the given axis. |
| pack-priv int | |
| protected View | Returns: the view representing the given position, ornull if there isn't onethe search position >= 0 pos, Rectangle the allocation to the table on entry, and the
allocation of the view containing the position on exit a)Overrides javax. Fetches the child view that represents the given position in the model. |
| pack-priv boolean | |
| protected void | layoutMajorAxis(int
the total span given to the view, which
would be used to layout the children. targetSpan, int the axis being laid out. axis, int[] the offsets from the origin of the view for
each of the child views. This is a return value and is
filled in by the implementation of this method. offsets, int[] the span of each child view. This is a return
value and is filled in by the implementation of this method. spans)Overrides javax. Perform layout for the major axis of the box (i.e. the axis that it represents). |
| protected void | layoutMinorAxis(int
the total span given to the view, which
would be used to layout the children. targetSpan, int the axis being laid out. axis, int[] the offsets from the origin of the view for
each of the child views. This is a return value and is
filled in by the implementation of this method. offsets, int[] the span of each child view. This is a return
value and is filled in by the implementation of this method. spans)Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents). |
| public void | replace(int offset, int length, View[] views)
Overrides javax. Change the child views. |
| pack-priv void | setRow(int row)
set location in the overall set of rows, this is set by the TableView.updateGrid() method. |
| fillColumns | back to summary |
|---|---|
| pack-priv BitSet fillColumns columns filled by multi-column or multi-row cells | |
| row | back to summary |
|---|---|
| pack-priv int row the row within the overall grid | |
| TableRow | back to summary |
|---|---|
| public TableRow(Element elem) Constructs a TableView for the given element.
| |
| calculateMajorAxisRequirements | back to summary |
|---|---|
| protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) Overrides javax. Doc from javax. Calculates the size requirements for the major axis
| |
| clearFilledColumns | back to summary |
|---|---|
| pack-priv void clearFilledColumns() | |
| fillColumn | back to summary |
|---|---|
| pack-priv void fillColumn(int col) | |
| getColumnCount | back to summary |
|---|---|
| pack-priv int getColumnCount() The number of columns present in this row. | |
| getMaximumSpan | back to summary |
|---|---|
| public float getMaximumSpan(int axis) Overrides javax. Doc from javax. Determines the maximum span for this view along an axis.
| |
| getMinimumSpan | back to summary |
|---|---|
| public float getMinimumSpan(int axis) Overrides javax. Doc from javax. Determines the minimum span for this view along an axis.
| |
| getPreferredSpan | back to summary |
|---|---|
| public float getPreferredSpan(int axis) Overrides javax. Doc from javax. Determines the preferred span for this view along an axis.
| |
| getResizeWeight | back to summary |
|---|---|
| public int getResizeWeight(int axis) Overrides javax. Determines the resizability of the view along the given axis. A value of 0 or less is not resizable.
| |
| getRow | back to summary |
|---|---|
| pack-priv int getRow() get location in the overall set of rows | |
| getViewAtPosition | back to summary |
|---|---|
| protected View getViewAtPosition(int pos, Rectangle a) Overrides javax. Fetches the child view that represents the given position in the model. This is implemented to walk through the children looking for a range that contains the given position. In this view the children do not necessarily have a one to one mapping with the child elements. | |
| isFilled | back to summary |
|---|---|
| pack-priv boolean isFilled(int col) | |
| layoutMajorAxis | back to summary |
|---|---|
| protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) Overrides javax. Perform layout for the major axis of the box (i.e. the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the major axis. This is re-implemented to give each child the span of the column width for the table, and to give cells that span multiple columns the multi-column span.
| |
| layoutMinorAxis | back to summary |
|---|---|
| protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the minor axis. This is called by the superclass whenever the layout needs to be updated along the minor axis. This is implemented to delegate to the superclass, then adjust the span for any cell that spans multiple rows.
| |
| replace | back to summary |
|---|---|
| public void replace(int offset, int length, View[] views) Overrides javax. Change the child views. This is implemented to provide the superclass behavior and invalidate the grid so that rows and columns will be recalculated. | |
| setRow | back to summary |
|---|---|
| pack-priv void setRow(int row) set location in the overall set of rows, this is set by the TableView.updateGrid() method. | |