|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.text.CompositeView javax.swing.text.BoxView javax.swing.text.html.TableView
HTML table view.
View
Nested Class Summary | |
(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. |
Field Summary | |
private AttributeSet |
attr
|
private int |
captionIndex
The index of the caption view if there is a caption. |
private int |
cellSpacing
|
(package private) TableView.ColumnIterator |
colIterator
|
(package private) int[] |
columnOffsets
|
(package private) SizeRequirements[] |
columnRequirements
|
(package private) int[] |
columnSpans
|
private static BitSet |
EMPTY
|
(package private) boolean |
gridValid
|
private boolean |
multiRowCells
Do any of the table cells span multiple rows? |
private StyleSheet.BoxPainter |
painter
|
private boolean |
relativeCells
Do any of the table cells contain a relative size specification? |
(package private) TableView.RowIterator |
rowIterator
|
(package private) Vector |
rows
|
(package private) SizeRequirements |
totalColumnRequirements
SizeRequirements for all the columns. |
Fields inherited from class javax.swing.text.BoxView |
|
Fields inherited from class javax.swing.text.CompositeView |
|
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
TableView(Element elem)
Constructs a TableView for the given element. |
Method Summary | |
(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. the axis that it represents). |
protected void |
layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Perform layout for the minor axis of the box (i.e. the axis orthoginal to the axis that it represents). |
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. |
Methods inherited from class javax.swing.text.BoxView |
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, viewToModel |
Methods inherited from class javax.swing.text.CompositeView |
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsets |
Methods inherited from class javax.swing.text.View |
append, breakView, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private AttributeSet attr
private StyleSheet.BoxPainter painter
private int cellSpacing
private int captionIndex
private boolean relativeCells
private boolean multiRowCells
int[] columnSpans
int[] columnOffsets
SizeRequirements totalColumnRequirements
SizeRequirements[] columnRequirements
TableView.RowIterator rowIterator
TableView.ColumnIterator colIterator
Vector rows
boolean gridValid
private static final BitSet EMPTY
Constructor Detail |
public TableView(Element elem)
elem
- the element that this view is responsible forMethod Detail |
protected TableView.RowView createTableRow(Element elem)
elem
- an element
public 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)
BoxView
getViewAtPoint
in class BoxView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the parents inner allocation on entry, which should
be changed to the childs allocation on exit
protected 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 column
void 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 BoxView
axis
- the axis being studiedr
- the SizeRequirements
object;
if null
one will be created
SizeRequirements
objectSizeRequirements
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
This is implemented to provide the superclass behavior adjusted for multi-row table cells.
calculateMajorAxisRequirements
in class BoxView
axis
- the axis being studiedr
- the SizeRequirements
object;
if null
one will be created
SizeRequirements
objectSizeRequirements
protected 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 BoxView
targetSpan
- 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 method
protected 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 BoxView
targetSpan
- 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 method
protected View getViewAtPosition(int pos, Rectangle a)
getViewAtPosition
in class CompositeView
pos
- the search position >= 0a
- the allocation to the table on entry, and the
allocation of the view containing the position on exit
public AttributeSet getAttributes()
getAttributes
in class View
public void paint(Graphics g, Shape allocation)
paint
in class BoxView
g
- 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 CompositeView
parent
- the new parent, or null if the view is
being removed from a parent it was previously added
topublic ViewFactory getViewFactory()
getViewFactory
in class View
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate
in class View
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)
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate
in class View
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.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate
in class View
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.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)
BoxView
DocumentEvent
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 BoxView
ec
- 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 BoxView
offset
- 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
null
to indicate no children are being added
(useful to remove)public View create(Element elem)
create
in interface ViewFactory
elem
- the piece of the document to build a view of
View
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |