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  import java.util.Collection;
15  import java.util.List;
16  
17  /***
18   * TextPiece can have many small not overlapping selections within. Selection
19   * Intervals are within text piece, with end posibly one behind(0 <= start
20   * <= end < length). Every selection interval says what is selected -
21   * start and end are indexes of bounding characters
22   * <em> start included, end not included</em> in selection. Indexes are in
23   * rendered text or one behind.
24   * 
25   * @author Martin Kollar 30.9.2005 Tomas Studva
26   */
27  public interface ITextPieceSelectionStatus {
28  
29          /***
30           * Returns selection that relates to this text piece.
31           * 
32           * @return list by copy, not overlapping Intervals within text piece.
33           */
34          public List<Interval> getSelectionIntervals();
35  
36          /***
37           * Test if something is selected, but not everything
38           * 
39           * @return <code>true</code>, if something is selected, but it is not
40           *         fully selected
41           */
42          public boolean isPartlySelected();
43  
44          /***
45           * Test if whole text is selected.
46           * 
47           * @return <code>true</code>, if whole ITextPieceKeeper is selected
48           */
49          public boolean isFullySelected();
50  
51          /***
52           * Sets what is selected
53           * 
54           * @param intervals
55           *                Collection of intervals, that are in range text and
56           *                are not overlaping
57           */
58          public void setSelectionIntervals(Collection<Interval> intervals);
59  
60          /***
61           * Clears the selection
62           */
63          public void clear();
64  
65          /***
66           * Select whole text of keeper.
67           */
68          public void selectFull();
69  
70          /***
71           * Adds interval to selection. After addition intervals are tidied to
72           * not overlap.
73           * 
74           * @param interval
75           *                Interval to add to selection
76           */
77          public void addSelectionInterval(Interval interval);
78  
79          /***
80           * Subtracts interval from selection
81           * 
82           * @param interval
83           *                Interval to subtract
84           */
85          public void subtractSelectionInterval(Interval interval);
86  
87          /***
88           * Makes XOR with this new interval
89           * 
90           * @param intervals
91           *                Interval to XOR with others
92           */
93          public void xorSelectionIntervals(Collection<Interval> intervals);
94  }