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. Position is specified by
20 * ITextPieceKeeper and offset.
21 *
22 * @author Martin Kollar 17.11.2005
23 */
24 public class InsertTextRequest extends EditTextRequest implements IRequestSpecialization {
25 /***
26 * Holds text to insert.
27 */
28 private String text;
29
30 /***
31 * Holds offset in text piece where to insert text.
32 */
33 private int offset;
34
35 /***
36 * Constructor.
37 *
38 * @param text
39 * to insert
40 * @param offset
41 * offset in text piece(ITextPieceKeeper's text) from where text
42 * should be deleted, must be valid (in range of text piece)
43 * @param source
44 * ITextPieceKeeper where to insert Text
45 */
46 public InsertTextRequest(ITextPieceKeeper source, String text, int offset) {
47 super(source);
48 this.text = text;
49 this.offset = offset;
50 }
51
52 /***
53 * Returns position in text piece where to insert text.
54 *
55 * @return offset in text piece (ITextPieceKeeper's text)
56 */
57 public int getOffset() {
58 return this.offset;
59 }
60
61 /***
62 * Returns text to insert.
63 * @return Returns the text.
64 */
65 public String getText() {
66 return this.text;
67 }
68
69 public String getSpecialization() {
70 return RequestConstants.INSERT_TEXT_REQUEST;
71 }
72
73
74 }