1 package com.atlassian.plugin.web.descriptors;
2
3 import com.atlassian.plugin.Plugin;
4 import com.atlassian.plugin.PluginParseException;
5 import com.atlassian.plugin.web.model.DefaultWebIcon;
6 import com.atlassian.plugin.web.model.DefaultWebLink;
7 import com.atlassian.plugin.web.model.WebIcon;
8 import com.atlassian.plugin.web.model.WebLink;
9 import com.atlassian.plugin.web.WebInterfaceManager;
10 import org.dom4j.Element;
11
12
13
14
15 public class DefaultWebItemModuleDescriptor extends AbstractWebFragmentModuleDescriptor implements WebItemModuleDescriptor
16 {
17 private String section;
18 private WebIcon icon;
19 private DefaultWebLink link;
20 private String styleClass;
21
22 public DefaultWebItemModuleDescriptor(WebInterfaceManager webInterfaceManager)
23 {
24 super(webInterfaceManager);
25 }
26
27 public DefaultWebItemModuleDescriptor()
28 {
29 }
30
31 public void init(Plugin plugin, Element element) throws PluginParseException
32 {
33 super.init(plugin, element);
34
35 section = element.attributeValue("section");
36
37 if (element.element("styleClass") != null)
38 {
39 styleClass = element.element("styleClass").getTextTrim();
40 }
41 else
42 {
43 styleClass = "";
44 }
45 }
46
47 public String getSection()
48 {
49 return section;
50 }
51
52 public WebLink getLink()
53 {
54 return link;
55 }
56
57 public WebIcon getIcon()
58 {
59 return icon;
60 }
61
62 public String getStyleClass()
63 {
64 return styleClass;
65 }
66
67 public void enabled()
68 {
69 super.enabled();
70
71
72 if (element.element("icon") != null)
73 {
74 icon = new DefaultWebIcon(element.element("icon"), webInterfaceManager.getWebFragmentHelper(), contextProvider, this);
75 }
76 if (element.element("link") != null)
77 {
78 link = new DefaultWebLink(element.element("link"), webInterfaceManager.getWebFragmentHelper(), contextProvider, this);
79 }
80 }
81 }