|Method from javax.swing.text.BoxView Detail:|
protected void baselineLayout(int targetSpan,
Computes the location and extent of each child view
BoxView given the
which is the width (or height) of the region we have to
protected SizeRequirements baselineRequirements(int axis,
Calculates the size requirements for this
by examining the size of each child view.
protected SizeRequirements calculateMajorAxisRequirements(int axis,
Calculates the size requirements for the major axis
protected SizeRequirements calculateMinorAxisRequirements(int axis,
Calculates the size requirements for the minor axis
void checkRequests(int axis)
Checks the request cache and update if needed.
protected void childAllocation(int index,
Allocates a region for a child view.
protected boolean flipEastAndWestAtEnds(int position,
Determines in which direction the next view lays.
Consider the View at index n. Typically the
are layed out from left to right, so that the
to the EAST will be at index n + 1, and the
to the WEST will be at index n - 1. In certain situations,
such as with bidirectional text, it is possible
View to EAST is not at index n + 1,
but rather at index n - 1, or that the
to the WEST is not at index n - 1, but index n + 1.
In this case this method would return true,
Views are layed out in
descending order. Otherwise the method would return false
Views are layed out in ascending order.
If the receiver is laying its
Views along the
Y_AXIS, this will will return the value from
invoking the same method on the
responsible for rendering
bias. Otherwise this will return false.
protected void forwardUpdate(ElementChange ec,
Forwards the given
DocumentEvent to the child views
that need to be notified of the change to the model.
If a child changed its requirements and the allocation
was valid prior to forwarding the portion of the box
from the starting child to the end of the box will
public float getAlignment(int axis)
Determines the desired alignment for this view along an
axis. This is implemented to give the total alignment
needed to position the children with the alignment points
lined up along the axis orthoginal to the axis that is
being tiled. The axis being tiled will request to be
centered (i.e. 0.5f).
public int getAxis()
Fetches the tile axis property. This is the axis along which
the child views are tiled.
public Shape getChildAllocation(int index,
Fetches the allocation for the given child view.
This enables finding out where various views
are located. This is implemented to return
null if the layout is invalid,
otherwise the superclass behavior is executed.
public int getHeight()
Returns the current height of the box. This is the height that
it was last allocated.
public float getMaximumSpan(int axis)
Determines the maximum span for this view along an
public float getMinimumSpan(int axis)
Determines the minimum span for this view along an
protected int getOffset(int axis,
Fetches the offset of a particular child's current layout.
public float getPreferredSpan(int axis)
Determines the preferred span for this view along an
public int getResizeWeight(int axis)
Gets the resize weight. A value of 0 or less is not resizable.
protected int getSpan(int axis,
Fetches the span of a particular childs current layout.
float getSpanOnAxis(int axis)
Returns the size of the view along an axis. This is implemented
to return zero.
protected View getViewAtPoint(int x,
Fetches the child view at the given coordinates.
public int getWidth()
Returns the current width of the box. This is the width that
it was last allocated.
protected boolean isAfter(int x,
Determines if a point falls after an allocated region.
protected boolean isAllocationValid()
Are the allocations for the children still
protected boolean isBefore(int x,
Determines if a point falls before an allocated region.
protected boolean isLayoutValid(int axis)
Determines if the layout is valid along the given axis.
protected void layout(int width,
Perform layout on the box
public void layoutChanged(int axis)
Invalidates the layout along an axis. This happens
automatically if the preferences have changed for
any of the child views. In some cases the layout
may need to be recalculated when the preferences
have not changed. The layout can be marked as
invalid by calling this method. The layout will
be updated the next time the
is called on this view (typically in paint).
protected void layoutMajorAxis(int targetSpan,
Performs layout for the major axis of the box (i.e. the
axis that it represents). The results of the layout (the
offset and span for each children) are placed in the given
arrays which represent the allocations to the children
along the major axis.
protected void layoutMinorAxis(int targetSpan,
Performs layout for the minor axis of the box (i.e. the
axis orthoginal to the axis that it represents). The results
of the layout (the offset and span for each children) are
placed in the given arrays which represent the allocations to
the children along the minor axis.
public Shape modelToView(int pos,
Bias b) throws BadLocationException
Provides a mapping from the document model coordinate space
to the coordinate space of the view mapped to it. This makes
sure the allocation is valid before calling the superclass.
public void paint(Graphics g,
BoxView using the given
rendering surface and area
on that surface. Only the children that intersect
the clip bounds of the given
will be rendered.
protected void paintChild(Graphics g,
Paints a child. By default
that is all it does, but a subclass can use this to paint
things relative to the child.
public void preferenceChanged(View child,
This is called by a child to indicate its
preferred span has changed. This is implemented to
throw away cached layout information so that new
calculations will be done the next time the children
need an allocation.
public void replace(int index,
Invalidates the layout and resizes the cache of
requests/allocations. The child allocations can still
be accessed for the old layout, but the new children
will have an offset and span of 0.
public void setAxis(int axis)
Sets the tile axis property. This is the axis along which
the child views are tiled.
public void setSize(float width,
Sets the size of the view. This should cause
layout of the view if the view caches any layout
information. This is implemented to call the
layout method with the sizes inside of the insets.
void setSpanOnAxis(int axis,
Sets the size of the view along an axis. This should cause
layout of the view along the given axis.
Propagates the current allocations to the child views.
int updateLayoutArray(int oldArray,
Resizes the given layout array to match the new number of
child views. The current number of child views are used to
produce the new array. The contents of the old array are
inserted into the new array at the appropriate places so that
the old layout information is transferred to the new array.
public int viewToModel(float x,
Provides a mapping from the view coordinate space to the logical
coordinate space of the model.