|
||||||||||
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.plaf.basic.BasicTextAreaUI.PlainParagraph.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, 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) |
BasicTextAreaUI.PlainParagraph.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. |
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 coordinates. |
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. |
protected boolean |
updateChildren(DocumentEvent.ElementChange ec,
DocumentEvent e,
ViewFactory f)
Updates the child views in response to receiving notification that the model changed, and there is change record for the element this view is responsible for. |
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, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, preferenceChanged, remove, removeAll, removeUpdate, setSize, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
BasicTextAreaUI.PlainParagraph.LogicalView(Element elem)
Method Detail |
protected int getViewIndexAtPosition(int pos)
CompositeView
getViewIndexAtPosition
in class CompositeView
pos
- the position >= 0
protected boolean updateChildren(DocumentEvent.ElementChange ec, DocumentEvent e, ViewFactory f)
View
ViewFactory
is used to create child views for each element
specified as added in the ElementChange
, starting at the
index specified in the given ElementChange
. The number of
child views representing the removed elements specified are
removed.
updateChildren
in class View
ec
- the change information for the element this view
is responsible for. This should not be null
if
this method gets callede
- the change information from the associated documentf
- the factory to use to build child views
View.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)
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 float getPreferredSpan(int axis)
View
getPreferredSpan
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)
View
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)
CompositeView
isBefore
in class CompositeView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the rectangle
protected boolean isAfter(int x, int y, Rectangle alloc)
CompositeView
isAfter
in class CompositeView
x
- the X coordinate >= 0y
- the Y coordinate >= 0alloc
- the rectangle
protected View getViewAtPoint(int x, int y, Rectangle alloc)
CompositeView
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)
CompositeView
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 |