org.openide.text
Class PositionRef

java.lang.Object
  |
  +--org.openide.text.PositionRef
All Implemented Interfaces:
Serializable

public final class PositionRef
extends Object
implements Serializable

Reference to one position in a document. This position is held as an integer offset, or as a Position object. There is also support for serialization of positions.

See Also:
Serialized Form

Method Summary
 CloneableEditorSupport getCloneableEditorSupport()
           
 int getColumn()
          Get the column number where this position points to.
 EditorSupport getEditorSupport()
          Deprecated. Please use getCloneableEditorSupport() instead.
 int getLine()
          Get the line number where this position points to.
 int getOffset()
           
 Position getPosition()
           
 Position.Bias getPositionBias()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCloneableEditorSupport

public CloneableEditorSupport getCloneableEditorSupport()
Returns:
the appropriate manager for this position ref.

getEditorSupport

public EditorSupport getEditorSupport()
Deprecated. Please use getCloneableEditorSupport() instead.

Getter for the editor support this position ref is associated with. But because the possition ref can be associated with any CloneableEditorSupport there can be situations when the editor support cannot be found. That is why this method can ClassCastException.
Returns:
editor support
Throws:
ClassCastException - if the position is attached to CloneableEditorSupport that is not subclass of EditorSupport

getPositionBias

public Position.Bias getPositionBias()
Returns:
the bias of the position

getPosition

public Position getPosition()
                     throws IOException
Returns:
the position as swing.text.Position object.
Throws:
IOException - when an exception occured during reading the file.

getOffset

public int getOffset()
Returns:
the position as offset index in the file.

getLine

public int getLine()
            throws IOException
Get the line number where this position points to.
Returns:
the line number for this position
Throws:
IOException - if the document could not be opened to check the line number

getColumn

public int getColumn()
              throws IOException
Get the column number where this position points to.
Returns:
the column number within a line (counting starts from zero)
Throws:
IOException - if the document could not be opened to check the column number

toString

public String toString()
Overrides:
toString in class Object


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.