View Javadoc

1   /***
2    * Copyright (C) 2006 Philipp Mpalampanis
3    *
4    * License: MPL 1.1/GPL 2.0/LGPL 2.1
5    *
6    * The contents of this file are subject to the Mozilla Public License Version
7    * 1.1 (the "License"); you may not use this file except in compliance with
8    * the License. You may obtain a copy of the License at
9    * http://www.mozilla.org/MPL/
10   *
11   * Software distributed under the License is distributed on an "AS IS" basis,
12   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13   * for the specific language governing rights and limitations under the
14   * License.
15   *
16   * Alternatively, the contents of this file may be used under the terms of
17   * either the GNU General Public License Version 2 or later (the "GPL"), or
18   * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19   * in which case the provisions of the GPL or the LGPL are applicable instead
20   * of those above. If you wish to allow use of your version of this file only
21   * under the terms of either the GPL or the LGPL, and not to allow others to
22   * use your version of this file under the terms of the MPL, indicate your
23   * decision by deleting the provisions above and replace them with the notice
24   * and other provisions required by the GPL or the LGPL. If you do not delete
25   * the provisions above, a recipient may use your version of this file under
26   * the terms of any one of the MPL, the GPL or the LGPL.
27   */
28  
29  package net.sf.echobinding;
30  
31  import java.beans.PropertyChangeListener;
32  
33  import net.sf.echobinding.binding.BindingContext;
34  import net.sf.echobinding.model.ComponentModel;
35  import nextapp.echo2.app.Border;
36  
37  /***
38   * The BoundControl interface defines the basic functions that
39   * controls must provide for data binding.
40   */
41  public interface BoundControl extends ComponentModel, PropertyChangeListener {
42  
43  	/***
44  	 * Sets the binding context for this widget.
45  	 * 
46  	 * @param context the context
47  	 */
48  	void setBindingConext(BindingContext context);
49  
50  	/***
51  	 * Sets the adaper id for this widget. The adapter id will be used
52  	 * to identify the PropertyAdapter which provides the access to the
53  	 * model.
54  	 * 
55  	 * @param adapterId the adapter id
56  	 */
57  	void setAdapterId(String adapterId);
58  
59  	/***
60  	 * Loads the model's state into the control.
61  	 */
62  	void update();
63  
64  	/***
65  	 * Commits the control's state to the modell.
66  	 * 
67  	 */
68  	void save();
69  
70  	/***
71  	 * Checks, if the widget's input is valid.
72  	 * 
73  	 * @return true, if is valid
74  	 */
75  	boolean isValid();
76  
77  	/***
78  	 * Checks, if the widget's input was changed by the user.
79  	 * 
80  	 * @return true, if is dirty
81  	 */
82  	boolean isDirty();
83  
84  	/***
85  	 * Validates the widget's input and invokes the validation handler to report
86  	 * validation errors.
87  	 */
88  	void validateInput();
89  	
90  	
91  	/***
92  	 * Returns the value currently stored in the widget.
93  	 *  
94  	 * @return
95  	 */
96  	Object getValue();
97  	
98  	/***
99  	 * Sets the value of the widget.
100 	 * 
101 	 * @param value
102 	 */
103 	void setValue(Object value);
104 	
105 	/***
106 	 * Returns the widget's border.
107 	 * @return
108 	 */
109 	Border getBorder();
110 	
111 	/***
112 	 * Sets the widget's border.
113 	 * 
114 	 * @param border
115 	 */
116 	void setBorder(Border border);
117 	
118 }