1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.editor.textEditor.requests.editTextRequests;
13
14 import sk.uniba.euromath.editor.textEditor.ITextPieceKeeper;
15 import sk.uniba.euromath.editor.textEditor.requests.IRequestSpecialization;
16 import sk.uniba.euromath.editor.textEditor.requests.RequestConstants;
17
18 /***
19 * Request to insert text at specified position and to move caret to right
20 * position. Position is specified by ITextPieceKeeper and offset.
21 *
22 * @author Martin Kollar 17.11.2005
23 */
24 public class InsertTextRequest extends EditTextRequest implements
25 IRequestSpecialization {
26 /***
27 * Holds text to insert.
28 */
29 private String text;
30
31 /***
32 * Holds offset in text piece where to insert text.
33 */
34 private int offset;
35
36 /***
37 * Constructor.
38 *
39 * @param text
40 * to insert
41 * @param offset
42 * offset in text piece(ITextPieceKeeper's text) from
43 * where text should be deleted, must be valid (in range
44 * of text piece)
45 * @param keeper
46 * ITextPieceKeeper where to insert text
47 */
48 public InsertTextRequest(ITextPieceKeeper keeper, String text,
49 int offset) {
50 super(keeper);
51 this.text = text;
52 this.offset = offset;
53 }
54
55 /***
56 * Returns position in text piece where to insert text.
57 *
58 * @return offset in text piece (ITextPieceKeeper's text)
59 */
60 public int getOffset() {
61 return this.offset;
62 }
63
64 /***
65 * Returns text to insert.
66 *
67 * @return Returns the text.
68 */
69 public String getText() {
70 return this.text;
71 }
72
73
74
75
76
77 public String getSpecialization() {
78 return RequestConstants.INSERT_TEXT_REQUEST;
79 }
80
81 }