01: // FormField.java
02: // $Id: FormField.java,v 1.3 2000/08/16 21:37:49 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.forms;
07:
08: import java.awt.Component;
09:
10: abstract public class FormField {
11: /**
12: * The field's name.
13: */
14: protected String name = null;
15: /**
16: * The field's title.
17: */
18: protected String title = null;
19: /**
20: * The associated form manager.
21: */
22: protected FormManager manager = null;
23:
24: /**
25: * Get the field's name.
26: */
27:
28: public String getName() {
29: return name;
30: }
31:
32: /**
33: * Get the field's title.
34: */
35:
36: public String getTitle() {
37: return title;
38: }
39:
40: /**
41: * Our editor is telling us that it got the focus, propagate to manager.
42: */
43:
44: protected void gotFocus() {
45: manager.gotFocus(this );
46: }
47:
48: /**
49: * Get this field value's in its native type.
50: */
51:
52: abstract public Object getValue();
53:
54: /**
55: * Set this field value.
56: * @param value This field's new value.
57: * @param notify Should we notify the manager for this change ?
58: * @param update Update the editor view, if <strong>true</strong>.
59: * @exception IllegalFieldValueException If the field rejected the
60: * value.
61: */
62:
63: abstract public void setValue(Object value, boolean notify,
64: boolean update) throws IllegalFieldValueException;
65:
66: /**
67: * Set this field's value, notifying the manager.
68: * @param value The new field value.
69: * @param update Should we update the editor's view ?
70: * @exception IllegalFieldValueException If the field rejected the value.
71: */
72:
73: public void setValue(Object value, boolean update)
74: throws IllegalFieldValueException {
75: setValue(value, true, update);
76: }
77:
78: /**
79: * Get this field graphical editor.
80: */
81:
82: abstract Component getEditor();
83:
84: /**
85: * Form field basic constructor.
86: */
87:
88: public FormField(FormManager manager, String name, String title) {
89: this.manager = manager;
90: this.name = name;
91: this.title = title;
92: }
93:
94: }
|