< prev index next >

src/java.desktop/share/classes/javax/swing/text/CompositeView.java

Print this page

        

@@ -28,57 +28,57 @@
 import java.awt.*;
 import javax.swing.event.*;
 import javax.swing.SwingConstants;
 
 /**
- * <code>CompositeView</code> is an abstract <code>View</code>
+ * {@code CompositeView} is an abstract {@code View}
  * implementation which manages one or more child views.
- * (Note that <code>CompositeView</code> is intended
+ * (Note that {@code CompositeView} is intended
  * for managing relatively small numbers of child views.)
- * <code>CompositeView</code> is intended to be used as
- * a starting point for <code>View</code> implementations,
- * such as <code>BoxView</code>, that will contain child
- * <code>View</code>s. Subclasses that wish to manage the
- * collection of child <code>View</code>s should use the
- * {@link #replace} method.  As <code>View</code> invokes
- * <code>replace</code> during <code>DocumentListener</code>
+ * {@code CompositeView} is intended to be used as
+ * a starting point for {@code View} implementations,
+ * such as {@code BoxView}, that will contain child
+ * {@code View}s. Subclasses that wish to manage the
+ * collection of child {@code View}s should use the
+ * {@link #replace} method.  As {@code View} invokes
+ * {@code replace} during {@code DocumentListener}
  * notification, you normally won't need to directly
- * invoke <code>replace</code>.
+ * invoke {@code replace}.
  *
- * <p>While <code>CompositeView</code>
- * does not impose a layout policy on its child <code>View</code>s,
- * it does allow for inseting the child <code>View</code>s
+ * <p>While {@code CompositeView}
+ * does not impose a layout policy on its child {@code View}s,
+ * it does allow for inseting the child {@code View}s
  * it will contain.  The insets can be set by either
  * {@link #setInsets} or {@link #setParagraphInsets}.
  *
  * <p>In addition to the abstract methods of
  * {@link javax.swing.text.View},
- * subclasses of <code>CompositeView</code> will need to
+ * subclasses of {@code CompositeView} will need to
  * override:
  * <ul>
  * <li>{@link #isBefore} - Used to test if a given
- *     <code>View</code> location is before the visual space
- *     of the <code>CompositeView</code>.
+ *     {@code View} location is before the visual space
+ *     of the {@code CompositeView}.
  * <li>{@link #isAfter} - Used to test if a given
- *     <code>View</code> location is after the visual space
- *     of the <code>CompositeView</code>.
+ *     {@code View} location is after the visual space
+ *     of the {@code CompositeView}.
  * <li>{@link #getViewAtPoint} - Returns the view at
  *     a given visual location.
  * <li>{@link #childAllocation} - Returns the bounds of
- *     a particular child <code>View</code>.
- *     <code>getChildAllocation</code> will invoke
- *     <code>childAllocation</code> after offseting
- *     the bounds by the <code>Inset</code>s of the
- *     <code>CompositeView</code>.
+ *     a particular child {@code View}.
+ *     {@code getChildAllocation} will invoke
+ *     {@code childAllocation} after offseting
+ *     the bounds by the {@code Inset}s of the
+ *     {@code CompositeView}.
  * </ul>
  *
  * @author  Timothy Prinzing
  */
 public abstract class CompositeView extends View {
 
     /**
-     * Constructs a <code>CompositeView</code> for the given element.
+     * Constructs a {@code CompositeView} for the given element.
      *
      * @param elem  the element this view is responsible for
      */
     public CompositeView(Element elem) {
         super(elem);

@@ -118,21 +118,21 @@
     // --- View methods ---------------------------------------------
 
     /**
      * Sets the parent of the view.
      * This is reimplemented to provide the superclass
-     * behavior as well as calling the <code>loadChildren</code>
+     * behavior as well as calling the {@code loadChildren}
      * method if this view does not already have children.
      * The children should not be loaded in the
      * constructor because the act of setting the parent
      * may cause them to try to search up the hierarchy
-     * (to get the hosting <code>Container</code> for example).
+     * (to get the hosting {@code Container} for example).
      * If this view has children (the view is being moved
      * from one place in the view hierarchy to another),
-     * the <code>loadChildren</code> method will not be called.
+     * the {@code loadChildren} method will not be called.
      *
-     * @param parent the parent of the view, <code>null</code> if none
+     * @param parent the parent of the view, {@code null} if none
      */
     public void setParent(View parent) {
         super.setParent(parent);
         if ((parent != null) && (nchildren == 0)) {
             ViewFactory f = getViewFactory();

@@ -152,30 +152,30 @@
 
     /**
      * Returns the n-th view in this container.
      *
      * @param n the number of the desired view, &gt;= 0 &amp;&amp; &lt; getViewCount()
-     * @return the view at index <code>n</code>
+     * @return the view at index {@code n}
      */
     public View getView(int n) {
         return children[n];
     }
 
     /**
      * Replaces child views.  If there are no views to remove
      * this acts as an insert.  If there are no views to
      * add this acts as a remove.  Views being removed will
-     * have the parent set to <code>null</code>,
+     * have the parent set to {@code null},
      * and the internal reference to them removed so that they
      * may be garbage collected.
      *
      * @param offset the starting index into the child views to insert
      *   the new views; &gt;= 0 and &lt;= getViewCount
      * @param length the number of existing child views to remove;
      *   this should be a value &gt;= 0 and &lt;= (getViewCount() - offset)
      * @param views the child views to add; this value can be
-     *  <code>null</code>
+     *  {@code null}
      *   to indicate no children are being added (useful to remove)
      */
     public void replace(int offset, int length, View[] views) {
         // make sure an array exists
         if (views == null) {

@@ -237,12 +237,12 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
      * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
-     * @param b a bias value of either <code>Position.Bias.Forward</code>
-     *  or <code>Position.Bias.Backward</code>
+     * @param b a bias value of either {@code Position.Bias.Forward}
+     *  or {@code Position.Bias.Backward}
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does
      *   not represent a valid location in the associated document
      * @see View#modelToView
      */

@@ -282,12 +282,12 @@
      *
      * @param p0 the position to convert &gt;= 0
      * @param b0 the bias toward the previous character or the
      *  next character represented by p0, in case the
      *  position is a boundary of two views; either
-     *  <code>Position.Bias.Forward</code> or
-     *  <code>Position.Bias.Backward</code>
+     *  {@code Position.Bias.Forward} or
+     *  {@code Position.Bias.Backward}
      * @param p1 the position to convert &gt;= 0
      * @param b1 the bias toward the previous character or the
      *  next character represented by p1, in case the
      *  position is a boundary of two views
      * @param a the allocated region to render into

@@ -379,12 +379,12 @@
      * coordinate space of the model.
      *
      * @param x   x coordinate of the view location to convert &gt;= 0
      * @param y   y coordinate of the view location to convert &gt;= 0
      * @param a the allocated region to render into
-     * @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 the location within the model that best represents the
      *  given point in the view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {

@@ -439,28 +439,28 @@
      * within the range of &gt;=0.  If the value is -1, a position
      * will be calculated automatically.  If the value &lt; -1,
      * the {@code BadLocationException} will be thrown.
      *
      * @param pos the position to convert
-     * @param b a bias value of either <code>Position.Bias.Forward</code>
-     *  or <code>Position.Bias.Backward</code>
+     * @param b a bias value of either {@code Position.Bias.Forward}
+     *  or {@code Position.Bias.Backward}
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard;
      *  this may be one of the following:
      *  <ul>
-     *  <li><code>SwingConstants.WEST</code>
-     *  <li><code>SwingConstants.EAST</code>
-     *  <li><code>SwingConstants.NORTH</code>
-     *  <li><code>SwingConstants.SOUTH</code>
+     *  <li>{@code SwingConstants.WEST}
+     *  <li>{@code SwingConstants.EAST}
+     *  <li>{@code SwingConstants.NORTH}
+     *  <li>{@code SwingConstants.SOUTH}
      *  </ul>
      * @param biasRet an array containing the bias that was checked
      * @return the location within the model that best represents the next
      *  location visual position
      * @exception BadLocationException the given position is not a valid
      *                                 position within the document
-     * @exception IllegalArgumentException if <code>direction</code> is invalid
+     * @exception IllegalArgumentException if {@code direction} is invalid
      */
     public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
                                          int direction, Position.Bias[] biasRet)
       throws BadLocationException {
         if (pos < -1 || pos > getDocument().getLength()) {

@@ -487,11 +487,11 @@
     }
 
     /**
      * Returns the child view index representing the given
      * position in the model.  This is implemented to call the
-     * <code>getViewIndexByPosition</code>
+     * {@code getViewIndexByPosition}
      * method for backward compatibility.
      *
      * @param pos the position &gt;= 0
      * @return  index of the view representing the given position, or
      *   -1 if no view represents that position

@@ -557,11 +557,11 @@
      *
      * @param pos the position &gt;= 0
      * @param a  the allocation to the interior of the box on entry,
      *   and the allocation of the view containing the position on exit
      * @return  the view representing the given position, or
-     *   <code>null</code> if there isn't one
+     *   {@code null} if there isn't one
      */
     protected View getViewAtPosition(int pos, Rectangle a) {
         int index = getViewIndexAtPosition(pos);
         if ((index >= 0) && (index < getViewCount())) {
             View v = getView(index);

@@ -595,17 +595,17 @@
      * It is expected that the returned value would be further
      * mutated to represent an allocation to a child view.
      * This is implemented to reuse an instance variable so
      * it avoids creating excessive Rectangles.  Typically
      * the result of calling this method would be fed to
-     * the <code>childAllocation</code> method.
+     * the {@code childAllocation} method.
      *
      * @param a the allocation given to the view
      * @return the allocation that represents the inside of the
      *   view after the margins have all been removed; if the
-     *   given allocation was <code>null</code>,
-     *   the return value is <code>null</code>
+     *   given allocation was {@code null},
+     *   the return value is {@code null}
      */
     protected Rectangle getInsideAllocation(Shape a) {
         if (a != null) {
             // get the bounds, hopefully without allocating
             // a new rectangle.  The Shape argument should

@@ -698,25 +698,25 @@
     /**
      * Returns the next visual position for the cursor, in either the
      * north or south direction.
      *
      * @param pos the position to convert &gt;= 0
-     * @param b a bias value of either <code>Position.Bias.Forward</code>
-     *  or <code>Position.Bias.Backward</code>
+     * @param b a bias value of either {@code Position.Bias.Forward}
+     *  or {@code Position.Bias.Backward}
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard;
      *  this may be one of the following:
      *  <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 was checked
      * @return the location within the model that best represents the next
      *  north or south location
      * @exception BadLocationException for a bad location within a document model
-     * @exception IllegalArgumentException if <code>direction</code> is invalid
+     * @exception IllegalArgumentException if {@code direction} is invalid
      * @see #getNextVisualPositionFrom
      *
      * @return the next position west of the passed in position
      */
     protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,

@@ -733,25 +733,25 @@
     /**
      * Returns the next visual position for the cursor, in either the
      * east or west direction.
      *
     * @param pos the position to convert &gt;= 0
-     * @param b a bias value of either <code>Position.Bias.Forward</code>
-     *  or <code>Position.Bias.Backward</code>
+     * @param b a bias value of either {@code Position.Bias.Forward}
+     *  or {@code Position.Bias.Backward}
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard;
      *  this may be one of the following:
      *  <ul>
-     *  <li><code>SwingConstants.WEST</code>
-     *  <li><code>SwingConstants.EAST</code>
+     *  <li>{@code SwingConstants.WEST}
+     *  <li>{@code SwingConstants.EAST}
      *  </ul>
      * @param biasRet an array containing the bias that was checked
      * @return the location within the model that best represents the next
      *  west or east location
      * @exception BadLocationException for a bad location within a document model
-     * @exception IllegalArgumentException if <code>direction</code> is invalid
+     * @exception IllegalArgumentException if {@code direction} is invalid
      * @see #getNextVisualPositionFrom
      */
     protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
                                                     Shape a,
                                                     int direction,

@@ -764,29 +764,29 @@
                             this, pos, b, a, direction, biasRet);
     }
 
     /**
      * 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> to the EAST will be
-     * at index n + 1, and the <code>View</code> to the WEST
+     * 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} 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 descending order.
+     * {@code View}s are layed out in descending order.
      * <p>
      * This unconditionally returns false, subclasses should override this
-     * method if there is the possibility for laying <code>View</code>s in
+     * method if there is the possibility for laying {@code View}s in
      * descending order.
      *
      * @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 false
      */
     protected boolean flipEastAndWestAtEnds(int position,
                                             Position.Bias bias) {
         return false;
< prev index next >