1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.editor.textEditor.requests;
13
14 import org.eclipse.gef.EditPart;
15 import org.eclipse.gef.Request;
16 import org.eclipse.draw2d.geometry.Point;
17
18
19
20 /***
21 * @author TV Created on 15.7.2004
22 * @author Martin Kollar
23 * Finds next text holder.
24 */
25 public class RetargetCaretRequest extends Request {
26
27 private EditPart source;
28
29 private int keyCode;
30
31 private boolean acceptableChar;
32
33 private Point CaretXPartYPosition;
34
35 private char character;
36
37 private int caretOffset;
38
39 protected RetargetCaretRequest() {
40 super(RequestConstants.RETARGET_CARET_REQUEST);
41 }
42
43 /***
44 * @param fromPart Part that made this Request
45 * @param keyCode
46 * @param character
47 * @param acceptableChar <code>true</code> if this request was created because od char input
48 * @param CaretXPartYPosition x-coordinate is absolute Caret x-coordinate
49 * y-coordinate is EditPart bounds y-coordinate
50 * @param caretOffset
51 */
52 public RetargetCaretRequest(EditPart fromPart, int keyCode,char character, boolean acceptableChar,
53 Point CaretXPartYPosition, int caretOffset) {
54 this();
55 this.source = fromPart;
56 this.keyCode = keyCode;
57 this.character = character;
58 this.acceptableChar = acceptableChar;
59 this.CaretXPartYPosition = CaretXPartYPosition;
60 this.caretOffset = caretOffset;
61 }
62
63 /***
64 * @return Point, that x-coordinate is Caret x-coordinate
65 * y-coordinate is Part y-coordinate
66 */
67 public Point getPosition(){
68 return this.CaretXPartYPosition;
69 }
70
71 /***
72 * @return offset from start of text piece
73 */
74 public int getcaretOffset(){
75 return caretOffset;
76 }
77
78 public void setKeyCode(int code){
79 this.keyCode = code;
80 }
81
82 public int getKeyCode() {
83 return keyCode;
84 }
85
86 public char getCharacter(){
87 return character;
88 }
89
90 public boolean isAcceptableChar(){
91 return acceptableChar;
92 }
93
94 public EditPart getSource() {
95 return this.source;
96 }
97
98 }