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