View Javadoc

1   package com.atlassian.plugin.web.model;
2   
3   import com.atlassian.plugin.web.WebFragmentHelper;
4   import com.atlassian.plugin.web.ContextProvider;
5   import com.atlassian.plugin.web.descriptors.WebFragmentModuleDescriptor;
6   import org.dom4j.Element;
7   
8   /**
9    * Represents an icon associated with an item. It will not always be displayed!
10   */
11  public class DefaultWebIcon implements WebIcon
12  {
13      private WebLink url;
14      private int width;
15      private int height;
16  
17      public DefaultWebIcon(Element iconEl, WebFragmentHelper webFragmentHelper, ContextProvider contextProvider, WebFragmentModuleDescriptor descriptor)
18      {
19          this.url = new DefaultWebLink(iconEl.element("link"), webFragmentHelper, contextProvider, descriptor);
20          this.width = Integer.parseInt(iconEl.attributeValue("width"));
21          this.height = Integer.parseInt(iconEl.attributeValue("height"));
22      }
23  
24      public WebLink getUrl()
25      {
26          return url;
27      }
28  
29      public int getWidth()
30      {
31          return width;
32      }
33  
34      public int getHeight()
35      {
36          return height;
37      }
38  }