|
|||||||||
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.ZoneView
public class ZoneView
A View implementation that delays loading of sub views until they are
needed for display or internal transformations. This can be used for
editors that need to handle large documents more effectivly than the
standard BoxView
.
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 | |
---|---|
ZoneView(Element element,
int axis)
Creates a new ZoneView for the specified element and axis. |
Method Summary | |
---|---|
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. |
Methods inherited from class javax.swing.text.CompositeView |
---|
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, 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, isVisible, modelToView, remove, removeAll, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZoneView(Element element, int axis)
element
- the element for which to create a ZoneViewaxis
- the major layout axis for the boxMethod Detail |
---|
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 time
IllegalArgumentException
- 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 check
true
when the specified zone is loaded,
false
otherwiseprotected View createZone(int p0, int p1)
p0
- the start of the rangep1
- the end of the range
protected 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 position
pos
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |