Revision 38078

View differences:

branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/ShowDevelInfoExtension.java
2 2

  
3 3
import java.awt.BorderLayout;
4 4
import java.awt.Dimension;
5
import java.awt.Toolkit;
6
import java.awt.datatransfer.StringSelection;
7 5
import java.awt.event.ActionEvent;
8 6
import java.awt.event.ActionListener;
9 7
import java.awt.event.ComponentEvent;
10 8
import java.awt.event.ComponentListener;
9
import java.io.File;
10
import java.io.FileWriter;
11
import java.io.IOException;
11 12
import java.util.ArrayList;
12 13
import java.util.Collections;
13 14
import java.util.Comparator;
15
import java.util.Iterator;
14 16
import java.util.List;
15 17
import java.util.Set;
16 18
import java.util.TreeSet;
......
22 24
import javax.swing.JScrollPane;
23 25
import javax.swing.JTextPane;
24 26

  
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

  
27
import org.gvsig.andami.iconthemes.IIconTheme;
28
import org.gvsig.andami.iconthemes.IconThemeManager;
28 29
import org.gvsig.andami.plugins.Extension;
29 30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory;
30 32
import org.gvsig.andami.ui.mdiManager.WindowInfo;
33
import org.gvsig.andami.ui.mdiManager.MDIManager.UIActionTool;
31 34
import org.gvsig.app.ApplicationLocator;
32 35
import org.gvsig.tools.ToolsLocator;
33 36
import org.gvsig.tools.dataTypes.DataTypesManager;
......
37 40
import org.gvsig.tools.persistence.PersistenceManager;
38 41
import org.gvsig.tools.persistence.Persistent;
39 42
import org.gvsig.tools.persistence.exception.PersistenceException;
43
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
40 45

  
41 46
public class ShowDevelInfoExtension extends Extension {
42 47
	public static final int MODE_DIALOG = 1;
43 48
    public static final int MODE_WINDOW = 2;
44 49
    public static final int MODE_TOOL = 3;
45 50

  
46
    private Logger LOG = LoggerFactory.getLogger(ShowDevelInfoExtension.class);
51
    private Logger logger = LoggerFactory.getLogger(ShowDevelInfoExtension.class);
47 52
    
48 53
	public void initialize() {
49 54
		// Do nothing
......
56 61
		try {
57 62
			manager.setAutoValidation(PersistenceManager.MANDATORY_IF_DECLARED);
58 63
		} catch (PersistenceException e) {
59
			LOG.warn("Error modificando el modo de autovalidacion de persistencia.", e);
64
			logger.warn("Error modificando el modo de autovalidacion de persistencia.", e);
60 65
		}
61 66
		
62 67
	}
......
64 69
	public void execute(String actionCommand) {
65 70
		if( "ShowPersistenceFactories".equalsIgnoreCase(actionCommand) ) {
66 71
			showInfoPanel("Persistence factories", MODE_WINDOW, this.getPersistenceFactories());
72
		} else if( "ShowIconThemeInformation".equalsIgnoreCase(actionCommand) ) {
73
			showInfoPanel("Icon theme information", MODE_WINDOW, this.getIconThemeInformation());
74
		} else if( "ShowActionsInformation".equalsIgnoreCase(actionCommand) ) {
75
			showInfoPanel("Actions information", MODE_WINDOW, this.getActionsInformation());
67 76
		}
68 77
		
69 78
	}
70 79

  
80
	private String getActionsInformation() {
81
		StringBuffer buffer = new StringBuffer();
82
		
83
		buffer.append("<html>\n");
84
		buffer.append("<body>\n");
85
		buffer.append("<h2>Actions information</h2>\n");
86
		buffer.append("<br>\n");
87

  
88
		buffer.append("<table border=\"0\">\n");
89
		buffer.append("  <tr>\n");
90
		buffer.append("    <td>Name</td>\n");
91
		buffer.append("    <td>Extension</td>\n");
92
		buffer.append("    <td>Position</td>\n");
93
		buffer.append("    <td>Text</td>\n");
94
		buffer.append("    <td>Command</td>\n");
95
		buffer.append("    <td>Icon</td>\n");
96
		buffer.append("    <td>Tip</td>\n");
97
		buffer.append("    <td>Enabled text</td>\n");
98
		buffer.append("  </tr>\n");
99
		Iterator<UIActionTool> actions = MDIManagerFactory.createManager().getActionTools();
100
		while( actions.hasNext() ) {
101
			UIActionTool action = actions.next();
102
			buffer.append("  <tr>\n");
103
			buffer.append("    <td>").append(action.getName()).append("</td>\n");
104
			buffer.append("    <td>").append(action.getExtensionName()).append("</td>\n");
105
			buffer.append("    <td>").append(action.getPosition()).append("</td>\n");
106
			buffer.append("    <td>").append(action.getText()).append("</td>\n");
107
			buffer.append("    <td>").append(action.getCommand()).append("</td>\n");
108
			buffer.append("    <td>").append(action.getIconName()).append("</td>\n");
109
			buffer.append("    <td>").append(action.getTooptip()).append("</td>\n");
110
			buffer.append("    <td>").append(action.getEnableText()).append("</td>\n");
111
			buffer.append("  </tr>\n");
112
		}
113
		buffer.append("</table>\n");
114
		buffer.append("</body>\n");
115
		buffer.append("</html>\n");
116

  
117
		save2file("actionsinfo",buffer.toString());
118

  
119
		return buffer.toString();	}
120

  
121
	private String getIconThemeInformation() {
122
		StringBuffer buffer = new StringBuffer();
123
		
124
		IconThemeManager manager = IconThemeManager.getIconThemeManager();
125
		IIconTheme theme = manager.getCurrent();
126
		
127
		buffer.append("<html>\n");
128
		buffer.append("<body>\n");
129
		buffer.append("<h2>Icon theme information</h2>\n");
130
		buffer.append("<br>\n");
131
		buffer.append("Theme: ");
132
		buffer.append(theme.getName());
133
		buffer.append("<br>\n");
134
		buffer.append("Description: ");
135
		buffer.append(theme.getDescription());
136
		buffer.append("<br>\n");
137
		buffer.append("Version: ");
138
		buffer.append(theme.getVersion());
139
		buffer.append("<br>\n");
140

  
141
		buffer.append("<table border=\"0\">\n");
142
		buffer.append("  <tr>\n");
143
		buffer.append("    <td>Name</td>\n");
144
		buffer.append("    <td>Resource id</td>\n");
145
		buffer.append("  </tr>\n");
146
		Iterator<String> names = theme.iterator();
147
		while( names.hasNext() ) {
148
			String name = names.next();
149
			buffer.append("  <tr>\n");
150
			buffer.append("    <td>").append(name).append("</td>\n");
151
			buffer.append("    <td>").append(theme.getResourceID(name)).append("</td>\n");
152
			buffer.append("  </tr>\n");
153
		}
154
		buffer.append("</table>\n");
155
		buffer.append("</body>\n");
156
		buffer.append("</html>\n");
157

  
158
		save2file("iconthemeinfo",buffer.toString());
159
		
160
		return buffer.toString();
161
	}
162

  
163
	private void save2file(String name, String contents) {
164
		File file;
165
		try {
166
			file = File.createTempFile("gvsig-"+name, ".html");
167
			FileWriter fwriter = new FileWriter(file);
168
			fwriter.append(contents);
169
			fwriter.close();
170
		} catch (IOException e) {
171
			logger.warn("Can't save contents to temp file gvsig-"+name, e );
172
		}
173
	}
174
	
71 175
	public boolean isEnabled() {
72 176
		return true;
73 177
	}
......
120 224
		    copy = new JButton("Copy to clipboard");
121 225
		    copy.addActionListener(new ActionListener() {
122 226
			    public void actionPerformed(ActionEvent arg0) {
123
			    	StringSelection ss = new StringSelection(text.getText());
124
			    	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss,ss);
227
			    	ApplicationLocator.getManager().putInClipboard(text.getText());
125 228
			    }
126 229
		    });
