Revision 220

View differences:

org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/pom.xml
37 37
		<dependency>
38 38
			<groupId>org.gvsig</groupId>
39 39
			<artifactId>org.gvsig.educa.thematicmap.lib.prov.installer</artifactId>
40
		</dependency>		
41
		<dependency>
42
			<groupId>org.gvsig</groupId>
43
			<artifactId>org.gvsig.educa.thematicmap.lib.prov.qresp</artifactId>
44
			<version>1.0.0-SNAPSHOT</version>
40 45
		</dependency>
41 46
		<dependency>
42 47
			<groupId>org.apache.commons</groupId>
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/distribution/distribution.xml
28 28
				<include>org.gvsig:org.gvsig.educa.thematicmap.lib.spi</include>
29 29
				<include>org.gvsig:org.gvsig.educa.thematicmap.swing.api</include>
30 30
				<include>org.gvsig:org.gvsig.educa.thematicmap.lib.prov.installer</include>
31
				<include>org.gvsig:org.gvsig.educa.thematicmap.lib.prov.qresp</include>
31 32
				<include>org.gvsig:org.gvsig.educa.thematicmap.swing.impl</include>
32 33
				<include>org.apache.commons:commons-io</include>
33 34
				<include>org.apache.commons:commons-lang3</include>
org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.lib/org.gvsig.educa.thematicmap.lib.impl/src/main/java/org/gvsig/educa/thematicmap/impl/editor/DefaultThematicMapCompilationEditor.java
38 38
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompilation;
39 39
import org.gvsig.educa.thematicmap.editor.ThematicMapCompilationEditor;
40 40
import org.gvsig.educa.thematicmap.editor.ThematicMapCompilationEditorListener;
41
import org.gvsig.educa.thematicmap.impl.IconThemeHelper;
41 42
import org.gvsig.gui.beans.wizard.WizardPanel;
42 43
import org.gvsig.gui.beans.wizard.WizardPanelActionListener;
43 44
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo;
......
132 133
        }
133 134
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
134 135

  
135
        URL iconURL =
136
            getClass().getClassLoader().getResource(
137
                "images/thematicmap-editor.png");
138
        ImageIcon icon = new ImageIcon(iconURL);
136
//        URL iconURL =
137
//            getClass().getClassLoader().getResource(
138
//                "images/thematicmap-editor.png");
139
        
140
        ImageIcon icon = IconThemeHelper.getImageIcon("thematicmap-editor-wizard");
139 141

  
140 142
        wizard = new WizardPanelWithLogo(icon);
141 143

  
org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.lib/org.gvsig.educa.thematicmap.lib.impl/src/main/java/org/gvsig/educa/thematicmap/impl/DefaultThematicMapProviderManager.java
1 1
package org.gvsig.educa.thematicmap.impl;
2 2

  
3 3
import java.util.ArrayList;
4
import java.util.Iterator;
4 5
import java.util.List;
5 6

  
6 7
import org.gvsig.educa.thematicmap.spi.ThematicMapProviderManager;
......
17 18
public class DefaultThematicMapProviderManager extends AbstractProviderManager
18 19
		implements ThematicMapProviderManager {
19 20

  
20
	private static final Logger logger = LoggerFactory.getLogger(DefaultThematicMapProviderManager.class);
21
	
21
	private static final Logger logger = LoggerFactory
22
			.getLogger(DefaultThematicMapProviderManager.class);
23

  
22 24
	public static final String PROVIDERS_NAME = "ThematicMap.providers";
23 25

  
24 26
	public static final String PROVIDERS_DESCRIPTION = "ThematicMap providers";
......
27 29
		super();
28 30
		System.out.println("\nprovider created!\n;");
29 31
	}
30
	
32

  
31 33
	@Override
32 34
	protected String getRegistryDescription() {
33 35
		return PROVIDERS_DESCRIPTION;
......
46 48
		ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
47 49
		List<ProviderFactory> factories = new ArrayList<ProviderFactory>();
48 50

  
49
		@SuppressWarnings("unchecked")
50
		List<String> factoryNames = epm.getNames();
51
		
52
		for (String factoryName : factoryNames) {
53
			ExtensionPoint ep = epm.get(factoryName);
54
			ProviderFactory factory = null; 
51
		ExtensionPoint ep_prov = epm.get(PROVIDERS_NAME);
52
		if( ep_prov == null ) {
53
			return factories;
54
		}
55
		Iterator factoriesIt =  ep_prov.iterator();
56
		while (factoriesIt.hasNext()) {
57
			ExtensionPoint ep = (ExtensionPoint) factoriesIt.next();
55 58

  
56
			if (ep != null) {
57
				try {
58
					factory = ((ProviderFactory) ep.create(factoryName));
59
					factories.add(factory);
60
				} catch (Exception e) {
61
					logger.info("Can't create ThematicMapProviderfactory for '"+factoryName+".");
62
				}
59
			String factoryName = ep.getName();
60

  
61
			ProviderFactory factory = null;
62

  
63
			try {
64
				factory = ((ProviderFactory) ep.create(factoryName));
65
				factories.add(factory);
66
			} catch (Exception e) {
67
				logger.info("Can't create ThematicMapProviderfactory for '"
68
						+ factoryName + ".");
63 69
			}
64 70
		}
65 71
		return factories;
org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.lib/org.gvsig.educa.thematicmap.lib.impl/src/main/java/org/gvsig/educa/thematicmap/impl/ThematicMapDefaultImplLibrary.java
72 72
            "org.gvsig.educa.thematicmap.impl.i18n.text",
73 73
            ThematicMapDefaultImplLibrary.class.getClassLoader(),
74 74
            ThematicMapDefaultImplLibrary.class.getClass().getName());
75
        
76
        IconThemeHelper.registerIcon("thematicmap-editor", "thematicmap-editor-wizard", this);
75 77
    }
76 78

  
77 79
}
org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.lib/org.gvsig.educa.thematicmap.lib.impl/src/main/java/org/gvsig/educa/thematicmap/impl/IconThemeHelper.java
1
package org.gvsig.educa.thematicmap.impl;
2

  
3
import java.awt.Image;
4

  
5
import javax.swing.ImageIcon;
6

  
7
import org.gvsig.tools.swing.api.ToolsSwingLocator;
8
import org.gvsig.tools.swing.icontheme.IconTheme;
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11

  
12
public class IconThemeHelper {
13

  
14
	private static Logger logger = LoggerFactory
15
			.getLogger(IconThemeHelper.class);
16

  
17
	public static void registerIcon(String group, String name, Object obj) {
18
		String resourceName;
19
		ClassLoader loader;
20
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager()
21
				.getCurrent();
22
		if (group == null || group.trim().length() == 0) {
23
			resourceName = "images/" + name + ".png";
24
		} else {
25
			resourceName = "images/" + group + "/" + name + ".png";
26
		}
27
		if (obj instanceof Class) {
28
			loader = ((Class) obj).getClassLoader();
29
		} else {
30
			loader = obj.getClass().getClassLoader();
31
		}
32
		try {
33
			iconTheme.registerDefault("mapcontrol", group, name, null,
34
					loader.getResource(resourceName));
35
		} catch (Throwable e) {
36
			logger.info(e.getMessage());
37
		}
38
	}
39

  
40
	public static ImageIcon getImageIcon(String iconName) {
41
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager()
42
				.getCurrent();
43
		return iconTheme.get(iconName);
44
	}
45

  
46
	public static Image getImage(String iconName) {
47
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager()
48
				.getCurrent();
49
		return iconTheme.get(iconName).getImage();
50
	}
51
}
0 52

  

Also available in: Unified diff