Statistics
| Revision:

root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / iconthemes / IIconTheme.java @ 38078

History | View | Annotate | Download (6.06 KB)

1 29593 jpiera
package org.gvsig.andami.iconthemes;
2 15944 jmvivo
3
import java.net.URL;
4 38078 jjdelcerro
import java.util.Iterator;
5 15944 jmvivo
6
import javax.swing.ImageIcon;
7
8
public interface IIconTheme {
9
10
        /**
11
         * Load all icons from the IconTheme
12
         */
13 38078 jjdelcerro
        public void load();
14 15944 jmvivo
15 38078 jjdelcerro
        public void setDefault(IIconTheme def);
16 15944 jmvivo
17 38078 jjdelcerro
        public IIconTheme getDefault();
18 15944 jmvivo
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 38078 jjdelcerro
        public boolean exists(String iconName);
30 15944 jmvivo
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 38078 jjdelcerro
        public ImageIcon get(String iconName);
43 15944 jmvivo
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 38078 jjdelcerro
        public ImageIcon get(String iconName, ClassLoader loader);
60 15944 jmvivo
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 38078 jjdelcerro
        public void registerDefault(String iconName, ImageIcon image);
76 15944 jmvivo
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 38078 jjdelcerro
        public void registerDefault(String iconName, Object resource);
90 15944 jmvivo
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 38078 jjdelcerro
        public void register(String iconName, ImageIcon image);
106 15944 jmvivo
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 38078 jjdelcerro
        public void register(String iconName, Object resource);
120 15944 jmvivo
121
        /**
122
         * Gets the theme name.
123
         * @return theme name
124
         */
125 38078 jjdelcerro
        public String getName();
126 15944 jmvivo
127
        /**
128
         * Sets the theme name.
129
         *
130
         * @param themeName
131
         */
132 38078 jjdelcerro
        public void setName(String themeName);
133 15944 jmvivo
134
        /**
135
         * Gets the theme description.
136
         *
137
         * @return The description of this theme.
138
         */
139 38078 jjdelcerro
        public String getDescription();
140 15944 jmvivo
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 38078 jjdelcerro
        public void setDescription(String description);
150 15944 jmvivo
151
        /**
152
         * Returns the theme version. It defaults to "1.0".
153
         *
154
         * @return The version of this theme.
155
         */
156 38078 jjdelcerro
        public String getVersion();
157 15944 jmvivo
158
        /**
159
         * Set the theme version.
160
         *
161
         * @param version
162
         */
163 38078 jjdelcerro
        public void setVersion(String version);
164 15944 jmvivo
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 38078 jjdelcerro
        public Object getResource();
172 15944 jmvivo
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 38078 jjdelcerro
        public void setResource(Object resource);
180 15944 jmvivo
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 38078 jjdelcerro
        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 15944 jmvivo
206
        public ImageIcon getNoIcon();
207 38078 jjdelcerro
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 15944 jmvivo
215
}