127 230
		    
......
242 345

  
243 346
		public int compare(Object o1, Object o2) {
244 347
			if( o1==null || o2==null || ((Class)o1).getName()==null ) {
245
				LOG.warn("Esto no deberia estar pasando.");
348
				logger.warn("Esto no deberia estar pasando.");
246 349
				return 0; // FIXME
247 350
			}
248 351
			return ((Class)o1).getName().compareTo(((Class)o2).getName());
......
393 496
		buffer.append("</body>\n");
394 497
		buffer.append("</html>\n");
395 498
		
499
		save2file("persistenceinfo",buffer.toString());
500

  
396 501
		return buffer.toString();
397 502
	}
398 503

  
branches/v2_0_0_prep/applications/appgvSIG/config/config.xml
296 296
			active="true"
297 297
			priority="30">
298 298
			<menu text="tools/Development/Show persistence factories" position="7009020" action-command="ShowPersistenceFactories"/>
299
			<menu text="tools/Development/Show icon theme information" position="7009023" action-command="ShowIconThemeInformation"/>
300
			<menu text="tools/Development/Show actions information" position="7009026" action-command="ShowActionsInformation"/>
299 301
		</extension>
300 302

  
301 303

  
branches/v2_0_0_prep/libraries/libCorePlugin/src/org/gvsig/coreplugin/mdiManager/NewSkin.java
62 62
import java.util.HashMap;
63 63
import java.util.Hashtable;
64 64
import java.util.Iterator;
65
import java.util.List;
65 66
import java.util.Map;
66 67
import java.util.TreeMap;
67 68

  
......
80 81
import javax.swing.event.InternalFrameEvent;
81 82
import javax.swing.event.InternalFrameListener;
82 83

  
83
import org.slf4j.Logger;
84
import org.slf4j.LoggerFactory;
85

  
86 84
import org.gvsig.andami.PluginServices;
87 85
import org.gvsig.andami.plugins.Extension;
86
import org.gvsig.andami.plugins.config.generate.ActionTool;
87
import org.gvsig.andami.plugins.config.generate.Menu;
88
import org.gvsig.andami.plugins.config.generate.SelectableTool;
88 89
import org.gvsig.andami.ui.mdiFrame.GlassPane;
89 90
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
90 91
import org.gvsig.andami.ui.mdiFrame.NewStatusBar;
......
98 99
import org.gvsig.andami.ui.theme.Theme;
99 100
import org.gvsig.tools.swing.api.ToolsSwingLocator;
100 101
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
102
import org.slf4j.Logger;
103
import org.slf4j.LoggerFactory;
101 104

  
102 105

  
103

  
104 106
/**
105 107
 *
106 108
 */
