root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / iconthemes / IIconTheme.java @ 38078
History | View | Annotate | Download (6.06 KB)
1 |
package org.gvsig.andami.iconthemes; |
---|---|
2 |
|
3 |
import java.net.URL; |
4 |
import java.util.Iterator; |
5 |
|
6 |
import javax.swing.ImageIcon; |
7 |
|
8 |
public interface IIconTheme { |
9 |
|
10 |
/**
|
11 |
* Load all icons from the IconTheme
|
12 |
*/
|
13 |
public void load(); |
14 |
|
15 |
public void setDefault(IIconTheme def); |
16 |
|
17 |
public IIconTheme getDefault();
|
18 |
|
19 |
/**
|
20 |
* Returns <code>true</code> if the icon theme contains a mapping for the
|
21 |
* specified iconName.
|
22 |
*
|
23 |
* @param iconName The key to check if it has been registered in this
|
24 |
* IconTheme
|
25 |
*
|
26 |
* @return <code>true</code> if this IconTheme contains
|
27 |
* <code>iconName</code>, <code>false</code> otherwise.
|
28 |
*/
|
29 |
public boolean exists(String iconName); |
30 |
|
31 |
/**
|
32 |
* Gets the ImageIcon associated with the provided key, if the key
|
33 |
* is present in the theme, or returns <code>null</code> otherwise.
|
34 |
*
|
35 |
* @param iconName
|
36 |
* The key whose associated icon is to be retrieved
|
37 |
*
|
38 |
* @return
|
39 |
* The icon associated with the provided key, or
|
40 |
* <code>null</code> otherwise.
|
41 |
*/
|
42 |
public ImageIcon get(String iconName); |
43 |
|
44 |
/**
|
45 |
* Gets the ImageIcon associated with the provided key, if the key
|
46 |
* is present in the theme, or returns <code>null</code> otherwise.
|
47 |
*
|
48 |
* @param iconName
|
49 |
* The key whose associated icon is to be retrieved
|
50 |
*
|
51 |
* @param loader
|
52 |
* Class loader for localice icons when iconName is a
|
53 |
* resource name.
|
54 |
*
|
55 |
* @return
|
56 |
* The icon associated with the provided key, or
|
57 |
* <code>no-icon</code> otherwise.
|
58 |
*/
|
59 |
public ImageIcon get(String iconName, ClassLoader loader); |
60 |
|
61 |
/**
|
62 |
* <p>Register in this theme the provided iconName and the associated
|
63 |
* image. Developers
|
64 |
* must not override icons already registered, as this defeats the
|
65 |
* purpose of the IconTheme. Therefore, use the <code>exists</code>
|
66 |
* method before using <code>register</code>, to ensure the icon
|
67 |
* is not previously registered.</p>
|
68 |
*
|
69 |
* @param iconName The name of the icon to register. It is the name
|
70 |
* that will be used later to retrieve the icon.
|
71 |
*
|
72 |
* @param image The image that is going to be associated with the
|
73 |
* provided icon name.
|
74 |
*/
|
75 |
public void registerDefault(String iconName, ImageIcon image); |
76 |
|
77 |
/**
|
78 |
* <p>Register in this theme the provided iconName and the associated
|
79 |
* resource. Developers must not override icons already registered,
|
80 |
* as this defeats the purpose of the IconTheme. Therefore, use the
|
81 |
* <code>exists</code> method before using <code>register</code>, to
|
82 |
* ensure the icon is not previously registered.</p>
|
83 |
*
|
84 |
* @param iconName The name of the icon to register. It is the name
|
85 |
* that will be used later to retrieve the icon.
|
86 |
* @param resource The resource that is going to be asssocioated with the providad
|
87 |
* icon name
|
88 |
*/
|
89 |
public void registerDefault(String iconName, Object resource); |
90 |
|
91 |
/**
|
92 |
* <p>Register in this theme the provided iconName and the associated
|
93 |
* image. Developers
|
94 |
* must not override icons already registered, as this defeats the
|
95 |
* purpose of the IconTheme. Therefore, use the <code>exists</code>
|
96 |
* method before using <code>register</code>, to ensure the icon
|
97 |
* is not previously registered.</p>
|
98 |
*
|
99 |
* @param iconName The name of the icon to register. It is the name
|
100 |
* that will be used later to retrieve the icon.
|
101 |
*
|
102 |
* @param image The image that is going to be associated with the
|
103 |
* provided icon name.
|
104 |
*/
|
105 |
public void register(String iconName, ImageIcon image); |
106 |
|
107 |
/**
|
108 |
* <p>Register in this theme the provided iconName and the associated
|
109 |
* resource. Developers must not override icons already registered,
|
110 |
* as this defeats the purpose of the IconTheme. Therefore, use the
|
111 |
* <code>exists</code> method before using <code>register</code>, to
|
112 |
* ensure the icon is not previously registered.</p>
|
113 |
*
|
114 |
* @param iconName The name of the icon to register. It is the name
|
115 |
* that will be used later to retrieve the icon.
|
116 |
* @param resource The resource that is going to be asssocioated with the providad
|
117 |
* icon name
|
118 |
*/
|
119 |
public void register(String iconName, Object resource); |
120 |
|
121 |
/**
|
122 |
* Gets the theme name.
|
123 |
* @return theme name
|
124 |
*/
|
125 |
public String getName(); |
126 |
|
127 |
/**
|
128 |
* Sets the theme name.
|
129 |
*
|
130 |
* @param themeName
|
131 |
*/
|
132 |
public void setName(String themeName); |
133 |
|
134 |
/**
|
135 |
* Gets the theme description.
|
136 |
*
|
137 |
* @return The description of this theme.
|
138 |
*/
|
139 |
public String getDescription(); |
140 |
|
141 |
/**
|
142 |
* Sets the theme description. It should be a short description
|
143 |
* (around 20-30 words), including the highlights of the theme,
|
144 |
* the author and maybe its email address or a link the the theme's
|
145 |
* homepage.
|
146 |
*
|
147 |
* @param description
|
148 |
*/
|
149 |
public void setDescription(String description); |
150 |
|
151 |
/**
|
152 |
* Returns the theme version. It defaults to "1.0".
|
153 |
*
|
154 |
* @return The version of this theme.
|
155 |
*/
|
156 |
public String getVersion(); |
157 |
|
158 |
/**
|
159 |
* Set the theme version.
|
160 |
*
|
161 |
* @param version
|
162 |
*/
|
163 |
public void setVersion(String version); |
164 |
|
165 |
/**
|
166 |
* Gets the Object which contains physically contains this theme on disk.
|
167 |
* It may be a ZipFile or JarFile, or a directory.
|
168 |
*
|
169 |
* @return
|
170 |
*/
|
171 |
public Object getResource(); |
172 |
|
173 |
/**
|
174 |
* Sets the file which contains physically contains this theme on disk.
|
175 |
* It may be a ZipFile or JarFile, or a directory.
|
176 |
*
|
177 |
* @return
|
178 |
*/
|
179 |
public void setResource(Object resource); |
180 |
|
181 |
/**
|
182 |
* Return the URL which is currently associated with the
|
183 |
* provided icon name, if this icon was registered as an
|
184 |
* URL, or <code>null</code> if it is not present in the theme
|
185 |
* or it was registered as an IconImage.
|
186 |
*
|
187 |
* @param iconName
|
188 |
* @return The URL which is currently associated with the
|
189 |
* provided icon name, if this icon was registered as an
|
190 |
* URL, or <code>null</code> if it is not present in the theme
|
191 |
* or it was registered as an IconImage.
|
192 |
*
|
193 |
* @deprecated
|
194 |
*/
|
195 |
public URL getURL(String iconName); |
196 |
|
197 |
/**
|
198 |
* Return an id of the resource associated to the named icon
|
199 |
* or null if the icon has not id.
|
200 |
*
|
201 |
* @param iconName
|
202 |
* @return the id associated to the icon or null.
|
203 |
*/
|
204 |
public String getResourceID(String iconName); |
205 |
|
206 |
public ImageIcon getNoIcon(); |
207 |
|
208 |
/**
|
209 |
* Return an iterator over the names of the icons in the theme.
|
210 |
*
|
211 |
* @return iterator of names of icons
|
212 |
*/
|
213 |
public Iterator<String> iterator(); |
214 |
|
215 |
} |