< prev index next >
src/java.desktop/share/classes/javax/swing/text/BoxView.java
Print this page
@@ -39,34 +39,34 @@
* things like a collection of lines, paragraphs,
* lists, columns, pages, etc. The axis along which the children are tiled is
* considered the major axis. The orthogonal axis is the minor axis.
* <p>
* Layout for each axis is handled separately by the methods
- * <code>layoutMajorAxis</code> and <code>layoutMinorAxis</code>.
+ * {@code layoutMajorAxis} and {@code layoutMinorAxis}.
* Subclasses can change the layout algorithm by
* reimplementing these methods. These methods will be called
* as necessary depending upon whether or not there is cached
* layout information and the cache is considered
* valid. These methods are typically called if the given size
- * along the axis changes, or if <code>layoutChanged</code> is
- * called to force an updated layout. The <code>layoutChanged</code>
+ * along the axis changes, or if {@code layoutChanged} is
+ * called to force an updated layout. The {@code layoutChanged}
* method invalidates cached layout information, if there is any.
* The requirements published to the parent view are calculated by
- * the methods <code>calculateMajorAxisRequirements</code>
- * and <code>calculateMinorAxisRequirements</code>.
+ * the methods {@code calculateMajorAxisRequirements}
+ * and {@code calculateMinorAxisRequirements}.
* If the layout algorithm is changed, these methods will
* likely need to be reimplemented.
*
* @author Timothy Prinzing
*/
public class BoxView extends CompositeView {
/**
- * Constructs a <code>BoxView</code>.
+ * Constructs a {@code BoxView}.
*
* @param elem the element this view is responsible for
- * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * @param axis either {@code View.X_AXIS} or {@code View.Y_AXIS}
*/
public BoxView(Element elem, int axis) {
super(elem);
tempRect = new Rectangle();
this.majorAxis = axis;
@@ -84,11 +84,11 @@
/**
* Fetches the tile axis property. This is the axis along which
* the child views are tiled.
*
* @return the major axis of the box, either
- * <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * {@code View.X_AXIS} or {@code View.Y_AXIS}
*
* @since 1.3
*/
public int getAxis() {
return majorAxis;
@@ -96,11 +96,11 @@
/**
* Sets the tile axis property. This is the axis along which
* the child views are tiled.
*
- * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * @param axis either {@code View.X_AXIS} or {@code View.Y_AXIS}
*
* @since 1.3
*/
public void setAxis(int axis) {
boolean axisChanged = (axis != majorAxis);
@@ -115,14 +115,14 @@
* 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 <code>setSize</code> method
+ * be updated the next time the {@code setSize} method
* is called on this view (typically in paint).
*
- * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * @param axis either {@code View.X_AXIS} or {@code View.Y_AXIS}
*
* @since 1.3
*/
public void layoutChanged(int axis) {
if (axis == majorAxis) {
@@ -134,11 +134,11 @@
/**
* Determines if the layout is valid along the given axis.
* @return if the layout is valid along the given axis
*
- * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * @param axis either {@code View.X_AXIS} or {@code View.Y_AXIS}
*
* @since 1.4
*/
protected boolean isLayoutValid(int axis) {
if (axis == majorAxis) {
@@ -173,11 +173,11 @@
* @param index the starting index into the child views to insert
* the new views; this should be a value >= 0 and <= getViewCount
* @param length the number of existing child views to remove;
* This should be a value >= 0 and <= (getViewCount() - offset)
* @param elems the child views to add; this value can be
- * <code>null</code>to indicate no children are being added
+ * {@code null} to indicate no children are being added
* (useful to remove)
*/
public void replace(int index, int length, View[] elems) {
super.replace(index, length, elems);
@@ -202,11 +202,11 @@
*
* @param oldArray the original layout array
* @param offset location where new views will be inserted
* @param nInserted the number of child views being inserted;
* therefore the number of blank spaces to leave in the
- * new array at location <code>offset</code>
+ * new array at location {@code offset}
* @return the new layout array
*/
int[] updateLayoutArray(int[] oldArray, int offset, int nInserted) {
int n = getViewCount();
int[] newArray = new int[n];
@@ -216,19 +216,19 @@
newArray, offset + nInserted, n - nInserted - offset);
return newArray;
}
/**
- * Forwards the given <code>DocumentEvent</code> to the child views
+ * Forwards the given {@code 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
* be repainted.
*
* @param ec changes to the element this view is responsible
- * for (may be <code>null</code> if there were no changes)
+ * for (may be {@code null} if there were no changes)
* @param e the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @see #insertUpdate
* @see #removeUpdate
@@ -288,12 +288,12 @@
}
/**
* Gets the resize weight. A value of 0 or less is not resizable.
*
- * @param axis may be either <code>View.X_AXIS</code> or
- * <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS} or
+ * {@code View.Y_AXIS}
* @return the weight
* @exception IllegalArgumentException for an invalid axis
*/
public int getResizeWeight(int axis) {
checkRequests(axis);
@@ -313,12 +313,12 @@
/**
* Sets the size of the view along an axis. This should cause
* layout of the view along the given axis.
*
- * @param axis may be either <code>View.X_AXIS</code> or
- * <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS} or
+ * {@code View.Y_AXIS}
* @param span the span to layout to >= 0
*/
void setSpanOnAxis(int axis, float span) {
if (axis == majorAxis) {
if (majorSpan != (int) span) {
@@ -371,12 +371,12 @@
/**
* Returns the size of the view along an axis. This is implemented
* to return zero.
*
- * @param axis may be either <code>View.X_AXIS</code> or
- * <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS} or
+ * {@code View.Y_AXIS}
* @return the current span of the view along the given axis, >= 0
*/
float getSpanOnAxis(int axis) {
if (axis == majorAxis) {
return majorSpan;
@@ -398,14 +398,14 @@
layout(Math.max(0, (int)(width - getLeftInset() - getRightInset())),
Math.max(0, (int)(height - getTopInset() - getBottomInset())));
}
/**
- * Renders the <code>BoxView</code> using the given
+ * Renders the {@code BoxView} using the given
* rendering surface and area
* on that surface. Only the children that intersect
- * the clip bounds of the given <code>Graphics</code>
+ * the clip bounds of the given {@code Graphics}
* will be rendered.
*
* @param g the rendering surface to use
* @param allocation the allocated region to render into
* @see View#paint
@@ -438,18 +438,18 @@
/**
* Fetches the allocation for the given child view.
* This enables finding out where various views
* are located. This is implemented to return
- * <code>null</code> if the layout is invalid,
+ * {@code null} if the layout is invalid,
* otherwise the superclass behavior is executed.
*
* @param index the index of the child, >= 0 && > getViewCount()
* @param a the allocation to this view
- * @return the allocation to the child; or <code>null</code>
- * if <code>a</code> is <code>null</code>;
- * or <code>null</code> if the layout is invalid
+ * @return the allocation to the child; or {@code null}
+ * if {@code a} is {@code null};
+ * or {@code null} if the layout is invalid
*/
public Shape getChildAllocation(int index, Shape a) {
if (a != null) {
Shape ca = super.getChildAllocation(index, a);
if ((ca != null) && (! isAllocationValid())) {
@@ -510,12 +510,12 @@
* needed to position the children with the alignment points
* lined up along the axis orthogonal to the axis that is
* being tiled. The axis being tiled will request to be
* centered (i.e. 0.5f).
*
- * @param axis may be either <code>View.X_AXIS</code>
- * or <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS}
+ * or {@code View.Y_AXIS}
* @return the desired alignment >= 0.0f && <= 1.0f; this should
* be a value between 0.0 and 1.0 where 0 indicates alignment at the
* origin and 1.0 indicates alignment to the full span
* away from the origin; an alignment of 0.5 would be the
* center of the view
@@ -532,12 +532,12 @@
/**
* Determines the preferred span for this view along an
* axis.
*
- * @param axis may be either <code>View.X_AXIS</code>
- * or <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS}
+ * or {@code View.Y_AXIS}
* @return the span the view would like to be rendered into >= 0;
* typically the view is told to render into the span
* that is returned, although there is no guarantee;
* the parent may choose to resize or break the view
* @exception IllegalArgumentException for an invalid axis type
@@ -555,12 +555,12 @@
/**
* Determines the minimum span for this view along an
* axis.
*
- * @param axis may be either <code>View.X_AXIS</code>
- * or <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS}
+ * or {@code View.Y_AXIS}
* @return the span the view would like to be rendered into >= 0;
* typically the view is told to render into the span
* that is returned, although there is no guarantee;
* the parent may choose to resize or break the view
* @exception IllegalArgumentException for an invalid axis type
@@ -578,12 +578,12 @@
/**
* Determines the maximum span for this view along an
* axis.
*
- * @param axis may be either <code>View.X_AXIS</code>
- * or <code>View.Y_AXIS</code>
+ * @param axis may be either {@code View.X_AXIS}
+ * or {@code View.Y_AXIS}
* @return the span the view would like to be rendered into >= 0;
* typically the view is told to render into the span
* that is returned, although there is no guarantee;
* the parent may choose to resize or break the view
* @exception IllegalArgumentException for an invalid axis type
@@ -850,16 +850,16 @@
}
}
/**
* Calculates the size requirements for the major axis
- * <code>axis</code>.
+ * {@code axis}.
*
* @param axis the axis being studied
- * @param r the <code>SizeRequirements</code> object;
- * if <code>null</code> one will be created
- * @return the newly initialized <code>SizeRequirements</code> object
+ * @param r the {@code SizeRequirements} object;
+ * if {@code null} one will be created
+ * @return the newly initialized {@code SizeRequirements} object
* @see javax.swing.SizeRequirements
*/
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
// calculate tiled request
float min = 0;
@@ -884,16 +884,16 @@
return r;
}
/**
* Calculates the size requirements for the minor axis
- * <code>axis</code>.
+ * {@code axis}.
*
* @param axis the axis being studied
- * @param r the <code>SizeRequirements</code> object;
- * if <code>null</code> one will be created
- * @return the newly initialized <code>SizeRequirements</code> object
+ * @param r the {@code SizeRequirements} object;
+ * if {@code null} one will be created
+ * @return the newly initialized {@code SizeRequirements} object
* @see javax.swing.SizeRequirements
*/
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
int min = 0;
long pref = 0;
@@ -917,12 +917,12 @@
}
/**
* Checks the request cache and update if needed.
* @param axis the axis being studied
- * @exception IllegalArgumentException if <code>axis</code> is
- * neither <code>View.X_AXIS</code> nor <code>View.Y_AXIS</code>
+ * @exception IllegalArgumentException if {@code axis} is
+ * neither {@code View.X_AXIS} nor {@code View.Y_AXIS}
*/
void checkRequests(int axis) {
if ((axis != X_AXIS) && (axis != Y_AXIS)) {
throw new IllegalArgumentException("Invalid axis: " + axis);
}
@@ -938,18 +938,18 @@
}
}
/**
* Computes the location and extent of each child view
- * in this <code>BoxView</code> given the <code>targetSpan</code>,
+ * in this {@code BoxView} given the {@code targetSpan},
* which is the width (or height) of the region we have to
* work with.
*
* @param targetSpan the total span given to the view, which
* would be used to layout the children
* @param axis the axis being studied, either
- * <code>View.X_AXIS</code> or <code>View.Y_AXIS</code>
+ * {@code View.X_AXIS} or {@code View.Y_AXIS}
* @param offsets an empty array filled by this method with
* values specifying the location of each child view
* @param spans an empty array filled by this method with
* values specifying the extent of each child view
*/
@@ -994,17 +994,17 @@
spans[i] = (int)viewSpan;
}
}
/**
- * Calculates the size requirements for this <code>BoxView</code>
+ * Calculates the size requirements for this {@code BoxView}
* by examining the size of each child view.
*
* @param axis the axis being studied
- * @param r the <code>SizeRequirements</code> object;
- * if <code>null</code> one will be created
- * @return the newly initialized <code>SizeRequirements</code> object
+ * @param r the {@code SizeRequirements} object;
+ * if {@code null} one will be created
+ * @return the newly initialized {@code SizeRequirements} object
*/
protected SizeRequirements baselineRequirements(int axis, SizeRequirements r) {
SizeRequirements totalAscent = new SizeRequirements();
SizeRequirements totalDescent = new SizeRequirements();
@@ -1113,35 +1113,35 @@
return spans[childIndex];
}
/**
* Determines in which direction the next view lays.
- * Consider the View at index n. Typically the <code>View</code>s
- * are layed out from left to right, so that the <code>View</code>
- * to the EAST will be at index n + 1, and the <code>View</code>
+ * Consider the View at index n. Typically the {@code View}s
+ * are layed out from left to right, so that the {@code View}
+ * to the EAST will be at index n + 1, and the {@code View}
* to the WEST will be at index n - 1. In certain situations,
* such as with bidirectional text, it is possible
- * that the <code>View</code> to EAST is not at index n + 1,
- * but rather at index n - 1, or that the <code>View</code>
+ * that the {@code View} to EAST is not at index n + 1,
+ * but rather at index n - 1, or that the {@code View}
* to the WEST is not at index n - 1, but index n + 1.
* In this case this method would return true,
- * indicating the <code>View</code>s are layed out in
+ * indicating the {@code View}s are layed out in
* descending order. Otherwise the method would return false
- * indicating the <code>View</code>s are layed out in ascending order.
+ * indicating the {@code View}s are layed out in ascending order.
* <p>
- * If the receiver is laying its <code>View</code>s along the
- * <code>Y_AXIS</code>, this will return the value from
- * invoking the same method on the <code>View</code>
- * responsible for rendering <code>position</code> and
- * <code>bias</code>. Otherwise this will return false.
+ * If the receiver is laying its {@code View}s along the
+ * {@code Y_AXIS}, this will return the value from
+ * invoking the same method on the {@code View}
+ * responsible for rendering {@code position} and
+ * {@code bias}. Otherwise this will return false.
*
* @param position position into the model
- * @param bias either <code>Position.Bias.Forward</code> or
- * <code>Position.Bias.Backward</code>
- * @return true if the <code>View</code>s surrounding the
- * <code>View</code> responding for rendering
- * <code>position</code> and <code>bias</code>
+ * @param bias either {@code Position.Bias.Forward} or
+ * {@code Position.Bias.Backward}
+ * @return true if the {@code View}s surrounding the
+ * {@code View} responding for rendering
+ * {@code position} and {@code bias}
* are layed out in descending order; otherwise false
*/
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias) {
if(majorAxis == Y_AXIS) {
< prev index next >