Revision 10626 trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/catalogClient/loaders/LayerLoader.java

View differences:

LayerLoader.java
44 44
import java.util.TreeMap;
45 45

  
46 46
import com.iver.andami.PluginServices;
47
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
47 48
import com.iver.cit.gvsig.fmap.MapContext;
48 49
import com.iver.cit.gvsig.fmap.MapContext.LayerEventListener;
49 50
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
......
64 65
 */
65 66
public abstract class LayerLoader {
66 67
	private static TreeMap loadersPool = new TreeMap();
67
	
68

  
68 69
	static {
69 70
		LayerLoader.addLoader(Resource.WMS, WMSLayerLoader.class);
70 71
		LayerLoader.addLoader(Resource.POSTGIS, PostgisLayerLoader.class);
......
75 76
		LayerLoader.addLoader(Resource.ARCIMS_IMAGE, ARCIMSLayerLoader.class);
76 77
		LayerLoader.addLoader(Resource.ARCIMS_VECTORIAL, ARCIMSLayerLoader.class);
77 78
	}
78
	
79

  
79 80
	public static void addLoader(String key, Class loader) {
80 81
		LayerLoader.loadersPool.put(key, loader);
81 82
	}
82
	
83

  
83 84
	public static LayerLoader getLoader(Resource resource) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
84 85
		if (LayerLoader.loadersPool.containsKey(resource.getType())) {
85 86
			Class llClass = (Class) LayerLoader.loadersPool.get(resource.getType());
......
89 90
		}
90 91
		return null;
91 92
	}
92
	
93

  
93 94
	private Resource resource = null;
94
		
95

  
95 96
	public LayerLoader(Resource resource){
96 97
		this.resource = resource;
97 98
	}
98
	
99
	abstract public void loadLayer() throws LayerLoaderException;
100
	
99

  
100
	abstract public void loadLayer() throws LoadLayerException;
101

  
101 102
	/**
102 103
	 * It returns the error message
103 104
	 * @return
104 105
	 * Error Message
105 106
	 */
106 107
	abstract protected String getErrorMessage();
107
	
108

  
108 109
	/**
109 110
	 * It returns the window title for an window error message
110 111
	 * @return
111 112
	 * Window title
112 113
	 */
113 114
	abstract protected String getWindowMessage();
114
	
115

  
115 116
	/**
116 117
     * It adds a new layer to the current view
117 118
     * @param lyr
118 119
     * Layer lo load
119 120
     */
120 121
    protected void addLayerToView(FLayer lyr) {
121
		View theView = 
122
		View theView =
122 123
			(View) PluginServices.getMDIManager().getActiveWindow();
123
				
124
		if (lyr != null) {			
124

  
125
		if (lyr != null) {
125 126
			theView.getMapControl().getMapContext().beginAtomicEvent();
126 127
			theView.getMapControl().getMapContext().getLayers().addLayer(lyr);
127 128
			theView.getMapControl().getMapContext().endAtomicEvent();
......
138 139
		this.resource = resource;
139 140
	}
140 141

  
141
	
142
	
143 142

  
144
    
145
	
143

  
144

  
145

  
146

  
146 147
}

Also available in: Unified diff