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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 696     }
 697 
 698     /**
 699      * Returns the next visual position for the cursor, in either the
 700      * north or south direction.
 701      *
 702      * @param pos the position to convert >= 0
 703      * @param b a bias value of either <code>Position.Bias.Forward</code>
 704      *  or <code>Position.Bias.Backward</code>
 705      * @param a the allocated region to render into
 706      * @param direction the direction from the current position that can
 707      *  be thought of as the arrow keys typically found on a keyboard;
 708      *  this may be one of the following:
 709      *  <ul>
 710      *  <li><code>SwingConstants.NORTH</code>
 711      *  <li><code>SwingConstants.SOUTH</code>
 712      *  </ul>
 713      * @param biasRet an array containing the bias that was checked
 714      * @return the location within the model that best represents the next
 715      *  north or south location
 716      * @exception BadLocationException
 717      * @exception IllegalArgumentException if <code>direction</code> is invalid
 718      * @see #getNextVisualPositionFrom
 719      *
 720      * @return the next position west of the passed in position
 721      */
 722     protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
 723                                                       Shape a, int direction,
 724                                                       Position.Bias[] biasRet)
 725                                                 throws BadLocationException {
 726         return Utilities.getNextVisualPositionFrom(
 727                             this, pos, b, a, direction, biasRet);
 728     }
 729 
 730     /**
 731      * Returns the next visual position for the cursor, in either the
 732      * east or west direction.
 733      *
 734     * @param pos the position to convert &gt;= 0
 735      * @param b a bias value of either <code>Position.Bias.Forward</code>
 736      *  or <code>Position.Bias.Backward</code>
 737      * @param a the allocated region to render into
 738      * @param direction the direction from the current position that can
 739      *  be thought of as the arrow keys typically found on a keyboard;
 740      *  this may be one of the following:
 741      *  <ul>
 742      *  <li><code>SwingConstants.WEST</code>
 743      *  <li><code>SwingConstants.EAST</code>
 744      *  </ul>
 745      * @param biasRet an array containing the bias that was checked
 746      * @return the location within the model that best represents the next
 747      *  west or east location
 748      * @exception BadLocationException
 749      * @exception IllegalArgumentException if <code>direction</code> is invalid
 750      * @see #getNextVisualPositionFrom
 751      */
 752     protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
 753                                                     Shape a,
 754                                                     int direction,
 755                                                     Position.Bias[] biasRet)
 756                                                 throws BadLocationException {
 757         return Utilities.getNextVisualPositionFrom(
 758                             this, pos, b, a, direction, biasRet);
 759     }
 760 
 761     /**
 762      * Determines in which direction the next view lays.
 763      * Consider the <code>View</code> at index n. Typically the
 764      * <code>View</code>s are layed out from left to right,
 765      * so that the <code>View</code> to the EAST will be
 766      * at index n + 1, and the <code>View</code> to the WEST
 767      * will be at index n - 1. In certain situations,
 768      * such as with bidirectional text, it is possible


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 696     }
 697 
 698     /**
 699      * Returns the next visual position for the cursor, in either the
 700      * north or south direction.
 701      *
 702      * @param pos the position to convert &gt;= 0
 703      * @param b a bias value of either <code>Position.Bias.Forward</code>
 704      *  or <code>Position.Bias.Backward</code>
 705      * @param a the allocated region to render into
 706      * @param direction the direction from the current position that can
 707      *  be thought of as the arrow keys typically found on a keyboard;
 708      *  this may be one of the following:
 709      *  <ul>
 710      *  <li><code>SwingConstants.NORTH</code>
 711      *  <li><code>SwingConstants.SOUTH</code>
 712      *  </ul>
 713      * @param biasRet an array containing the bias that was checked
 714      * @return the location within the model that best represents the next
 715      *  north or south location
 716      * @exception BadLocationException for a bad location within a document model
 717      * @exception IllegalArgumentException if <code>direction</code> is invalid
 718      * @see #getNextVisualPositionFrom
 719      *
 720      * @return the next position west of the passed in position
 721      */
 722     protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
 723                                                       Shape a, int direction,
 724                                                       Position.Bias[] biasRet)
 725                                                 throws BadLocationException {
 726         return Utilities.getNextVisualPositionFrom(
 727                             this, pos, b, a, direction, biasRet);
 728     }
 729 
 730     /**
 731      * Returns the next visual position for the cursor, in either the
 732      * east or west direction.
 733      *
 734     * @param pos the position to convert &gt;= 0
 735      * @param b a bias value of either <code>Position.Bias.Forward</code>
 736      *  or <code>Position.Bias.Backward</code>
 737      * @param a the allocated region to render into
 738      * @param direction the direction from the current position that can
 739      *  be thought of as the arrow keys typically found on a keyboard;
 740      *  this may be one of the following:
 741      *  <ul>
 742      *  <li><code>SwingConstants.WEST</code>
 743      *  <li><code>SwingConstants.EAST</code>
 744      *  </ul>
 745      * @param biasRet an array containing the bias that was checked
 746      * @return the location within the model that best represents the next
 747      *  west or east location
 748      * @exception BadLocationException for a bad location within a document model
 749      * @exception IllegalArgumentException if <code>direction</code> is invalid
 750      * @see #getNextVisualPositionFrom
 751      */
 752     protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
 753                                                     Shape a,
 754                                                     int direction,
 755                                                     Position.Bias[] biasRet)
 756                                                 throws BadLocationException {
 757         return Utilities.getNextVisualPositionFrom(
 758                             this, pos, b, a, direction, biasRet);
 759     }
 760 
 761     /**
 762      * Determines in which direction the next view lays.
 763      * Consider the <code>View</code> at index n. Typically the
 764      * <code>View</code>s are layed out from left to right,
 765      * so that the <code>View</code> to the EAST will be
 766      * at index n + 1, and the <code>View</code> to the WEST
 767      * will be at index n - 1. In certain situations,
 768      * such as with bidirectional text, it is possible