......
145 147
    private Cursor lastCursor = null;
146 148
	private ImageIcon image;
147 149
	private String typeDesktop;
150

  
151

  
152
	private List<UIActionTool>actionTools = new ArrayList<UIActionTool>();
148 153
	
154
	private class MyActionTool implements UIActionTool {
155
		private String extensionName;
156
		private String name;
157
		private String text;
158
		private String command;
159
		private String iconName;
160
		private String enableText;
161
		private int position;
162
		private String tip;
163
		
164
		MyActionTool(String extensionName, ActionTool action) {
165
			this.extensionName = extensionName;
166
			this.name = action.getName();
167
			this.text = action.getText();
168
			this.command = action.getActionCommand();
169
			this.iconName = action.getIcon();
170
			this.enableText = action.getEnableText();
171
			this.position = action.getPosition();
172
			this.tip = action.getTooltip();
173
		}
174

  
175
		public MyActionTool(String extensionName, Menu action) {
176
			this.extensionName = extensionName;
177
			this.name = null;
178
			this.text = action.getText();
179
			this.command = action.getActionCommand();
180
			this.iconName = action.getIcon();
181
			this.enableText = action.getEnableText();
182
			this.position = action.getPosition();
183
			this.tip = action.getTooltip();
184
		}
185

  
186
		public MyActionTool(String extensionName, SelectableTool action) {
187
			this.extensionName = extensionName;
188
			this.name = action.getName();
189
			this.text = action.getText();
190
			this.command = action.getActionCommand();
191
			this.iconName = action.getIcon();
192
			this.enableText = action.getEnableText();
193
			this.position = action.getPosition();
194
			this.tip = action.getTooltip();
195
		}
196

  
197
		public String getExtensionName() {
198
			return this.extensionName;
199
		}
200

  
201
		public String getName() {
202
			return this.name;
203
		}
204

  
205
		public String getText() {
206
			return this.text;
207
		}
208

  
209
		public String getCommand() {
210
			return this.command;
211
		}
212

  
213
		public String getIconName() {
214
			return this.iconName;
215
		}
216

  
217
		public String getEnableText() {
218
			return this.enableText;
219
		}
220

  
221
		public int getPosition() {
222
			return this.position;
223
		}
224
		public String getTooptip() {
225
			return this.tip;
226
		}
227
	}
