|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.editor.textEditor.CaretManager
public class CaretManager
Each TextEditor can have its own CaretManager. CaretManager holds an instance
of Caret, shows it on Canvas and moves it. Caret is always placed in
ITextPieceKeeper at character gap. Character gap is gap between characters,
specialls are gaps at start and end of text. Are index from zero to length of
text. First gap(index 0) is before first character(index 0), last gap(index
length) is after last character(index length -1).
Constructor Summary | |
---|---|
CaretManager(Canvas canvas,
XMLAccess xmlAccess)
Constructor. |
Method Summary | |
---|---|
void |
activateCaret(ITextPieceKeeper keeper,
int gapIndex)
Activates Caret and shows it in keeper at character
gap gapIndex . |
protected boolean |
checkCaret()
Checks if Caret is ready to use |
void |
deactivateCaret()
Deactivates and hides Caret |
static int |
directionToKeyCode(String direction)
Converts direction string to key code. |
ITextPieceKeeper |
getActiveTextPieceKeeper()
Returns text piece keeper where caret is. |
int |
getCaretOffset()
Returns index of character gap, where caret is shown. |
DomPointer |
getDOMPointer()
|
org.eclipse.draw2d.geometry.Point |
getLocation()
see Caret.getLocation() |
protected void |
hideCaret()
|
boolean |
isCaretActive()
True if caret is active and visible. |
boolean |
moveCaret(Direction direction,
int count)
TODO GUI ctrl movement Moves Caret from the current position to one positions further in LEFT,RIGHT,UP,DOWN or to the end or start of the current line, if possible. |
protected void |
showCaret()
|
protected void |
showCaretAtCharGap(ITextPieceKeeper keeper,
int charGapIndex)
Shows caret at character gap charGapIndex in keeper. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CaretManager(Canvas canvas, XMLAccess xmlAccess)
canvas
- Canvas on that the Caret will be paintedxmlAccess
- The source document accessorMethod Detail |
---|
public static int directionToKeyCode(String direction)
s
- One of RequestConstants.LEFT[RIGHT,UP,DOWN,HOME,END]
public ITextPieceKeeper getActiveTextPieceKeeper()
public org.eclipse.draw2d.geometry.Point getLocation()
Caret.getLocation()
null
if it is not
activepublic DomPointer getDOMPointer()
null
public int getCaretOffset()
public boolean isCaretActive()
public void activateCaret(ITextPieceKeeper keeper, int gapIndex)
keeper
at character
gap gapIndex
.
keeper
- ITextPieceKeeper where Caret will be showngapIndex
- character gap index, where to show caretjavadoc to find out more about character gaps
public void deactivateCaret()
public boolean moveCaret(Direction direction, int count)
direction
- direction of movementnumber
- of chars to move
protected boolean checkCaret()
true
if caret is not null
and
is not disposedprotected void showCaret()
protected void hideCaret()
protected void showCaretAtCharGap(ITextPieceKeeper keeper, int charGapIndex)
charGapIndex
- index of character gap where to show caretkeeper
- ITextPieceKeeper where to show Caret
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |