1 /*** 2 * Redistribution and use in source and binary forms, with or without 3 * modification, are permitted provided that the following conditions are 4 * met : 5 * 6 * . Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * 9 * . Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * . The name of the author may not be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $Id$ 29 */ 30 31 package palmed.edit.view; 32 33 import java.io.IOException; 34 import java.io.InputStream; 35 import java.io.OutputStream; 36 import palmed.edit.selection.ILineVisitor; 37 import palmed.io.ISerializable; 38 39 /*** 40 * This interface defines the text box content operations. 41 * 42 * @author Mathieu Champlon 43 * @version $Revision$ $Date$ 44 */ 45 public interface IContent extends ISerializable 46 { 47 /*** 48 * Handle a character typing. 49 * 50 * @param keyCode the value of the key entered 51 */ 52 void type( int keyCode ); 53 54 /*** 55 * Handle an enter event. 56 */ 57 void enter(); 58 59 /*** 60 * Handle a backspace event. 61 */ 62 void backspace(); 63 64 /*** 65 * Handle a drag event to a given location. 66 * 67 * @param x destination column 68 * @param y destination line 69 */ 70 void drag( int x, int y ); 71 72 /*** 73 * Handle a click event at a given location. 74 * 75 * @param x location column 76 * @param y location line 77 */ 78 void click( int x, int y ); 79 80 /*** 81 * Visit a line of text. 82 * 83 * @param visitor the visitor 84 * @param y the line number 85 */ 86 void accept( ILineVisitor visitor, int y ); 87 88 /*** 89 * Register a view for events notification. 90 * 91 * @param view the view to register 92 */ 93 void register( IView view ); 94 95 /*** 96 * Reset the content. 97 */ 98 void clear(); 99 100 /*** 101 * Copy the current selected text. 102 * 103 * @param stream the stream to write to 104 * @throws IOException an io exception occurs 105 */ 106 void copy( OutputStream stream ) throws IOException; 107 108 /*** 109 * Cut the current selected text. 110 * 111 * @param stream the stream to write to 112 * @throws IOException an io exception occurs 113 */ 114 void cut( OutputStream stream ) throws IOException; 115 116 /*** 117 * Paste the given text. 118 * 119 * @param stream the stream to read from 120 * @throws IOException an io exception occurs 121 */ 122 void paste( InputStream stream ) throws IOException; 123 124 /*** 125 * Undo the last action. 126 */ 127 void undo(); 128 129 /*** 130 * Redo the last undo. 131 */ 132 void redo(); 133 }