228
	
149 229
	//Anyade barras de scroll
150 230
	private void addScrolledDesktopPanel( JFrame parent, MyDesktopPane desktopPane) {
151 231
		JPanel toppanel;
......
1241 1321
        // to show it.
1242 1322
        ToolsSwingLocator.getWindowManager().showWindow(panel, title, mode);
1243 1323
    }
1324
    
1325
    public void registerAction(String extensionName, ActionTool action) {
1326
    	this.actionTools.add(new MyActionTool(extensionName, action));
1327
    }
1328
    
1329
    public void registerAction(String extensionName, Menu action) {
1330
    	this.actionTools.add(new MyActionTool(extensionName, action));
1331
    }
1332
    
1333
    public void registerAction(String extensionName, SelectableTool action) {
1334
    	this.actionTools.add(new MyActionTool(extensionName, action));
1335
    }
1336
    
1337
    public Iterator<UIActionTool> getActionTools() {
1338
    	return this.actionTools.iterator();
1339
    }
1244 1340
}
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiFrame/MDIFrame.java
301 301
        btn.setVisible(false);
302 302
        String name = toolBar.getName();
303 303

  
304
        MDIManagerFactory.createManager().registerAction(ext.getClassName(), selectableTool);
305
        
304 306
        SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name);
305 307

  
306 308
        if (jtb == null) {
......
396 398
        btn.setEnabled(false);
397 399
        btn.setVisible(false);
398 400

  
401
        MDIManagerFactory.createManager().registerAction(ext.getClassName(), actionTool);
402
        
399 403
        String name = toolBar.getName();
400 404

  
401 405
        SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name);
......
531 535
        nuevoMenu.addActionListener(this);
532 536
        menuPadre.add(nuevoMenu);
533 537
        controlClass.put(nuevoMenu, loader.loadClass(ext.getClassName()));
538

  
539
        MDIManagerFactory.createManager().registerAction(ext.getClassName(), menu);
540

  
541
        
534 542
    }
535 543

  
536 544
    /**
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiManager/MDIManager.java
41 41
package org.gvsig.andami.ui.mdiManager;
42 42

  
43 43
import java.beans.PropertyVetoException;
44
import java.util.Iterator;
44 45

  
45 46
import javax.swing.ImageIcon;
46 47
import javax.swing.JPanel;
47 48

  
49
import org.gvsig.andami.plugins.config.generate.ActionTool;
50
import org.gvsig.andami.plugins.config.generate.Menu;
51
import org.gvsig.andami.plugins.config.generate.SelectableTool;
48 52
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
49 53
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
50 54
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
......
81 85
 * @author Fernando Gonz?lez Cort?s
82 86
 */
83 87
public interface MDIManager {
88
	
89
	public interface UIActionTool {
90
		public String getExtensionName();
91
		public String getName();
92
		public String getText();
93
		public String getCommand();
94
		public String getIconName();
95
		public String getEnableText();
96
		public String getTooptip();
97
		public int getPosition();
98
	}
99
	
84 100
    /**
85 101
     * Initializes the MDIFrame. It must be called before starting
86 102
     * to use it. It receives the application's main frame
......
318 334
     * Theme.MOSAIC and Theme.EXPAND.
319 335
     */
320 336
	public void setBackgroundImage(ImageIcon image, String typeDesktop);
337

  
338
	public void registerAction(String extensionName, ActionTool action);
339
	public void registerAction(String extensionName, SelectableTool action);
340
	public void registerAction(String extensionName, Menu action);
341
	
342
	public Iterator<UIActionTool> getActionTools();
321 343
}
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/iconthemes/IIconTheme.java
1 1
package org.gvsig.andami.iconthemes;
2 2

  
3 3
import java.net.URL;
4
import java.util.Iterator;
4 5

  
5 6
import javax.swing.ImageIcon;
6 7

  
......
9 10
	/**
10 11
	 * Load all icons from the IconTheme
11 12
	 */
