KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > engine > AnnotatedObject


1 /*
2  * Copyright 2002-2006 the original author or authors.
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.springframework.webflow.engine;
17
18 import org.springframework.webflow.core.collection.AttributeMap;
19 import org.springframework.webflow.core.collection.LocalAttributeMap;
20 import org.springframework.webflow.core.collection.MutableAttributeMap;
21 import org.springframework.webflow.definition.Annotated;
22
23 /**
24  * A base class for all objects in the web flow system that support annotation
25  * using arbitrary properties. Mainly used to ensure consistent configuration of
26  * properties for all annotated objects.
27  *
28  * @author Erwin Vervaet
29  * @author Keith Donald
30  */

31 public abstract class AnnotatedObject implements Annotated {
32
33     /**
34      * The caption property name ("caption"). A caption is also known as a
35      * "short description" and may be used in a GUI tooltip.
36      */

37     public static final String JavaDoc CAPTION_PROPERTY = "caption";
38
39     /**
40      * The long description property name ("description"). A description
41      * provides additional, free-form detail about this object and might be
42      * shown in a GUI text area.
43      */

44     public static final String JavaDoc DESCRIPTION_PROPERTY = "description";
45
46     /**
47      * Additional properties further describing this object. The properties set
48      * in this map may be arbitrary.
49      */

50     private LocalAttributeMap attributes = new LocalAttributeMap();
51
52     // implementing Annotated
53

54     public String JavaDoc getCaption() {
55         return attributes.getString(CAPTION_PROPERTY);
56     }
57
58     public String JavaDoc getDescription() {
59         return attributes.getString(DESCRIPTION_PROPERTY);
60     }
61
62     public AttributeMap getAttributes() {
63         return attributes;
64     }
65     
66     // mutators
67

68     /**
69      * Sets the short description (suitable for display in a tooltip).
70      * @param caption the caption
71      */

72     public void setCaption(String JavaDoc caption) {
73         attributes.put(CAPTION_PROPERTY, caption);
74     }
75
76     /**
77      * Sets the long description.
78      * @param description the long description
79      */

80     public void setDescription(String JavaDoc description) {
81         attributes.put(DESCRIPTION_PROPERTY, description);
82     }
83
84     /**
85      * Returns the mutable attribute map for this annotated object. May be used
86      * to set attributes after construction.
87      */

88     public MutableAttributeMap getAttributeMap() {
89         return attributes;
90     }
91 }
Popular Tags