Initialize
[sdk/ide/product.git] / org.eclipse.jst.pagedesigner / src / org / eclipse / jst / pagedesigner / itemcreation / customizer / AttributeData.java
1 package org.eclipse.jst.pagedesigner.itemcreation.customizer;\r
2 \r
3 import java.util.HashMap;\r
4 import java.util.Map;\r
5 \r
6 /**\r
7  * Class containing all the data that pertains to the customization\r
8  * of a tag's attributes. \r
9  * \r
10  * @author prusev\r
11  * @author Debajit Adhikary\r
12  *\r
13  */\r
14 public class AttributeData {\r
15 \r
16         private Map<String, String> attrs = new HashMap<String, String>();\r
17 \r
18         \r
19         /**\r
20          * Returns a map of the attributes (Name-Value pairs)\r
21          * \r
22          * @return Map of attribute names and values\r
23          * \r
24          */\r
25         public Map<String, String> getAttributes()\r
26         {\r
27                 return attrs;\r
28         }\r
29 \r
30         \r
31         /**\r
32          * Sets the attribute data to the map of attribute names and values\r
33          * provided.\r
34          * \r
35          * @param attribs\r
36          *            Map of attribute names and values\r
37          * \r
38          */\r
39         public void setAttributes(Map<String, String> attribs)\r
40         {\r
41             attrs.clear();\r
42             attrs.putAll(attribs);\r
43         }\r
44 \r
45         \r
46         /**\r
47          * Adds an attribute.\r
48          * \r
49          * @param attr\r
50          *            Attribute name\r
51          * @param userVal\r
52          *            Attribute value\r
53          * \r
54          */\r
55         public void addAttribute(String attr, String userVal)\r
56         {\r
57                 attrs.put(attr, userVal);\r
58         }\r
59 \r
60         /**\r
61          * Returns the value for a given attribute name.\r
62          * \r
63          * @param attr\r
64          *            Attribute name whose value is to be found\r
65          * @return Attribute value for the given attribute name\r
66          * \r
67          */\r
68         public String getValForAttrib(String attr)\r
69         {\r
70                 return attrs.get(attr);\r
71         }\r
72 }\r