12
	public abstract void load();
13
	public void load();
13 14

  
14
	public abstract void setDefault(IIconTheme def);
15
	public void setDefault(IIconTheme def);
15 16

  
16
	public abstract IIconTheme getDefault();
17
	public IIconTheme getDefault();
17 18

  
18 19
	/**
19 20
	 * Returns <code>true</code> if the icon theme contains a mapping for the
......
25 26
	 * @return <code>true</code> if this IconTheme contains
26 27
	 * <code>iconName</code>, <code>false</code> otherwise.
27 28
	 */
28
	public abstract boolean exists(String iconName);
29
	public boolean exists(String iconName);
29 30

  
30 31
	/**
31 32
	 * Gets the ImageIcon associated with the provided key, if the key
......
38 39
	 * 			The icon associated with the provided key, or
39 40
	 * <code>null</code> otherwise.
40 41
	 */
41
	public abstract ImageIcon get(String iconName);
42
	public ImageIcon get(String iconName);
42 43

  
43 44
	/**
44 45
	 * Gets the ImageIcon associated with the provided key, if the key
......
55 56
	 * 			The icon associated with the provided key, or
56 57
	 * <code>no-icon</code> otherwise.
57 58
	 */
58
	public abstract ImageIcon get(String iconName, ClassLoader loader);
59
	public ImageIcon get(String iconName, ClassLoader loader);
59 60

  
60 61
	/**
61 62
	 * <p>Register in this theme the provided iconName and the associated
......
71 72
	 * @param image The image that is going to be associated with the
72 73
	 * provided icon name.
73 74
	 */
74
	public abstract void registerDefault(String iconName, ImageIcon image);
75
	public void registerDefault(String iconName, ImageIcon image);
75 76

  
76 77
	/**
77 78
	 * <p>Register in this theme the provided iconName and the associated
......
85 86
	 * @param resource The resource that is going to be asssocioated with the providad
86 87
	 * 	icon name
87 88
	 */
88
	public abstract void registerDefault(String iconName, Object resource);
89
	public void registerDefault(String iconName, Object resource);
89 90

  
90 91
	/**
91 92
	 * <p>Register in this theme the provided iconName and the associated
......
101 102
	 * @param image The image that is going to be associated with the
102 103
	 * provided icon name.
103 104
	 */
104
	public abstract void register(String iconName, ImageIcon image);
105
	public void register(String iconName, ImageIcon image);
105 106

  
106 107
	/**
107 108
	 * <p>Register in this theme the provided iconName and the associated
......
115 116
	 * @param resource The resource that is going to be asssocioated with the providad
116 117
	 * 	icon name
117 118
	 */
118
	public abstract void register(String iconName, Object resource);
119
	public void register(String iconName, Object resource);
119 120

  
120 121
	/**
121 122
	 * Gets the theme name.
122 123
	 * @return theme name
123 124
	 */
124
	public abstract String getName();
125
	public String getName();
125 126

  
126 127
	/**
127 128
	 * Sets the theme name.
128 129
	 *
129 130
	 * @param themeName
130 131
	 */
131
	public abstract void setName(String themeName);
132
	public void setName(String themeName);
132 133

  
133 134
	/**
134 135
	 * Gets the theme description.
135 136
	 *
136 137
	 * @return The description of this theme.
137 138
	 */
138
	public abstract String getDescription();
139
	public String getDescription();
139 140

  
140 141
	/**
141 142
	 * Sets the theme description. It should be a short description
......
145 146
	 *
146 147
	 * @param description
147 148
	 */
148
	public abstract void setDescription(String description);
149
	public void setDescription(String description);
149 150

  
150 151
	/**
151 152
	 * Returns the theme version. It defaults to "1.0".
152 153
	 *
153 154
	 * @return The version of this theme.
154 155
	 */
