svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.swing / org.gvsig.expressionevaluator.swing.api / src / main / java / org / gvsig / expressionevaluator / swing / spi / AbstractElement.java @ 43983
History | View | Annotate | Download (1.45 KB)
1 | 43983 | jjdelcerro | package org.gvsig.expressionevaluator.swing.spi; |
---|---|---|---|
2 | |||
3 | import javax.swing.ImageIcon; |
||
4 | import org.gvsig.expressionevaluator.swing.Element; |
||
5 | import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
||
6 | import org.gvsig.tools.swing.api.Component; |
||
7 | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
||
8 | import org.gvsig.tools.swing.icontheme.IconTheme; |
||
9 | |||
10 | /**
|
||
11 | *
|
||
12 | * @author jjdelcerro
|
||
13 | */
|
||
14 | public abstract class AbstractElement implements Element { |
||
15 | |||
16 | final String name; |
||
17 | final String description; |
||
18 | final String iconName; |
||
19 | final ImageIcon icon; |
||
20 | |||
21 | protected AbstractElement(String name, String description) { |
||
22 | this(name,description,null); |
||
23 | } |
||
24 | |||
25 | protected AbstractElement(String name, String description, String iconName) { |
||
26 | this.name = name;
|
||
27 | this.description = description;
|
||
28 | this.iconName = iconName;
|
||
29 | IconTheme theme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
||
30 | this.icon = theme.get(iconName);
|
||
31 | } |
||
32 | |||
33 | @Override
|
||
34 | public String getName() { |
||
35 | return this.name; |
||
36 | } |
||
37 | |||
38 | @Override
|
||
39 | public String getDescription() { |
||
40 | return this.description; |
||
41 | } |
||
42 | |||
43 | @Override
|
||
44 | public String getIconName() { |
||
45 | return iconName;
|
||
46 | } |
||
47 | |||
48 | @Override
|
||
49 | public ImageIcon getIcon() { |
||
50 | return this.icon; |
||
51 | } |
||
52 | |||
53 | @Override
|
||
54 | public Component getAditionalPanel() { |
||
55 | return null; |
||
56 | } |
||
57 | |||
58 | @Override
|
||
59 | public String toString() { |
||
60 | return this.getName(); |
||
61 | } |
||
62 | |||
63 | |||
64 | } |