JIDE 3.5.15

com.jidesoft.editor.caret
Class DefaultCaretModel

java.lang.Object
  extended by com.jidesoft.editor.caret.DefaultCaretModel
All Implemented Interfaces:
CaretModel

public class DefaultCaretModel
extends Object
implements CaretModel

The default implementation of CaretModel.


Constructor Summary
DefaultCaretModel(CodeEditor editor)
           
 
Method Summary
 void addCaretListener(CaretListener caretlistener)
          Adds caret listener to listen to any changes in the caret position.
protected  void fireCaretEvent(int type, CaretPosition oldPosition, CaretPosition newPosition)
           
 CaretListener[] getCaretListeners()
          Gets the CaretListeners register on DefaultCaretModel.
 CaretPosition getModelPosition()
          Gets the caret model position.
 int getOffset()
          Gets the offset.
 CaretPosition getViewPosition()
          Gets the caret view position.
 void moveCaret(int xOffset, int yOffset, boolean select, boolean columnSelection, boolean scrollVisible)
          Moves caret from its current position to another position using the x and y offset.
 void removeCaretListener(CaretListener caretlistener)
          Removes caret listener that is added before.
 void setModelPosition(CaretPosition p)
          Sets the caret model position.
 void setOffset(int offset)
          Sets the offset.
 void setViewPosition(CaretPosition vp)
          Sets the caret view position.
 void updateViewPosition()
          Updates the caret view position from caret model position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCaretModel

public DefaultCaretModel(CodeEditor editor)
Method Detail

getModelPosition

public CaretPosition getModelPosition()
Gets the caret model position.

Specified by:
getModelPosition in interface CaretModel
Returns:
the caret model position.

setModelPosition

public void setModelPosition(CaretPosition p)
Sets the caret model position.

Specified by:
setModelPosition in interface CaretModel
Parameters:
p - the caret model position.

getViewPosition

public CaretPosition getViewPosition()
Gets the caret view position.

Specified by:
getViewPosition in interface CaretModel
Returns:
the caret view position.

setViewPosition

public void setViewPosition(CaretPosition vp)
Sets the caret view position.

Specified by:
setViewPosition in interface CaretModel
Parameters:
vp - the caret view position.

setOffset

public void setOffset(int offset)
Sets the offset.

Specified by:
setOffset in interface CaretModel
Parameters:
offset - the offset in the Document

getOffset

public int getOffset()
Gets the offset.

Specified by:
getOffset in interface CaretModel
Returns:
the offset.

addCaretListener

public void addCaretListener(CaretListener caretlistener)
Description copied from interface: CaretModel
Adds caret listener to listen to any changes in the caret position.

Specified by:
addCaretListener in interface CaretModel
Parameters:
caretlistener - a CaretListener to be added.

removeCaretListener

public void removeCaretListener(CaretListener caretlistener)
Description copied from interface: CaretModel
Removes caret listener that is added before.

Specified by:
removeCaretListener in interface CaretModel
Parameters:
caretlistener - the CaretListener to be removed.

getCaretListeners

public CaretListener[] getCaretListeners()
Gets the CaretListeners register on DefaultCaretModel.

Specified by:
getCaretListeners in interface CaretModel
Returns:
the CaretListeners.

fireCaretEvent

protected void fireCaretEvent(int type,
                              CaretPosition oldPosition,
                              CaretPosition newPosition)

moveCaret

public void moveCaret(int xOffset,
                      int yOffset,
                      boolean select,
                      boolean columnSelection,
                      boolean scrollVisible)
Moves caret from its current position to another position using the x and y offset.

Specified by:
moveCaret in interface CaretModel
Parameters:
xOffset - the x offset from its current caret model position. For example, if you move one char left, the xOffset will be -1.
yOffset - the y offset from its current caret model position. For example, if you move one line up, the yOffset will be -1.
select - whether to select from its current caret model position to the new position.
columnSelection - whether the selection is in column selection mode.
scrollVisible - whether scroll to the caret at its new position.

updateViewPosition

public void updateViewPosition()
Updates the caret view position from caret model position.

Specified by:
updateViewPosition in interface CaretModel

JIDE 3.5.15