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 |
package org.gvsig.tools.swing.icontheme; |
---|---|
2 |
|
3 |
import java.awt.Image; |
4 |
import java.io.File; |
5 |
import java.net.URL; |
6 |
import java.util.Iterator; |
7 |
|
8 |
import javax.swing.ImageIcon; |
9 |
|
10 |
import org.gvsig.andami.PluginServices; |
11 |
|
12 |
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 |
/**
|
28 |
* Load all icons from the IconTheme
|
29 |
*/
|
30 |
public void load(Object resource) throws IllegalArgumentException; |
31 |
|
32 |
|
33 |
public void setDefault(IconTheme def); |
34 |
|
35 |
public IconTheme getDefault();
|
36 |
|
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 |
public boolean exists(String name); |
48 |
|
49 |
/**
|
50 |
* 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 |
*
|
55 |
* @param name
|
56 |
* The name whose associated icon is to be retrieved
|
57 |
*
|
58 |
* @return
|
59 |
* The icon associated with the provided name
|
60 |
*/
|
61 |
public ImageIcon get(String iconName); |
62 |
|
63 |
/**
|
64 |
* Return the ThemeIcon associated with the name.
|
65 |
*
|
66 |
* @param name of the icon
|
67 |
* @return the IconTheme requiered
|
68 |
*/
|
69 |
public Icon getThemeIcon(String name); |
70 |
|
71 |
/**
|
72 |
* Gets the theme name of the theme
|
73 |
* @return theme name
|
74 |
*/
|
75 |
public String getName(); |
76 |
|
77 |
/**
|
78 |
* Sets the theme name of the theme
|
79 |
*
|
80 |
* @param themeName
|
81 |
*/
|
82 |
public void setName(String themeName); |
83 |
|
84 |
public String getID(); |
85 |
|
86 |
public void setID(String id); |
87 |
|
88 |
/**
|
89 |
* Gets the theme description.
|
90 |
*
|
91 |
* @return The description of this theme.
|
92 |
*/
|
93 |
public String getDescription(); |
94 |
|
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 |
public void setDescription(String description); |
104 |
|
105 |
/**
|
106 |
* Return an iterator over the names of the icons in the theme.
|
107 |
*
|
108 |
* @return iterator of names of icons
|
109 |
*/
|
110 |
public Iterator<String> iterator(); |
111 |
|
112 |
/**
|
113 |
* Return an iterator over the ThemIcon in the theme.
|
114 |
*
|
115 |
* @return iterator of ThemeIcon
|
116 |
*/
|
117 |
public Iterator<Icon> getThemeIcons(); |
118 |
|
119 |
|
120 |
/**
|
121 |
* Return the icon used as icon by default when the requested icon
|
122 |
* not exists.
|
123 |
*
|
124 |
* @return the default icon to use.
|
125 |
*/
|
126 |
public ImageIcon getDefaultIcon(); |
127 |
|
128 |
/**
|
129 |
* Set the default icon to use when the requestd icon not exists.
|
130 |
*
|
131 |
* @param icon
|
132 |
*/
|
133 |
public void setDefaultIcon(ImageIcon icon); |
134 |
|
135 |
public void setDefaultIcon(URL resource); |
136 |
|
137 |
public void setDefaultIcon(String name); |
138 |
|
139 |
/**
|
140 |
* 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 |
*/
|
154 |
public void registerDefault(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
155 |
|
156 |
/**
|
157 |
* 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 |
*
|
161 |
* 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 |
*/
|
171 |
public void register(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
172 |
|
173 |
public void export(File folder); |
174 |
|
175 |
/**
|
176 |
* @deprecated use {@link #getDefaultIcon()}
|
177 |
* @return
|
178 |
*/
|
179 |
public ImageIcon getNoIcon(); |
180 |
|
181 |
/**
|
182 |
* @deprecated use {@link #get(String)} instead
|
183 |
*/
|
184 |
public ImageIcon get(String iconName, ClassLoader loader); |
185 |
|
186 |
/**
|
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 |
} |