javax.swing.text
public class AsyncBoxView extends View
static class AsyncEditorKit extends StyledEditorKit implements ViewFactory { public View create(Element el) { if (el.getName().equals(AbstractDocument.SectionElementName)) return new AsyncBoxView(el, View.Y_AXIS); return super.getViewFactory().create(el); } public ViewFactory getViewFactory() { return this; } }
Since: 1.3
Nested Class Summary | |
---|---|
class | AsyncBoxView.ChildLocator
Manages the effective position of child views. |
class | AsyncBoxView.ChildState
Represents the layout state of a child view. |
Field Summary | |
---|---|
protected AsyncBoxView.ChildLocator | locator
The child locator for this view. |
Constructor Summary | |
---|---|
AsyncBoxView(Element elem, int axis)
Creates a new AsyncBoxView that represents the specified
element and layouts its children along the specified axis.
|
Method Summary | |
---|---|
protected AsyncBoxView.ChildState | createChildState(View v)
Creates a ChildState object for the specified view.
|
protected void | flushRequirementChanges()
Flushes the requirements changes upwards to the parent view. |
float | getBottomInset()
Returns the bottom inset.
|
Shape | getChildAllocation(int index, Shape a)
Returns the child allocation for the child view with the specified
index .
|
protected AsyncBoxView.ChildState | getChildState(int index)
Returns the ChildState object associated with the child view
at the specified index .
|
protected boolean | getEstimatedMajorSpan()
Determines whether the major span should be treated as estimated or as
beeing accurate.
|
protected float | getInsetSpan(int axis)
Returns the span along an axis that is taken up by the insets.
|
protected LayoutQueue | getLayoutQueue()
Returns the LayoutQueue used for layouting the box view.
|
float | getLeftInset()
Returns the left inset.
|
int | getMajorAxis()
Returns the major layout axis.
|
float | getMaximumSpan(int axis)
Returns the maximum span of this view along the specified axis.
|
float | getMinimumSpan(int axis)
Returns the minimum span along the specified axis. |
int | getMinorAxis()
Returns the minor layout axis, that is the axis orthogonal to the major
layout axis.
|
float | getPreferredSpan(int axis)
Returns the preferred span of this view along the specified layout axis.
|
float | getRightInset()
Returns the right inset.
|
float | getTopInset()
Returns the top inset.
|
View | getView(int index)
Returns the view at the specified index .
|
int | getViewCount()
Returns the number of child views.
|
int | getViewIndex(int pos, Position.Bias bias)
Returns the view index of the child view that represents the specified
model position.
|
protected int | getViewIndexAtPosition(int pos, Position.Bias b)
Returns the child view index of the view that represents the specified
position in the document model.
|
protected void | loadChildren(ViewFactory f)
Loads the child views of this view. |
protected void | majorRequirementChange(AsyncBoxView.ChildState cs, float delta)
Receives notification from the child states that the requirements along
the major axis have changed.
|
protected void | minorRequirementChange(AsyncBoxView.ChildState cs)
Receives notification from the child states that the requirements along
the minor axis have changed.
|
Shape | modelToView(int pos, Shape a, Position.Bias b)
Maps a model location to view coordinates.
|
void | paint(Graphics g, Shape s)
Paints the view. |
void | preferenceChanged(View view, boolean width, boolean height)
Receives notification that one of the child views has changed its
layout preferences along one or both axis.
|
void | replace(int offset, int length, View[] views)
Replaces child views with new child views.
|
void | setBottomInset(float bottom)
Sets the bottom inset.
|
protected void | setEstimatedMajorSpan(boolean estimated)
Sets the estimatedMajorSpan property that determines if
the major span should be treated as beeing estimated.
|
void | setLeftInset(float left)
Sets the left inset.
|
void | setParent(View parent)
Sets the parent for this view. |
void | setRightInset(float right)
Sets the right inset.
|
void | setSize(float width, float height)
Sets the size of this view. |
void | setTopInset(float top)
Sets the top inset.
|
protected void | updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a)
Updates the layout for this view. |
int | viewToModel(float x, float y, Shape a, Position.Bias[] b)
Maps view coordinates to a model location.
|
AsyncBoxView
that represents the specified
element and layouts its children along the specified axis.
Parameters: elem the element axis the layout axis
ChildState
object for the specified view.
Parameters: v the view for which to create a child state object
Returns: the created child state
Returns: the bottom inset
index
.
Parameters: index the index of the child view a the current allocation of this view
Returns: the allocation of the child view
ChildState
object associated with the child view
at the specified index
.
Parameters: index the index of the child view for which to query the state
Returns: the child state for the specified child view
Returns: true
if the major span should be treated as
estimated, false
if the major span should be treated
as accurate
Since: 1.4
Parameters: axis the axis
Returns: the span along an axis that is taken up by the insets
Since: 1.4
LayoutQueue
used for layouting the box view.
This simply returns {@link LayoutQueue#getDefaultQueue()}.
Returns: the LayoutQueue
used for layouting the box view
Returns: the left inset
Returns: the major layout axis
preferredSpan
for the
major axis (that means the box can't be resized along the major axis) and
{@link Short#MAX_VALUE} for the minor axis.
Parameters: axis the axis
Returns: the maximum span of this view along the specified axis
Returns: the minor layout axis
Returns: the preferred span of this view along the specified layout axis
Returns: the right inset
Returns: the top inset
index
.
Parameters: index the index of the requested child view
Returns: the view at the specified index
Returns: the number of child views
Parameters: pos the model position for which we search the view index bias the bias
Returns: the view index of the child view that represents the specified model position
Parameters: pos the position in the model b the bias
Returns: the child view index of the view that represents the specified position in the document model
Parameters: f the view factory to build child views with
Parameters: cs the child state from which this notification is messaged
Parameters: cs the child state from which this notification is messaged
Parameters: pos the model location a the current allocation of this view b the bias
Returns: the view allocation for the specified model location
Parameters: g the graphics context to use s the allocation for this view
Parameters: view the view that has changed its preferences width true
if the width preference has changed height true
if the height preference has changed
Parameters: offset the offset at which to remove/insert length the number of child views to remove views the new child views to insert
Parameters: bottom the bottom inset
estimatedMajorSpan
property that determines if
the major span should be treated as beeing estimated.
Parameters: estimated if the major span should be treated as estimated or not
Since: 1.4
Parameters: left the left inset
parent
is not null
and there have not been any
child views initializes.
Parameters: parent the new parent view; null
if this view is
removed from the view hierarchy
See Also: setParent
Parameters: right the right inset
Parameters: width the width of the view height the height of the view
Parameters: top the top inset
Parameters: ec the element change, may be null
if there were
no changes to the element of this view e the document event a the current allocation of this view
Parameters: x the x coordinate (relative to a
) y the y coordinate (relative to a
) b holds the bias of the model location on method exit
Returns: the model location for the specified view location