01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
05: *
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: */
22:
23: package net.sf.jmoney.model2;
24:
25: import org.eclipse.swt.widgets.Control;
26:
27: /**
28: * Interface into a control that edits a property value.
29: * <P>
30: * All registered properties must include an implementation
31: * of the <code>IPropertyControlFactory</code> interface. This interface
32: * contains the createPropertyControl method which is called
33: * to create a <code>Control</code> that can edit the property.
34: * The <code>Control</code> is wrapped in an <code>IPropertyControl</code>
35: * implementation that handles the movement of data between the
36: * property and the control.
37: *
38: * @see IPropertyControlFactory
39: * @see org.eclipse.swt.widgets.Control
40: * @author Nigel Westbury
41: * @author Johann Gyger
42: */
43: public interface IPropertyControl {
44:
45: /**
46: * This method gives access to the underlying control.
47: * Do not use this method to get the control for the
48: * purposes of getting and setting property values
49: * to and from the control. Instead use the methods in
50: * this interface. Use this method to get the control
51: * for the purpose of adding focus listeners and other
52: * such functionality.
53: *
54: * @return The underlying control.
55: */
56: Control getControl();
57:
58: /**
59: * Load the value into the control. If the
60: * object is null then the control must both have its
61: * value blanked out and be disabled.
62: *
63: * @param object The object that contains the value of
64: * the property.
65: */
66: void load(ExtendableObject object);
67:
68: /**
69: * This method takes the data in the control and sets it
70: * into the datastore. This method must be called before
71: * a control is destroyed, otherwise data entered by the user
72: * may not be saved.
73: * <P>
74: * Some controls will save data in response to user edits.
75: * Combo boxes typically do this. Other controls, such as
76: * text boxes, do not.
77: */
78: void save();
79: }
|