155
	public abstract String getVersion();
156
	public String getVersion();
156 157

  
157 158
	/**
158 159
	 * Set the theme version.
159 160
	 *
160 161
	 * @param version
161 162
	 */
162
	public abstract void setVersion(String version);
163
	public void setVersion(String version);
163 164

  
164 165
	/**
165 166
	 * Gets the Object which contains physically contains this theme on disk.
......
167 168
	 *
168 169
	 * @return
169 170
	 */
170
	public abstract Object getResource();
171
	public Object getResource();
171 172

  
172 173
	/**
173 174
	 * Sets the file which contains physically contains this theme on disk.
......
175 176
	 *
176 177
	 * @return
177 178
	 */
178
	public abstract void setResource(Object resource);
179
	public void setResource(Object resource);
179 180

  
180 181
	/**
181 182
	 * Return the URL which is currently associated with the
......
191 192
	 *
192 193
	 * @deprecated
193 194
	 */
194
	public abstract URL getURL(String iconName);
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);
195 205

  
196 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();
197 214

  
198 215
}
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/iconthemes/AbstractIconTheme.java
42 42

  
43 43

  
44 44
import java.net.URL;
45
import java.util.ArrayList;
46
import java.util.Collections;
45 47
import java.util.HashMap;
48
import java.util.HashSet;
49
import java.util.Iterator;
50
import java.util.Set;
51
import java.util.List;
46 52

  
47 53
import javax.swing.ImageIcon;
48 54

  
......
134 140
		return false;
135 141
	}
136 142

  
143
	public Iterator<String> iterator() {
144
		Set<String> names = new HashSet<String>();
145
		
146
		if( defaultTheme !=null ) {
147
			Iterator<String> it = defaultTheme.iterator();
148
			while( it.hasNext() ) {
149
				names.add(it.next());
150
			}
151
		}
152
		Iterator<String> it = iconList.keySet().iterator();
153
		while( it.hasNext() ) {
154
			names.add(it.next());
155
		}
156
		List<String> names2 = new ArrayList<String>(names);
157
		Collections.sort(names2);
158
		return names2.iterator();
159
	}
160
	
161
	
162
	
137 163
	/* (non-Javadoc)
138 164
	 * @see com.iver.andami.iconthemes.IIconTheme#get(java.lang.String)
139 165
	 */
......
151 177
			return toImageIcon(loader.getResource(iconName),iconName);
152 178
		}
153 179

  
154
		if (defaultTheme==null ){
155
			Object object = iconList.get(iconName);
156
			if (object!=null) {
157
				return toImageIcon(object,iconName);
158
			}
159
			return getNoIcon();
160
		}
161 180
		Object object = iconList.get(iconName);
162 181
		if (object!=null) {
163 182
			return toImageIcon(object,iconName);
164 183
		}
165
		if( defaultTheme.exists(iconName)) {
184
		if( defaultTheme!=null && defaultTheme.exists(iconName)) {
166 185
			return  defaultTheme.get(iconName, null);
167 186
		}
168 187
		return getNoIcon();
......
203 222
	 * @see com.iver.andami.iconthemes.IIconTheme#registerDefault(java.lang.String, java.lang.Object)
204 223
	 */
205 224
	public void registerDefault(String iconName, Object resource) {
206
		if (defaultTheme!=null)defaultTheme.register(iconName, resource);
207
		else register(iconName, resource);
225
		if (defaultTheme!=null) {
226
			defaultTheme.register(iconName, resource);
227
		} else {
228
			register(iconName, resource);
229
		}
208 230
	}
209 231

  
210 232
	/* (non-Javadoc)
......
294 316
		return null;
295 317
	}
296 318

  
319
	public String getResourceID(String iconName) {
320
		Object icon = null;
321
		icon = iconList.get(iconName);
322
		if( icon != null ) {
323
			return icon.toString();
324
		}
325
		icon = ((AbstractIconTheme)defaultTheme).iconList.get(iconName);
326
		if( icon != null ) {
327
			return icon.toString();
328
		}
329
		return "";
330
	}
297 331

  
298 332
}

Also available in: Unified diff