< prev index next >
src/java.desktop/share/classes/javax/swing/text/ParagraphView.java
Print this page
@@ -36,11 +36,11 @@
* basically a vertical box with a margin around it. The
* contents of the box are a bunch of rows which are special
* horizontal boxes. This view creates a collection of
* views that represent the child elements of the paragraph
* element. Each of these views are placed into a row
- * directly if they will fit, otherwise the <code>breakView</code>
+ * directly if they will fit, otherwise the {@code breakView}
* method is called to try and carve the view into pieces
* that fit.
*
* @author Timothy Prinzing
* @author Scott Violet
@@ -48,11 +48,11 @@
* @see View
*/
public class ParagraphView extends FlowView implements TabExpander {
/**
- * Constructs a <code>ParagraphView</code> for the given element.
+ * Constructs a {@code ParagraphView} for the given element.
*
* @param elem the element that this view is responsible for
*/
public ParagraphView(Element elem) {
super(elem, View.Y_AXIS);
@@ -85,13 +85,13 @@
/**
* Sets the type of justification.
*
* @param j one of the following values:
* <ul>
- * <li><code>StyleConstants.ALIGN_LEFT</code>
- * <li><code>StyleConstants.ALIGN_CENTER</code>
- * <li><code>StyleConstants.ALIGN_RIGHT</code>
+ * <li>{@code StyleConstants.ALIGN_LEFT}
+ * <li>{@code StyleConstants.ALIGN_CENTER}
+ * <li>{@code StyleConstants.ALIGN_RIGHT}
* </ul>
*/
protected void setJustification(int j) {
justification = j;
}
@@ -142,50 +142,50 @@
/**
* Returns the number of views that this view is
* responsible for.
* The child views of the paragraph are rows which
- * have been used to arrange pieces of the <code>View</code>s
+ * have been used to arrange pieces of the {@code View}s
* that represent the child elements. This is the number
* of views that have been tiled in two dimensions,
* and should be equivalent to the number of child elements
* to the element this view is responsible for.
*
- * @return the number of views that this <code>ParagraphView</code>
+ * @return the number of views that this {@code ParagraphView}
* is responsible for
*/
protected int getLayoutViewCount() {
return layoutPool.getViewCount();
}
/**
- * Returns the view at a given <code>index</code>.
+ * Returns the view at a given {@code index}.
* The child views of the paragraph are rows which
- * have been used to arrange pieces of the <code>Views</code>
+ * have been used to arrange pieces of the {@code Views}
* that represent the child elements. This methods returns
* the view responsible for the child element index
* (prior to breaking). These are the Views that were
* produced from a factory (to represent the child
* elements) and used for layout.
*
- * @param index the <code>index</code> of the desired view
- * @return the view at <code>index</code>
+ * @param index the {@code index} of the desired view
+ * @return the view at {@code index}
*/
protected View getLayoutView(int index) {
return layoutPool.getView(index);
}
/**
* Returns the next visual position for the cursor, in
* either the east or west direction.
- * Overridden from <code>CompositeView</code>.
+ * Overridden from {@code CompositeView}.
* @param pos position into the model
- * @param b either <code>Position.Bias.Forward</code> or
- * <code>Position.Bias.Backward</code>
+ * @param b either {@code Position.Bias.Forward} or
+ * {@code Position.Bias.Backward}
* @param a the allocated region to render into
- * @param direction either <code>SwingConstants.NORTH</code>
- * or <code>SwingConstants.SOUTH</code>
+ * @param direction either {@code SwingConstants.NORTH}
+ * or {@code SwingConstants.SOUTH}
* @param biasRet an array containing the bias that were checked
* in this method
* @return the location in the model that represents the
* next location visual position
*/
@@ -240,27 +240,27 @@
}
return getClosestPositionTo(pos, b, a, direction, biasRet, vIndex, x);
}
/**
- * Returns the closest model position to <code>x</code>.
- * <code>rowIndex</code> gives the index of the view that corresponds
+ * Returns the closest model position to {@code x}.
+ * {@code rowIndex} gives the index of the view that corresponds
* that should be looked in.
* @param pos position into the model
* @param b the bias
* @param a the allocated region to render into
* @param direction one of the following values:
* <ul>
- * <li><code>SwingConstants.NORTH</code>
- * <li><code>SwingConstants.SOUTH</code>
+ * <li>{@code SwingConstants.NORTH}
+ * <li>{@code SwingConstants.SOUTH}
* </ul>
* @param biasRet an array containing the bias that were checked
* in this method
* @param rowIndex the index of the view
* @param x the x coordinate of interest
* @throws BadLocationException if a bad location is encountered
- * @return the closest model position to <code>x</code>
+ * @return the closest model position to {@code x}
*/
// NOTE: This will not properly work if ParagraphView contains
// other ParagraphViews. It won't raise, but this does not message
// the children views with getNextVisualPositionFrom.
protected int getClosestPositionTo(int pos, Position.Bias b, Shape a,
@@ -310,29 +310,29 @@
return lastPos;
}
/**
* Determines in which direction the next view lays.
- * Consider the <code>View</code> at index n.
- * Typically the <code>View</code>s are layed out
- * from left to right, so that the <code>View</code>
+ * Consider the {@code 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</code> to the WEST will be at index n - 1.
+ * {@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
+ * it is possible that the {@code View} to EAST is not
* at index n + 1, but rather at index n - 1,
- * or that the <code>View</code> to the WEST is not at
+ * 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
+ * would return true, indicating the {@code View}s are
* layed out in descending order.
* <p>
* This will return true if the text is layed out right
* to left at position, otherwise false.
*
* @param position position into the model
- * @param bias either <code>Position.Bias.Forward</code> or
- * <code>Position.Bias.Backward</code>
+ * @param bias either {@code Position.Bias.Forward} or
+ * {@code Position.Bias.Backward}
* @return true if the text is layed out right to left at
* position, otherwise false.
*/
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias) {
@@ -346,11 +346,11 @@
/**
* Fetches the constraining span to flow against for
* the given child index.
* @param index the index of the view being queried
* @return the constraining span for the given view at
- * <code>index</code>
+ * {@code index}
* @since 1.3
*/
public int getFlowSpan(int index) {
View child = getView(index);
int adjust = 0;
@@ -365,11 +365,11 @@
/**
* Fetches the location along the flow axis that the
* flow span will start at.
* @param index the index of the view being queried
* @return the location for the given view at
- * <code>index</code>
+ * {@code index}
* @since 1.3
*/
public int getFlowStart(int index) {
View child = getView(index);
int adjust = 0;
@@ -379,13 +379,13 @@
}
return tabBase + adjust;
}
/**
- * Create a <code>View</code> that should be used to hold a
+ * Create a {@code View} that should be used to hold a
* a row's worth of children in a flow.
- * @return the new <code>View</code>
+ * @return the new {@code View}
* @since 1.3
*/
protected View createRow() {
return new Row(getElement());
}
@@ -393,18 +393,18 @@
// --- TabExpander methods ------------------------------------------
/**
* Returns the next tab stop position given a reference position.
* This view implements the tab coordinate system, and calls
- * <code>getTabbedSpan</code> on the logical children in the process
+ * {@code getTabbedSpan} on the logical children in the process
* of layout to determine the desired span of the children. The
* logical children can delegate their tab expansion upward to
* the paragraph which knows how to expand tabs.
- * <code>LabelView</code> is an example of a view that delegates
+ * {@code LabelView} is an example of a view that delegates
* its tab expansion needs upward to the paragraph.
* <p>
- * This is implemented to try and locate a <code>TabSet</code>
+ * This is implemented to try and locate a {@code TabSet}
* in the paragraph element's attribute set. If one can be
* found, its settings will be used, otherwise a default expansion
* will be provided. The base location for tab expansion
* is the left inset from the paragraphs most recent allocation
* (which is what the layout of the children is based upon).
@@ -471,27 +471,27 @@
// will never get here!
return x;
}
/**
- * Gets the <code>Tabset</code> to be used in calculating tabs.
+ * Gets the {@code Tabset} to be used in calculating tabs.
*
- * @return the <code>TabSet</code>
+ * @return the {@code TabSet}
*/
protected TabSet getTabSet() {
return StyleConstants.getTabSet(getElement().getAttributes());
}
/**
* Returns the size used by the views between
- * <code>startOffset</code> and <code>endOffset</code>.
- * This uses <code>getPartialView</code> to calculate the
+ * {@code startOffset} and {@code endOffset}.
+ * This uses {@code getPartialView} to calculate the
* size if the child view implements the
- * <code>TabableView</code> interface. If a
- * size is needed and a <code>View</code> does not implement
- * the <code>TabableView</code> interface,
- * the <code>preferredSpan</code> will be used.
+ * {@code TabableView} interface. If a
+ * size is needed and a {@code View} does not implement
+ * the {@code TabableView} interface,
+ * the {@code preferredSpan} will be used.
*
* @param startOffset the starting document offset >= 0
* @param endOffset the ending document offset >= startOffset
* @return the size >= 0
*/
@@ -525,11 +525,11 @@
return size;
}
/**
* Finds the next character in the document with a character in
- * <code>string</code>, starting at offset <code>start</code>. If
+ * {@code string}, starting at offset {@code start}. If
* there are no characters found, -1 will be returned.
*
* @param string the string of characters
* @param start where to start in the model >= 0
* @return the document offset, or -1 if no characters found
@@ -606,12 +606,12 @@
* Determines the desired alignment for this view along an
* axis. This is implemented to give the alignment to the
* center of the first row along the y axis, and the default
* along the x 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 desired alignment. This should be a value
* between 0.0 and 1.0 inclusive, 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.
@@ -635,16 +635,16 @@
}
/**
* Breaks this view on the given axis at the given length.
* <p>
- * <code>ParagraphView</code> instances are breakable
- * along the <code>Y_AXIS</code> only, and only if
- * <code>len</code> is after the first line.
+ * {@code ParagraphView} instances are breakable
+ * along the {@code Y_AXIS} only, and only if
+ * {@code len} is after the first line.
*
- * @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 len specifies where a potential break is desired
* along the given axis >= 0
* @param a the current allocation of the view
* @return the fragment of the view that represents the
* given span, if the view can be broken; if the view
@@ -667,21 +667,21 @@
}
/**
* Gets the break weight for a given location.
* <p>
- * <code>ParagraphView</code> instances are breakable
- * along the <code>Y_AXIS</code> only, and only if
- * <code>len</code> is after the first row. If the length
- * is less than one row, a value of <code>BadBreakWeight</code>
+ * {@code ParagraphView} instances are breakable
+ * along the {@code Y_AXIS} only, and only if
+ * {@code len} is after the first row. If the length
+ * is less than one row, a value of {@code BadBreakWeight}
* is returned.
*
- * @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 len specifies where a potential break is desired >= 0
* @return a value indicating the attractiveness of breaking here;
- * either <code>GoodBreakWeight</code> or <code>BadBreakWeight</code>
+ * either {@code GoodBreakWeight} or {@code BadBreakWeight}
* @see View#getBreakWeight
*/
public int getBreakWeight(int axis, float len) {
if(axis == View.Y_AXIS) {
// PENDING(prinz) make this return a reasonable value
< prev index next >