|
||||||||||
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.FlowView.LogicalView
This class can be used to represent a logical view for a flow. It keeps the children updated to reflect the state of the model, gives the logical child views access to the view hierarchy, and calculates a preferred span. It doesn't do any rendering, layout, or model/view translation.
Field Summary |
Fields inherited from class javax.swing.text.CompositeView |
|
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, sharedBiasReturn, 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 | |
(package private) |
FlowView.LogicalView(Element elem)
|
Method Summary | |
protected void |
childAllocation(int index,
Rectangle a)
Returns the allocation for a given child. |
protected void |
forwardUpdateToView(View v,
DocumentEvent e,
Shape a,
ViewFactory f)
Forward the DocumentEvent to the given child view. |
AttributeSet |
getAttributes()
Fetches the attributes to use when rendering. |
float |
getMinimumSpan(int axis)
Determines the minimum span for this view along an axis. |
float |
getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. |
protected View |
getViewAtPoint(int x,
int y,
Rectangle alloc)
Fetches the child view at the given point. |
protected int |
getViewIndexAtPosition(int pos)
Fetches the child view index representing the given position in the model. |
protected boolean |
isAfter(int x,
int y,
Rectangle alloc)
Tests whether a point lies after the rectangle range. |
protected boolean |
isBefore(int x,
int y,
Rectangle alloc)
Tests whether a point lies before the rectangle range. |
protected void |
loadChildren(ViewFactory f)
Loads all of the children to initialize the view. |
void |
paint(Graphics g,
Shape allocation)
Renders using the given rendering surface and area on that surface. |
Methods inherited from class javax.swing.text.CompositeView |
flipEastAndWestAtEnds, getBottomInset, getChildAllocation, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, modelToView, replace, setInsets, setParagraphInsets, setParent, viewToModel |
Methods inherited from class javax.swing.text.View |
append, breakView, changedUpdate, createFragment, forwardUpdate, getAlignment, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getParent, getResizeWeight, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, preferenceChanged, remove, removeAll, removeUpdate, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
FlowView.LogicalView(Element elem)
Method Detail |
protected int getViewIndexAtPosition(int pos)
CompositeView
getViewIndexAtPosition
in class CompositeView
pos
- the position >= 0
protected void loadChildren(ViewFactory f)
CompositeView
CompositeView.setParent(javax.swing.text.View)
method. Subclasses can reimplement this to initialize
their child views in a different manner. The default
implementation creates a child view for each
child element.
loadChildren
in class CompositeView
f
- the view factoryCompositeView.setParent(javax.swing.text.View)
public AttributeSet getAttributes()
getAttributes
in class View
public float getPreferredSpan(int axis)
getPreferredSpan
in class View
axis
- may be either View.X_AXIS or View.Y_AXIS
View.getPreferredSpan(int)
public float getMinimumSpan(int axis)
getMinimumSpan
in class View
axis
- may be either View.X_AXIS or View.Y_AXIS
View.getPreferredSpan(int)
protected void forwardUpdateToView(View v, DocumentEvent e, Shape a, ViewFactory f)
forwardUpdateToView
in class View
v
- the child view to forward the event to.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.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void paint(Graphics g, Shape allocation)
paint
in class View
g
- the rendering surface to useallocation
- the allocated region to render intoView.paint(java.awt.Graphics, java.awt.Shape)
protected boolean isBefore(int x, int y, Rectangle alloc)
isBefore
in class CompositeView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the rectangle
protected boolean isAfter(int x, int y, Rectangle alloc)
isAfter
in class CompositeView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the rectangle
protected View getViewAtPoint(int x, int y, Rectangle alloc)
getViewAtPoint
in class CompositeView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the parent's allocation on entry, which should
be changed to the child's allocation on exit
protected void childAllocation(int index, Rectangle a)
childAllocation
in class CompositeView
index
- the index of the child, >= 0 && < getViewCount()a
- the allocation to the interior of the box on entry,
and the allocation of the child view at the index on exit.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |