javax.swing.text
public class ZoneView extends BoxView
BoxView
.BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, 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 |
---|
ZoneView(Element element,
int axis)
Creates a new ZoneView for the specified element and axis.
|
Modifier and Type | Method and Description |
---|---|
protected View |
createZone(int p0,
int p1)
Creates a zone for the specified range.
|
int |
getMaximumZoneSize()
Returns the maximum zone size.
|
int |
getMaxZonesLoaded()
Returns the number of zones that are allowed to be loaded.
|
protected int |
getViewIndexAtPosition(int pos)
Returns the index of the child view at the document position
pos . |
void |
insertUpdate(DocumentEvent e,
Shape a,
ViewFactory vf)
Receive notification about an insert update to the text model.
|
protected boolean |
isZoneLoaded(View zone)
Returns
true when the specified zone is loaded,
false otherwise. |
protected void |
loadChildren(ViewFactory vf)
Overridden to not load all the child views.
|
void |
removeUpdate(DocumentEvent e,
Shape a,
ViewFactory vf)
Receive notification about a remove update to the text model.
|
void |
setMaximumZoneSize(int size)
Sets the maximum zone size.
|
void |
setMaxZonesLoaded(int num)
Sets the maximum number of zones that are allowed to be loaded at the
same time.
|
protected void |
unloadZone(View zone)
This unloads the specified zone.
|
protected boolean |
updateChildren(DocumentEvent.ElementChange ec,
DocumentEvent e,
ViewFactory vf)
Updates the list of children that is returned by
View.getView(int)
and View.getViewCount() . |
protected void |
zoneWasLoaded(View zone)
Gets called after a zone has been loaded.
|
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paint, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets, setParent
append, breakView, changedUpdate, createFragment, dump, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateLayout, viewToModel
public void setMaximumZoneSize(int size)
size
- the maximum zone size to setgetMaximumZoneSize()
public int getMaximumZoneSize()
setMaximumZoneSize(int)
public void setMaxZonesLoaded(int num)
num
- the number of zones allowed to be loaded at the same timeIllegalArgumentException
- if num <= 0
getMaxZonesLoaded()
public int getMaxZonesLoaded()
setMaxZonesLoaded(int)
protected void zoneWasLoaded(View zone)
zone
- the zone that has been loadedprotected void unloadZone(View zone)
zone
- the zone to be unloadedprotected boolean isZoneLoaded(View zone)
true
when the specified zone is loaded,
false
otherwise. The default implementation checks if
the zone view has child elements.zone
- the zone view to checktrue
when the specified zone is loaded,
false
otherwiseprotected View createZone(int p0, int p1)
p0
- the start of the rangep1
- the end of the rangeprotected void loadChildren(ViewFactory vf)
loadChildren
in class CompositeView
vf
- not usedCompositeView.setParent(javax.swing.text.View)
protected int getViewIndexAtPosition(int pos)
pos
.
This overrides the CompositeView implementation because the ZoneView does
not provide a one to one mapping from Elements to Views.getViewIndexAtPosition
in class CompositeView
pos
- the document positionpos
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory vf)
View
View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory)
if the element that this view is
responsible for has changed. This makes sure that the children can
correctly represent the model.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
. This forwards the DocumentEvent to
the child views.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape)
. Gives the view a chance to either
repair its layout, reschedule layout or do nothing at all.insertUpdate
in class View
e
- the DocumentEvent that describes the changea
- the shape of the viewvf
- the ViewFactory for creating child viewspublic void removeUpdate(DocumentEvent e, Shape a, ViewFactory vf)
View
View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory)
if the element that this view is
responsible for has changed. This makes sure that the children can
correctly represent the model.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
. This forwards the DocumentEvent to
the child views.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape)
. Gives the view a chance to either
repair its layout, reschedule layout or do nothing at all.removeUpdate
in class View
e
- the DocumentEvent that describes the changea
- the shape of the viewvf
- the ViewFactory for creating child viewsprotected boolean updateChildren(DocumentEvent.ElementChange ec, DocumentEvent e, ViewFactory vf)
View
View.getView(int)
and View.getViewCount()
.
Element that are specified as beeing added in the ElementChange record are
assigned a view for using the ViewFactory. Views of Elements that
are specified as beeing removed are removed from the list.updateChildren
in class View
ec
- the ElementChange record that describes the change of the
elemente
- the DocumentEvent describing the change of the document modelvf
- the ViewFactory to use for creating new views