View Javadoc

1   /*
2    * soapUI, copyright (C) 2004-2010 eviware.com
3    *
4    * soapUI is free software; you can redistribute it and/or modify it under the
5    * terms of version 2.1 of the GNU Lesser General Public License as published by
6    * the Free Software Foundation.
7    *
8    * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9    * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   * See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.support;
14  
15  import com.eviware.soapui.model.settings.Settings;
16  
17  /***
18   * Basic EditorModel for soapUI editors
19   */
20  
21  public interface EditorModel
22  {
23  	/***
24  	 * Return the settings to use for storing customizations (line-numbers, etc)
25  	 * 
26  	 * @return the settings to use
27  	 */
28  
29  	public Settings getSettings();
30  
31  	/***
32  	 * Returns the text to display in the editor
33  	 * 
34  	 * @return the text to display in the editor
35  	 */
36  
37  	public String getEditorText();
38  
39  	/***
40  	 * Save the text in the editor, usually called when the contents of the
41  	 * editor have changed
42  	 * 
43  	 * @param text
44  	 *           the editor text to save
45  	 */
46  
47  	public void setEditorText( String text );
48  
49  	/***
50  	 * Adds a listener for text changes
51  	 * 
52  	 * @param editorModelListener
53  	 */
54  
55  	public void addEditorModelListener( EditorModelListener editorModelListener );
56  
57  	/***
58  	 * Removes a listener for text changes
59  	 * 
60  	 * @param editorModelListener
61  	 */
62  
63  	public void removeEditorModelListener( EditorModelListener editorModelListener );
64  
65  	/***
66  	 * Interface for listeners to editor text changes
67  	 */
68  
69  	public interface EditorModelListener
70  	{
71  		/***
72  		 * Notification that should be sent by EditorModel to all registered
73  		 * listeners if the text changes by some external method (ie not via
74  		 * EditorModel.setEditorText() )
75  		 * 
76  		 * @param oldText
77  		 *           the old text value
78  		 * @param newText
79  		 *           the new text value
80  		 */
81  
82  		public void editorTextChanged( String oldText, String newText );
83  	}
84  }