View Javadoc

1   /*
2    * Copyright 1999-2006 Faculty of Mathematics, Physics
3    * and Informatics, Comenius University, Bratislava. This file is protected by
4    * the Mozilla Public License version 1.1 (the License); you may not use this
5    * file except in compliance with the License. You may obtain a copy of the
6    * License at http://euromath2.sourceforge.net/license.html Unless required by
7    * applicable law or agreed to in writing, software distributed under the
8    * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
9    * OF ANY KIND, either express or implied. See the License for the specific
10   * language governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.editor.textEditor;
13  
14  /***
15   * Keeps piece of text of textual node. This text is localized by locator into
16   * segment of one line. Properties of this text are held by ITextPieceInfo.
17   * 
18   * @author Tomáš Studva, Martin Kollár
19   */
20  public interface ITextPieceKeeper {
21  
22      /***
23       * Returns ITextPieceContainer where keeper is held.
24       * 
25       * @return container containing this keeper
26       */
27      public ITextPieceContainer getTextContainer();
28  
29      /***
30       * Returns ITextLocator for this keeper.
31       * 
32       * @return text locator to lacate keeped text piece
33       */
34      public ITextLocator getTextLocator();
35  
36      /***
37       * Returns ITextPieceInfo about keeper's text piece.
38       * 
39       * @return info for keeped text
40       */
41      public ITextPieceInfo getTextPieceInfo();
42  
43      /***
44       * Returns text from node before keeper's text.
45       * 
46       * @return substring of textual node's text, with start index 0 to offset of
47       *         first character of keeper's text in node's text.
48       */
49      public String getPreviousText();
50  
51      /***
52       * Returns text before keeper's text from node + substring of keeper's text
53       * to position index. Character at position index is not included (it is
54       * like substring).
55       * 
56       * @return substring of textual node's text, with start index 0 to (offset
57       *         of first character of keeper's text + position) in node's text.
58       * @param index
59       *            local position in text
60       */
61      public String getWholeTextToPosition(int index);
62  
63      /***
64       * Returns keeper's text.
65       * 
66       * @return text piece of textual node held by this keeper.
67       */
68      public String getText();
69  
70      /***
71       * Returns status about which text is selected.
72       * 
73       * @return selection status
74       */
75      public ITextPieceSelectionStatus getSelectionStatus();
76  
77      /***
78       * Selects whole text.
79       */
80      void select();
81  
82      /***
83       * Selects text starting at position start and ending at position end - 1.
84       * 
85       * @param start
86       *            index of first character in the selection
87       * @param end
88       *            index of first character that is not in the selection
89       */
90      void select(int start, int end);
91  
92      /***
93       * Deselects anything selected.
94       */
95      void deselect();
96  
97  }