class TableView extends BoxView implements ViewFactory
View| Modifier and Type | Class and Description |
|---|---|
(package private) class |
TableView.CellView
Default view of an html table cell.
|
(package private) class |
TableView.ColumnIterator |
(package private) class |
TableView.RowIterator |
class |
TableView.RowView
View of a row in a row-centric table.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) TableView.ColumnIterator |
colIterator |
(package private) int[] |
columnOffsets |
(package private) SizeRequirements[] |
columnRequirements |
(package private) int[] |
columnSpans |
(package private) boolean |
gridValid |
(package private) TableView.RowIterator |
rowIterator |
(package private) Vector |
rows |
(package private) boolean |
skipComments |
(package private) SizeRequirements |
totalColumnRequirements
SizeRequirements for all the columns.
|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Constructor and Description |
|---|
TableView(Element elem)
Constructs a TableView for the given element.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addFill(int row,
int col)
Mark a grid location as filled in for a cells overflow.
|
(package private) void |
calculateColumnRequirements(int axis)
Calculate the requirements for each column.
|
protected SizeRequirements |
calculateMajorAxisRequirements(int axis,
SizeRequirements r)
Calculate the requirements for the major axis.
|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis,
SizeRequirements r)
Calculate the requirements for the minor axis.
|
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Gives notification from the document that attributes were changed
in a location that this view is responsible for.
|
(package private) void |
checkMultiColumnCell(int axis,
int col,
int ncols,
View v)
check the requirements of a table cell that spans multiple
columns.
|
(package private) void |
checkSingleColumnCell(int axis,
int col,
View v)
check the requirements of a table cell that spans a single column.
|
View |
create(Element elem)
The table itself acts as a factory for the various
views that actually represent pieces of the table.
|
protected TableView.RowView |
createTableRow(Element elem)
Creates a new table row.
|
protected void |
forwardUpdate(DocumentEvent.ElementChange ec,
DocumentEvent e,
Shape a,
ViewFactory f)
Forwards the given
DocumentEvent to the child views
that need to be notified of the change to the model. |
AttributeSet |
getAttributes()
Fetches the attributes to use when rendering.
|
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.
|
int |
getColumnSpan(int col)
Fetches the span (width) of the given column.
|
int |
getMultiRowSpan(int row0,
int row1)
Fetch the span of multiple rows.
|
(package private) TableView.RowView |
getRow(int row) |
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.
|
int |
getRowSpan(int row)
Fetches the span (height) of the given row.
|
protected StyleSheet |
getStyleSheet() |
protected View |
getViewAtPoint(int x,
int y,
Rectangle alloc)
Fetches the child view at the given coordinates.
|
protected View |
getViewAtPosition(int pos,
Rectangle a)
Fetches the child view that represents the given position in
the model.
|
ViewFactory |
getViewFactory()
Fetches the ViewFactory implementation that is feeding
the view hierarchy.
|
void |
insertUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Gives notification that something was inserted into
the document in a location that this view is responsible for.
|
protected void |
invalidateGrid() |
protected void |
layoutColumns(int targetSpan,
int[] offsets,
int[] spans,
SizeRequirements[] reqs)
Layout the columns to fit within the given target span.
|
protected void |
layoutMajorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Perform layout for the major axis of the box (i.e.
|
protected void |
layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Perform layout for the minor axis of the box (i.e.
|
void |
paint(Graphics g,
Shape allocation)
Renders using the given rendering surface and area on that
surface.
|
void |
removeUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Gives notification that something was removed from the document
in a location that this view is responsible for.
|
void |
replace(int offset,
int length,
View[] views)
Change the child views.
|
void |
setParent(View parent)
Establishes the parent view for this view.
|
protected void |
setPropertiesFromAttributes()
Update any cached values that come from attributes.
|
(package private) void |
updateGrid()
Fill in the grid locations that are placeholders
for multi-column, multi-row, and missing grid
locations.
|
(package private) void |
updateInsets()
Update the insets, which contain the caption if there
is a caption.
|
baselineLayout, baselineRequirements, childAllocation, flipEastAndWestAtEnds, getAlignment, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, modelToView, paintChild, preferenceChanged, setAxis, setSize, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsetsappend, breakView, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModelint[] columnSpans
int[] columnOffsets
SizeRequirements totalColumnRequirements
SizeRequirements[] columnRequirements
TableView.RowIterator rowIterator
TableView.ColumnIterator colIterator
boolean skipComments
boolean gridValid
protected TableView.RowView createTableRow(Element elem)
elem - an elementpublic int getColumnCount()
public int getColumnSpan(int col)
public int getRowCount()
public int getMultiRowSpan(int row0, int row1)
public int getRowSpan(int row)
TableView.RowView getRow(int row)
protected View getViewAtPoint(int x, int y, Rectangle alloc)
BoxViewgetViewAtPoint in class BoxViewx - the X coordinate >= 0y - the Y coordinate >= 0alloc - the parents inner allocation on entry, which should
be changed to the childs allocation on exitprotected int getColumnsOccupied(View v)
protected int getRowsOccupied(View v)
protected void invalidateGrid()
protected StyleSheet getStyleSheet()
void updateInsets()
protected void setPropertiesFromAttributes()
void updateGrid()
void addFill(int row, int col)
protected void layoutColumns(int targetSpan, int[] offsets, int[] spans, SizeRequirements[] reqs)
targetSpan - the given span for total of all the table
columnsreqs - the requirements desired for each column. This
is the column maximum of the cells minimum, preferred, and
maximum requested spanspans - the return value of how much to allocated to
each columnoffsets - the return value of the offset from the
origin for each columnvoid calculateColumnRequirements(int axis)
void checkSingleColumnCell(int axis, int col, View v)
void checkMultiColumnCell(int axis, int col, int ncols, View v)
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
This is implemented to calculate the requirements as the sum of the requirements of the columns and then adjust it if the CSS width or height attribute is specified and applicable to the axis.
calculateMinorAxisRequirements in class BoxViewaxis - the axis being studiedr - the SizeRequirements object;
if null one will be createdSizeRequirements objectSizeRequirementsprotected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
This is implemented to provide the superclass behavior adjusted for multi-row table cells.
calculateMajorAxisRequirements in class BoxViewaxis - the axis being studiedr - the SizeRequirements object;
if null one will be createdSizeRequirements objectSizeRequirementsprotected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
This is implemented to call the layoutColumns method, and then forward to the superclass to actually carry out the layout of the tables rows.
layoutMinorAxis in class BoxViewtargetSpan - the total span given to the view, which
whould be used to layout the childrenaxis - the axis being layed outoffsets - 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 methodspans - the span of each child view; this is a return
value and is filled in by the implementation of this methodprotected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
This method is where the layout of the table rows within the table takes place. This method is implemented to call the use the RowIterator and the CSS collapsing tile to layout with border spacing and border collapsing capabilities.
layoutMajorAxis in class BoxViewtargetSpan - the total span given to the view, which
whould be used to layout the childrenaxis - the axis being layed outoffsets - 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 methodspans - the span of each child view; this is a return
value and is filled in by the implementation of this methodprotected View getViewAtPosition(int pos, Rectangle a)
getViewAtPosition in class CompositeViewpos - the search position >= 0a - the allocation to the table on entry, and the
allocation of the view containing the position on exitpublic AttributeSet getAttributes()
getAttributes in class Viewpublic void paint(Graphics g, Shape allocation)
paint in class BoxViewg - the rendering surface to useallocation - the allocated region to render intoView.paint(java.awt.Graphics, java.awt.Shape)public void setParent(View parent)
This is implemented to forward to the superclass as well as call the setPropertiesFromAttributes method to set the paragraph properties from the css attributes. The call is made at this time to ensure the ability to resolve upward through the parents view attributes.
setParent in class CompositeViewparent - the new parent, or null if the view is
being removed from a parent it was previously added
topublic ViewFactory getViewFactory()
getViewFactory in class Viewpublic void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate in class Viewe - the change information from the associated documenta - the current allocation of the viewf - the factory to use to rebuild if the view has childrenView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate in class Viewe - the change information from the associated documenta - the current allocation of the viewf - the factory to use to rebuild if the view has childrenView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate in class Viewe - the change information from the associated documenta - the current allocation of the viewf - the factory to use to rebuild if the view has childrenView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)
BoxViewDocumentEvent to the child views
that need to be notified of the change to the model.
If a child changed its requirements and the allocation
was valid prior to forwarding the portion of the box
from the starting child to the end of the box will
be repainted.forwardUpdate in class BoxViewec - changes to the element this view is responsible
for (may be null if there were no changes)e - the change information from the associated documenta - the current allocation of the viewf - the factory to use to rebuild if the view has childrenView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory),
View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory),
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)public void replace(int offset, int length, View[] views)
replace in class BoxViewoffset - the starting index into the child views to insert
the new views; this should be a value >= 0 and <= getViewCountlength - the number of existing child views to remove;
This should be a value >= 0 and <= (getViewCount() - offset)views - the child views to add; this value can be
nullto indicate no children are being added
(useful to remove)public View create(Element elem)
create in interface ViewFactoryelem - the piece of the document to build a view ofView