View Javadoc

1   package com.explosion.expfmodules.texteditor;
2   
3   import java.awt.event.FocusListener;
4   
5   import javax.swing.text.JTextComponent;
6   
7   /* =============================================================================
8    *       
9    *     Copyright 2004 Stephen Cowx
10   *
11   *     Licensed under the Apache License, Version 2.0 (the "License");
12   *     you may not use this file except in compliance with the License.
13   *     You may obtain a copy of the License at
14   *
15   *     http://www.apache.org/licenses/LICENSE-2.0
16   *
17   *     Unless required by applicable law or agreed to in writing, software
18   *     distributed under the License is distributed on an "AS IS" BASIS,
19   *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   *     See the License for the specific language governing permissions and
21   *     limitations under the License.
22   * 
23   * =============================================================================
24   */
25  
26  /***
27   * @author Stephen
28   * Created on 28-Jun-2004
29   */
30  public interface Editable
31  {
32  
33      /***
34       * Allows text to be selected
35       * @param startSelection
36       * @param endSelection
37       */
38      public abstract void select(int startSelection, int endSelection);
39      
40      /***
41       * Allows text to be selected
42       * @throws Exception
43       */
44      public abstract void selectAll() throws Exception;    
45      
46      /***
47       * Allows a focus listener to ba attached
48       * @param listener
49       */
50      public void addFocusListener(FocusListener listener);
51  
52      /***
53       * Allows preferences to be applied
54       *
55       */
56      public abstract void applyPreferences();
57  
58      /***
59       * Clear this tool
60       */
61      public abstract void clear() throws Exception;
62  
63      /***
64       * Undo the last command executed by the user
65       */
66      public abstract void undo() throws Exception;
67  
68      /***
69       * Undo the last n commands executed by the user
70       */
71      public abstract void undo(int numberOfSteps) throws Exception;
72  
73      /***
74       * Allows redoable edits to be redone
75       * @throws Exception
76       */
77      public abstract void redo() throws Exception;
78      
79      /***
80       * Allows Cut to be performed
81       * @throws Exception
82       */
83      public abstract void cut() throws Exception;
84      
85      /***
86       * Allows sopy to be performed
87       * @throws Exception
88       */
89      public abstract void copy() throws Exception;
90      
91      /***
92       * Allows paste to be performed
93       * @throws Exception
94       */
95      public abstract void paste() throws Exception;
96  	
97  	/***
98  	 * Returns the textComponent associated with this object
99  	 * @return
100 	 */
101 	public abstract JTextComponent getTextComponent();
102  
103 }