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