APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.text.html

pack-priv Class TableView

extends BoxView
implements ViewFactory
Class Inheritance
All Implemented Interfaces
javax.swing.text.ViewFactory
Imports
java.awt.*, java.util.BitSet, .Vector, .Arrays, javax.swing.SizeRequirements, javax.swing.event.DocumentEvent, javax.swing.text.*

HTML table view.
Author
Timothy Prinzing
See Also
View

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
TableView.CellView

Default view of an html table cell.

pack-priv class
pack-priv class
public class
TableView.RowView

View of a row in a row-centric table.

Field Summary

Modifier and TypeField and Description
private AttributeSet
private int
private int
captionIndex

The index of the caption view if there is a caption.

private int
pack-priv TableView.ColumnIterator
pack-priv int[]
pack-priv SizeRequirements[]
pack-priv int[]
private static final BitSet
pack-priv boolean
private boolean
multiRowCells

Do any of the table cells span multiple rows?

private StyleSheet.BoxPainter
private boolean
relativeCells

Do any of the table cells contain a relative size specification?

pack-priv TableView.RowIterator
pack-priv Vector<TableView.RowView>
pack-priv boolean
pack-priv SizeRequirements
totalColumnRequirements

SizeRequirements for all the columns.

Constructor Summary

AccessConstructor and Description
public
TableView(Element
the element that this view is responsible for
elem
)

Constructs a TableView for the given element.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addFill(int row, int col)

Mark a grid location as filled in for a cells overflow.

pack-priv void
calculateColumnRequirements(int axis)

Calculate the requirements for each column.

protected SizeRequirements
calculateMajorAxisRequirements(int axis, SizeRequirements r)

Overrides javax.swing.text.BoxView.calculateMajorAxisRequirements.

Calculate the requirements for the major axis.

protected SizeRequirements
calculateMinorAxisRequirements(int axis, SizeRequirements r)

Overrides javax.swing.text.BoxView.calculateMinorAxisRequirements.

Calculate the requirements for the minor axis.

public void
changedUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.View.changedUpdate.

Gives notification from the document that attributes were changed in a location that this view is responsible for.

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.

public View
create(Element elem)

Implements javax.swing.text.ViewFactory.create.

The table itself acts as a factory for the various views that actually represent pieces of the table.

protected TableView.RowView

Returns:

the row
createTableRow
(Element
an element
elem
)

Creates a new table row.

protected void
forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)

Overrides javax.swing.text.BoxView.forwardUpdate.

Forwards the given DocumentEvent to the child views that need to be notified of the change to the model.

public AttributeSet
getAttributes()

Overrides javax.swing.text.View.getAttributes.

Fetches the attributes to use when rendering.

public int
getColumnCount()

The number of columns in the table.

protected int
getColumnsOccupied(View v)

Determines the number of columns occupied by the table cell represented by given element.

public int
getColumnSpan(int col)

Fetches the span (width) of the given column.

public int
getMultiRowSpan(int row0, int row1)

Fetch the span of multiple rows.

pack-priv TableView.RowView
getRow(int row)

public int
getRowCount()

The number of rows in the table.

protected int
getRowsOccupied(View v)

Determines the number of rows occupied by the table cell represented by given element.

public int
getRowSpan(int row)

Fetches the span (height) of the given row.

protected StyleSheet
protected View
getViewAtPoint(int x, int y, Rectangle alloc)

Overrides javax.swing.text.BoxView.getViewAtPoint.

Fetches the child view at the given coordinates.

protected View

Returns:

the view representing the given position, or null if there isn't one
getViewAtPosition
(int
the 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.swing.text.CompositeView.getViewAtPosition.

Fetches the child view that represents the given position in the model.

public ViewFactory

Returns:

the factory, null if none
getViewFactory
()

Overrides javax.swing.text.View.getViewFactory.

Fetches the ViewFactory implementation that is feeding the view hierarchy.

public void
insertUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.View.insertUpdate.

Gives notification that something was inserted into the document in a location that this view is responsible for.

protected void
protected void

Returns:

the offset from the origin and the span for each column in the offsets and spans parameters
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
)

Layout the columns to fit within the given target span.

protected void

Returns:

the offset and span for each child view in the offsets and spans parameters
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.swing.text.BoxView.layoutMajorAxis.

Perform layout for the major axis of the box (i.e. the axis that it represents).

protected void

Returns:

the offset and span for each child view in the offsets and spans parameters
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.swing.text.BoxView.layoutMinorAxis.

Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents).

public void
paint(Graphics
the rendering surface to use
g
,
Shape
the allocated region to render into
allocation
)

Overrides javax.swing.text.BoxView.paint.

Renders using the given rendering surface and area on that surface.

public void
removeUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.View.removeUpdate.

Gives notification that something was removed from the document in a location that this view is responsible for.

public void
replace(int offset, int length, View[] views)

Overrides javax.swing.text.BoxView.replace.

Change the child views.

public void
setParent(View
the new parent, or null if the view is being removed from a parent it was previously added to
parent
)

Overrides javax.swing.text.CompositeView.setParent.

Establishes the parent view for this view.

protected void
setPropertiesFromAttributes()

Update any cached values that come from attributes.

pack-priv void
updateGrid()

Fill in the grid locations that are placeholders for multi-column, multi-row, and missing grid locations.

pack-priv void
updateInsets()

Update the insets, which contain the caption if there is a caption.

Inherited from javax.swing.text.BoxView:
baselineLayoutbaselineRequirementschildAllocationflipEastAndWestAtEndsgetAlignmentgetAxisgetChildAllocationgetHeightgetMaximumSpangetMinimumSpangetOffsetgetPreferredSpangetResizeWeightgetSpangetWidthisAfterisAllocationValidisBeforeisLayoutValidlayoutlayoutChangedmodelToViewpaintChildpreferenceChangedsetAxissetSizeviewToModel