root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / tools / swing / icontheme / IconTheme.java @ 38564
History | View | Annotate | Download (5.25 KB)
1 | 38564 | jjdelcerro | package org.gvsig.tools.swing.icontheme; |
---|---|---|---|
2 | 15944 | jmvivo | |
3 | 38564 | jjdelcerro | import java.awt.Image; |
4 | import java.io.File; |
||
5 | 15944 | jmvivo | import java.net.URL; |
6 | 38078 | jjdelcerro | import java.util.Iterator; |
7 | 15944 | jmvivo | |
8 | import javax.swing.ImageIcon; |
||
9 | |||
10 | 38564 | jjdelcerro | import org.gvsig.andami.PluginServices; |
11 | 15944 | jmvivo | |
12 | 38564 | jjdelcerro | public interface IconTheme { |
13 | |||
14 | public static final String NO_ICON_NAME = "-no-icon-"; |
||
15 | |||
16 | interface Icon extends Comparable<Icon> { |
||
17 | public String getName(); |
||
18 | public String getGroup() ; |
||
19 | public ImageIcon getImageIcon(); |
||
20 | public Image getImage(); |
||
21 | public Object getResource() ; |
||
22 | public URL getURL() ; |
||
23 | public String getLabel(); |
||
24 | public String getProviderName(); |
||
25 | } |
||
26 | |||
27 | 15944 | jmvivo | /**
|
28 | * Load all icons from the IconTheme
|
||
29 | */
|
||
30 | 38564 | jjdelcerro | public void load(Object resource) throws IllegalArgumentException; |
31 | |||
32 | 15944 | jmvivo | |
33 | 38564 | jjdelcerro | public void setDefault(IconTheme def); |
34 | 15944 | jmvivo | |
35 | 38564 | jjdelcerro | public IconTheme getDefault();
|
36 | 15944 | jmvivo | |
37 | /**
|
||
38 | * Returns <code>true</code> if the icon theme contains a mapping for the
|
||
39 | * specified iconName.
|
||
40 | *
|
||
41 | * @param iconName The key to check if it has been registered in this
|
||
42 | * IconTheme
|
||
43 | *
|
||
44 | * @return <code>true</code> if this IconTheme contains
|
||
45 | * <code>iconName</code>, <code>false</code> otherwise.
|
||
46 | */
|
||
47 | 38564 | jjdelcerro | public boolean exists(String name); |
48 | 15944 | jmvivo | |
49 | /**
|
||
50 | 38564 | jjdelcerro | * Gets the ImageIcon associated with the provided name, if the name
|
51 | * is present in the theme. If the icon not exists try to return
|
||
52 | * a icon with name "no-icon" or returns <code>null</code> if
|
||
53 | * this not exists.
|
||
54 | 15944 | jmvivo | *
|
55 | 38564 | jjdelcerro | * @param name
|
56 | * The name whose associated icon is to be retrieved
|
||
57 | 15944 | jmvivo | *
|
58 | * @return
|
||
59 | 38564 | jjdelcerro | * The icon associated with the provided name
|
60 | 15944 | jmvivo | */
|
61 | 38078 | jjdelcerro | public ImageIcon get(String iconName); |
62 | 38564 | jjdelcerro | |
63 | 15944 | jmvivo | /**
|
64 | 38564 | jjdelcerro | * Return the ThemeIcon associated with the name.
|
65 | *
|
||
66 | * @param name of the icon
|
||
67 | * @return the IconTheme requiered
|
||
68 | 15944 | jmvivo | */
|
69 | 38564 | jjdelcerro | public Icon getThemeIcon(String name); |
70 | 15944 | jmvivo | |
71 | /**
|
||
72 | 38564 | jjdelcerro | * Gets the theme name of the theme
|
73 | 15944 | jmvivo | * @return theme name
|
74 | */
|
||
75 | 38078 | jjdelcerro | public String getName(); |
76 | 15944 | jmvivo | |
77 | /**
|
||
78 | 38564 | jjdelcerro | * Sets the theme name of the theme
|
79 | 15944 | jmvivo | *
|
80 | * @param themeName
|
||
81 | */
|
||
82 | 38078 | jjdelcerro | public void setName(String themeName); |
83 | 15944 | jmvivo | |
84 | 38564 | jjdelcerro | public String getID(); |
85 | |||
86 | public void setID(String id); |
||
87 | |||
88 | 15944 | jmvivo | /**
|
89 | * Gets the theme description.
|
||
90 | *
|
||
91 | * @return The description of this theme.
|
||
92 | */
|
||
93 | 38078 | jjdelcerro | public String getDescription(); |
94 | 15944 | jmvivo | |
95 | /**
|
||
96 | * Sets the theme description. It should be a short description
|
||
97 | * (around 20-30 words), including the highlights of the theme,
|
||
98 | * the author and maybe its email address or a link the the theme's
|
||
99 | * homepage.
|
||
100 | *
|
||
101 | * @param description
|
||
102 | */
|
||
103 | 38078 | jjdelcerro | public void setDescription(String description); |
104 | 15944 | jmvivo | |
105 | /**
|
||
106 | 38564 | jjdelcerro | * Return an iterator over the names of the icons in the theme.
|
107 | *
|
||
108 | * @return iterator of names of icons
|
||
109 | 15944 | jmvivo | */
|
110 | 38564 | jjdelcerro | public Iterator<String> iterator(); |
111 | 15944 | jmvivo | |
112 | /**
|
||
113 | 38564 | jjdelcerro | * Return an iterator over the ThemIcon in the theme.
|
114 | *
|
||
115 | * @return iterator of ThemeIcon
|
||
116 | 15944 | jmvivo | */
|
117 | 38564 | jjdelcerro | public Iterator<Icon> getThemeIcons(); |
118 | 15944 | jmvivo | |
119 | 38564 | jjdelcerro | |
120 | 15944 | jmvivo | /**
|
121 | 38564 | jjdelcerro | * Return the icon used as icon by default when the requested icon
|
122 | * not exists.
|
||
123 | *
|
||
124 | * @return the default icon to use.
|
||
125 | 15944 | jmvivo | */
|
126 | 38564 | jjdelcerro | public ImageIcon getDefaultIcon(); |
127 | |||
128 | 15944 | jmvivo | /**
|
129 | 38564 | jjdelcerro | * Set the default icon to use when the requestd icon not exists.
|
130 | *
|
||
131 | * @param icon
|
||
132 | 15944 | jmvivo | */
|
133 | 38564 | jjdelcerro | public void setDefaultIcon(ImageIcon icon); |
134 | 15944 | jmvivo | |
135 | 38564 | jjdelcerro | public void setDefaultIcon(URL resource); |
136 | |||
137 | public void setDefaultIcon(String name); |
||
138 | |||
139 | 15944 | jmvivo | /**
|
140 | 38564 | jjdelcerro | * Register a icon in the theme.
|
141 | * The parameter icon can be null if the resource is specified.
|
||
142 | * The parameter resource can be null if the icon is specified.
|
||
143 | *
|
||
144 | * Plugin and group can be null.
|
||
145 | *
|
||
146 | * @param provider name of the icon
|
||
147 | * @param group name for the icon.
|
||
148 | * @param name of icon
|
||
149 | * @param icon, can be nulll if the resource is specified.
|
||
150 | * @param resource, resource of the icon, usualy and url to the icon.
|
||
151 | *
|
||
152 | * @throws IllegalArgumentException if name is null/empty or icon/resource are null
|
||
153 | 15944 | jmvivo | */
|
154 | 38564 | jjdelcerro | public void registerDefault(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
155 | |||
156 | 38078 | jjdelcerro | /**
|
157 | 38564 | jjdelcerro | * Register a icon in the theme.
|
158 | * The parameter icon can be null if the resource is specified.
|
||
159 | * The parameter resource can be null if the icon is specified.
|
||
160 | 38078 | jjdelcerro | *
|
161 | 38564 | jjdelcerro | * Plugin and group can be null.
|
162 | *
|
||
163 | * @param provider name of the icon
|
||
164 | * @param group name for the icon.
|
||
165 | * @param name of icon
|
||
166 | * @param icon, can be nulll if the resource is specified.
|
||
167 | * @param resource, resource of the icon, usualy and url to the icon.
|
||
168 | *
|
||
169 | * @throws IllegalArgumentException if name is null/empty or icon/resource are null
|
||
170 | 38078 | jjdelcerro | */
|
171 | 38564 | jjdelcerro | public void register(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
172 | 15944 | jmvivo | |
173 | 38564 | jjdelcerro | public void export(File folder); |
174 | |||
175 | /**
|
||
176 | * @deprecated use {@link #getDefaultIcon()}
|
||
177 | * @return
|
||
178 | */
|
||
179 | 15944 | jmvivo | public ImageIcon getNoIcon(); |
180 | 38078 | jjdelcerro | |
181 | /**
|
||
182 | 38564 | jjdelcerro | * @deprecated use {@link #get(String)} instead
|
183 | 38078 | jjdelcerro | */
|
184 | 38564 | jjdelcerro | public ImageIcon get(String iconName, ClassLoader loader); |
185 | 15944 | jmvivo | |
186 | 38564 | jjdelcerro | /**
|
187 | * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
|
||
188 | */
|
||
189 | public void registerDefault(String iconName, ImageIcon image); |
||
190 | |||
191 | /**
|
||
192 | * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
|
||
193 | */
|
||
194 | public void registerDefault(String iconName, Object resource); |
||
195 | |||
196 | /**
|
||
197 | * @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)}
|
||
198 | */
|
||
199 | public void register(String iconName, ImageIcon image); |
||
200 | |||
201 | /**
|
||
202 | * @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)}
|
||
203 | */
|
||
204 | public void register(String iconName, Object resource); |
||
205 | } |