1   package com.atlassian.plugins.codegen.modules.common.web;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import com.atlassian.plugins.codegen.modules.common.Label;
7   import com.atlassian.plugins.codegen.modules.common.Tooltip;
8   
9   /**
10   * @since 3.6
11   */
12  public class WebSectionProperties extends AbstractWebFragmentProperties
13  {
14  
15      public static final String LOCATION = "LOCATION";
16      public static final String LABEL = "LABEL";
17      public static final String PARAMS = "PARAMS";
18      public static final String TOOLTIP = "TOOLTIP";
19  
20      public WebSectionProperties()
21      {
22          this("My Web Section");
23      }
24  
25      public WebSectionProperties(String moduleName)
26      {
27          super(moduleName);
28          setParams(new HashMap<String, String>());
29      }
30  
31      public WebSectionProperties(String moduleName, String location)
32      {
33          this(moduleName);
34          setLocation(location);
35      }
36  
37      public void setLocation(String location)
38      {
39          setProperty(LOCATION, location);
40      }
41  
42      public String getLocation()
43      {
44          return getProperty(LOCATION);
45      }
46  
47      public void setLabel(Label label)
48      {
49          put(LABEL, label);
50          addI18nProperty(label.getKey(), label.getValue());
51      }
52  
53      public Label getLabel()
54      {
55          Label label = null;
56          if (keySet().contains(LABEL))
57          {
58              label = (Label) get(LABEL);
59          }
60          return label;
61      }
62  
63      public void setTooltip(Tooltip tooltip)
64      {
65          put(TOOLTIP, tooltip);
66          addI18nProperty(tooltip.getKey(), tooltip.getValue());
67      }
68  
69      public Tooltip getTooltip()
70      {
71          Tooltip tooltip = null;
72          if (keySet().contains(TOOLTIP))
73          {
74              tooltip = (Tooltip) get(TOOLTIP);
75          }
76          return tooltip;
77      }
78  
79      public void setParams(Map<String, String> params)
80      {
81          put(PARAMS, params);
82      }
83  
84      public void addParam(String name, String value)
85      {
86          ((Map<String, String>) get(PARAMS)).put(name, value);
87      }
88  }