KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > forms > formmodel > WidgetDefinition


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.forms.formmodel;
17
18 import org.apache.cocoon.util.location.Locatable;
19 import org.apache.cocoon.util.location.Location;
20 import org.xml.sax.ContentHandler JavaDoc;
21 import org.xml.sax.SAXException JavaDoc;
22
23 /**
24  * A WidgetDefinition holds all the static information about a Widget. It's
25  * function is a lot like that of the class in Java. Users of the Cocoon Forms framework
26  * usually won't have to bother with the WidgetDefinition's, but will rather use
27  * the Widget's themselves.
28  *
29  * @version $Id: WidgetDefinition.java 289538 2005-09-16 13:46:22Z sylvain $
30  */

31 public interface WidgetDefinition extends Locatable {
32
33     /**
34      * Initializes this definition with values from the given other definition
35      */

36     void initializeFrom(WidgetDefinition definition) throws Exception JavaDoc;
37     
38     /**
39      * Gets the {@link FormDefinition}.
40      */

41     FormDefinition getFormDefinition();
42
43     /**
44      * Sets the parent of this definition.
45      */

46     void setParent(WidgetDefinition definition);
47
48     /**
49      * Gets source location of this widget definition.
50      */

51     Location getLocation();
52
53     /**
54      * Gets id of this widget definition.
55      */

56     String JavaDoc getId();
57
58     /**
59      * Gets an attribute that has been defined on the widget's definition.
60      *
61      * @param name the attribute name
62      * @return the attribute value, or null if it doesn't exist
63      */

64     Object JavaDoc getAttribute(String JavaDoc name);
65
66     /**
67      * Validate a widget using the validators that were defined in its definition. If validation
68      * fails, the validator has set a validation error on the widget or one of its children.
69      *
70      * @param widget the widget
71      * @return <code>true</code> if validation was successful.
72      */

73     boolean validate(Widget widget);
74
75     /**
76      * Checks whether this definition is complete since we are allowed to have partial
77      * definitions in libraries. Definitions need to be complete _before_ a call to
78      * createInstance() though.
79      */

80     void checkCompleteness() throws IncompletenessException;
81     
82     /**
83      * Creates and returns a widget based on this widget definition.
84      */

85     Widget createInstance();
86
87     /**
88      * Generates SAX events for named display data.
89      */

90     void generateDisplayData(String JavaDoc name, ContentHandler JavaDoc contentHandler) throws SAXException JavaDoc;
91
92     /**
93      * Generates SAX events for display data.
94      */

95     void generateDisplayData(ContentHandler JavaDoc contentHandler) throws SAXException JavaDoc;
96
97     /**
98      * Generates SAX events for the label of this widget.
99      */

100     void generateLabel(ContentHandler JavaDoc contentHandler) throws SAXException JavaDoc;
101 }
102
Popular Tags