|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
javax.swing.text.TableView
public abstract class TableView
A View
implementation for rendering tables inside styled text.
Tables are rendered as vertical boxes (see BoxView
). These boxes
have a number of child views, which are the rows of the table. These are
horizontal boxes containing the actuall cells of the table. These cells
can be arbitrary view implementations and are fetched via the
ViewFactory
returned by View.getViewFactory()
.
Nested Class Summary | |
---|---|
class |
TableView.TableCell
Deprecated. Table cells are now rendered by an arbitrary View
implementation. |
class |
TableView.TableRow
A view implementation that renders a row of a TableView . |
Field Summary |
---|
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 el)
Creates a new instance of TableView . |
Method Summary | |
---|---|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis,
SizeRequirements req)
Calculates the requirements of this view for the minor (== horizontal) axis. |
protected TableView.TableCell |
createTableCell(Element el)
Deprecated. Table cells are now rendered by an arbitrary View implementation. |
protected TableView.TableRow |
createTableRow(Element el)
Creates a view for a table row. |
protected void |
forwardUpdate(DocumentEvent.ElementChange ec,
DocumentEvent e,
Shape a,
ViewFactory vf)
Forwards the DocumentEvent to child views that need to get notified of the change to the model. |
protected View |
getViewAtPosition(int pos,
Rectangle a)
Returns the child view that represents the specified position in the model. |
protected void |
layoutColumns(int targetSpan,
int[] offsets,
int[] spans,
SizeRequirements[] reqs)
Lays out the columns to fit within the specified target span. |
protected void |
layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
Lays out the child views along the minor axis of the table (that is the horizontal axis). |
void |
replace(int offset,
int length,
View[] views)
Replaces a number of child views with a set of new child views. |
Methods inherited from class javax.swing.text.BoxView |
---|
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, flipEastAndWestAtEnds, getAlignment, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, modelToView, paint, 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, setParent |
Methods inherited from class javax.swing.text.View |
---|
append, breakView, changedUpdate, createFragment, dump, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableView(Element el)
TableView
.
el
- the element for which to create a table viewMethod Detail |
---|
public void replace(int offset, int length, View[] views)
replace
in class BoxView
offset
- the offset at which to replace child viewslength
- the number of child views to removeviews
- the new set of viewsprotected TableView.TableRow createTableRow(Element el)
el
- the element that represents the table row
protected TableView.TableCell createTableCell(Element el)
View
implementation.
el
- the element that represents the table cell
protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory vf)
View
View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
for each View that must be forwarded to.
If ec
is not null
(this means there have been
structural changes to the element that this view is responsible for) this
method should recognize this and don't notify newly added child views.
forwardUpdate
in class BoxView
ec
- the ElementChange describing the element changes (may be
null
if there were no changes)e
- the DocumentEvent describing the changes to the modela
- the current allocation of the viewvf
- the ViewFactory used to create new Viewsprotected void layoutColumns(int targetSpan, int[] offsets, int[] spans, SizeRequirements[] reqs)
targetSpan
- the total span for the columnsoffsets
- an array that holds the offsets of the columns when this
method returnsspans
- an array that holds the spans of the columns when this method
returnsreqs
- the size requirements for each columnprotected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
layoutColumns(int, int[], int[], javax.swing.SizeRequirements[])
to
layout the column layout of this table, and then forward to the superclass
to actually lay out the rows.
layoutMinorAxis
in class BoxView
targetSpan
- the available span along the minor (horizontal) axisaxis
- the axisoffsets
- an array that holds the offsets of the columns when this
method returnsspans
- an array that holds the spans of the columns when this method
returnsprotected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements req)
calculateMinorAxisRequirements
in class BoxView
axis
- the axisreq
- the size requirements object to use, if null
a new
one will be created
BoxView
along
the specified axisprotected View getViewAtPosition(int pos, Rectangle a)
getViewAtPosition
in class CompositeView
pos
- the model position for which to query the viewa
- the allocation of this view
null
if there is none
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |