Revision 10626 trunk/examples/exaTemplateLayout/src/com/iver/templateLayout/TemplateExtension.java

View differences:

TemplateExtension.java
4 4
import java.util.ArrayList;
5 5
import java.util.Hashtable;
6 6

  
7
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
8
import com.hardcode.gdbms.engine.data.driver.DriverException;
7 9
import com.iver.andami.PluginServices;
8 10
import com.iver.andami.plugins.Extension;
9 11
import com.iver.andami.ui.mdiManager.IWindow;
10 12
import com.iver.cit.gvsig.Print;
11
import com.iver.cit.gvsig.fmap.DriverException;
13
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
12 14
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
13 15
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
14 16
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
......
66 68
			return false;
67 69
		}
68 70

  
69
		//Se comprueba si la vista activa contiene un Layout y 
71
		//Se comprueba si la vista activa contiene un Layout y
70 72
		//si es as? se devuelve true como visible o false si no contiene un Layout.
71 73
		if (f instanceof Layout) {
72 74
			return true;
......
80 82
	 * final.
81 83
	 */
82 84
	private void initFFrameText() {
83
		//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText, 
85
		//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText,
84 86
		//para guardar en hastext el texto y su FFrameText.
85 87
		for (int ft = 0; ft < fframes.length; ft++) {
86 88
			if (fframes[ft] instanceof FFrameText) {
......
101 103
	 * Recupera el texto que inicialmente ten?an todos FFrameText.
102 104
	 */
103 105
	private void endFFrameText() {
104
		//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText, 
106
		//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText,
105 107
		//para inicializarlo con su texto original almacenado en hashtext.
106 108
		for (int ft = 0; ft < fframes.length; ft++) {
107 109
			if (fframes[ft] instanceof FFrameText) {
......
120 122
	 * FFrameView.
121 123
	 *
122 124
	 * @param fframeview FFrameView a modificar.
125
	 * @throws ReadDriverException
123 126
	 *
124 127
	 * @throws DriverException
125 128
	 * @throws com.hardcode.gdbms.engine.data.DriverException
126 129
	 * @throws DriverIOException
127
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException 
130
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException
128 131
	 */
129
	private void initTemplates(FFrameView fframeview)
130
		throws DriverException, 
131
			DriverIOException, com.hardcode.gdbms.engine.data.driver.DriverException {
132
	private void initTemplates(FFrameView fframeview) throws ReadDriverException {
132 133
		//Inicio la opci?n de cancelar la impresi?n de todas las fichas a true.
133 134
		printAll[1] = true;
134 135

  
......
160 161
							//Actualizo la posici?n del puntero del recordSet.
161 162
							////dataSource.moveTo(k);
162 163
							//Obtengo el rect?ngulo del shape para despu?s ponerlo como extent del FFrameView
163
							Rectangle2D rec = ((SingleLayer) fframeview
164
											   .getMapContext().getLayers().getLayer(i)).getSource()
165
											   .getShape((int) k).getBounds2D();
164
							Rectangle2D rec;
165
							try {
166
								rec = ((SingleLayer) fframeview
167
												   .getMapContext().getLayers().getLayer(i)).getSource()
168
												   .getShape((int) k).getBounds2D();
169
							} catch (ExpansionFileReadException e) {
170
								throw new ReadDriverException(fframeview
171
										   .getMapContext().getLayers().getLayer(i).getName(),e);
172
							}
166 173

  
167 174
							//fframeview.setLinked(false);
168
							//Cambio el extent de la vista que contiene fframeview, 
175
							//Cambio el extent de la vista que contiene fframeview,
169 176
							//del que ten?a al extent del shape seleccionado.
170 177
							fframeview.setNewExtent(rec);
171 178

  
172 179
							//Cambio el tipo de escala de fframeview a Escala especificada por el usuario.
173 180
							fframeview.setTypeScale(FFrameView.MANUAL);
174 181

  
175
							//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText, 
182
							//Recorro todos los FFrames que contiene el Layout y compruebo que son una instancia de FFrameText,
176 183
							//para inicializarlo con el valor correspondiente.
177 184
							for (int ft = 0; ft < fframes.length; ft++) {
178 185
								if (fframes[ft] instanceof FFrameText) {
......
183 190
							}
184 191

  
185 192
							if (isFirst) {
186
								//Si es el primer registro seleccionado se abre el di?logo 
193
								//Si es el primer registro seleccionado se abre el di?logo
187 194
								//para preguntar si se quiere imprimir todas las fichas.
188 195
								askAll();
189 196
								isFirst = false;
......
191 198

  
192 199
							if (!printAll[1]) {
193 200
								//Si se cancela la impresi?n desde el di?logo askAll se termina la creaci?n de fichas.
194
								//Pongo isFirst a true para que la pr?xima vez que se llame 
201
								//Pongo isFirst a true para que la pr?xima vez que se llame
195 202
								//a este m?todo se pregunte si se quiere imprimir todas las fichas.
196 203
								isFirst = true;
197 204

  
......
236 243
	 * @param fframetext FFrameText a modificar.
237 244
	 * @param dataSource DataSource para extraer el valor.
238 245
	 * @param k indice del registro.
239
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException 
246
	 * @throws ReadDriverException
247
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException
240 248
	 *
241 249
	 * @throws com.hardcode.gdbms.engine.data.DriverException
242 250
	 */
243 251
	private void initFFrameText(FFrameText fframetext,
244
		SelectableDataSource dataSource, long k) throws com.hardcode.gdbms.engine.data.driver.DriverException
245
		 {
252
		SelectableDataSource dataSource, long k) throws ReadDriverException {
246 253
		//Recorro todos los campos.
247 254
		dataSource.start();
248 255
		for (int j = 0; j < dataSource.getFieldCount(); j++) {
249
			//Compruebo si el tag es igual al campo, y si es as?, 
256
			//Compruebo si el tag es igual al campo, y si es as?,
250 257
			//borro el texto que contiene y le a?ado el valor.
251 258
			if (dataSource.getFieldName(j).equals(fframetext.getTag())) {
252 259
				fframetext.getText().clear();
......
264 271
	public void askAll() {
265 272
		AskAll all = new AskAll(printAll);
266 273

  
267
		//A?ade el objeto all que extiende JPanel 
268
		//e implementa com.iver.mdiApp.ui.MDIManager.View como una 
274
		//A?ade el objeto all que extiende JPanel
275
		//e implementa com.iver.mdiApp.ui.MDIManager.View como una
269 276
		//ventana m?s de la aplicaci?n.
270 277
		PluginServices.getMDIManager().addWindow(all);
271 278
	}
......
277 284
	public void askOne() {
278 285
		AskOne one = new AskOne(layout);
279 286

  
280
		//A?ade el objeto one que extiende JPanel 
281
		//e implementa com.iver.mdiApp.ui.MDIManager.View como una 
287
		//A?ade el objeto one que extiende JPanel
288
		//e implementa com.iver.mdiApp.ui.MDIManager.View como una
282 289
		//ventana m?s de la aplicaci?n.
283 290
		PluginServices.getMDIManager().addWindow(one);
284 291
	}
......
299 306
		//Obtengo todos los FFrames que contiene el Layout.
300 307
		fframes = layout.getLayoutContext().getFFrames();
301 308

  
302
		//Recorro todos los FFrames comprobando si es una instacia de FFrameView 
309
		//Recorro todos los FFrames comprobando si es una instacia de FFrameView
303 310
		//para ejecutar initTemplates en el caso de que as? sea.
304 311
		for (int i = 0; i < fframes.length; i++) {
305 312
			if (fframes[i] instanceof FFrameView) {
306 313
				try {
307 314
					//Inicia la creaci?n de todas las platillas posibles a partir de fframeview.
308 315
					initTemplates((FFrameView) fframes[i]);
309
				} catch (DriverException e) {
316
				} catch (ReadDriverException e) {
310 317
					e.printStackTrace();
311
				} catch (DriverIOException e) {
312
					e.printStackTrace();
313
				} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
314
                    // TODO Auto-generated catch block
315
                    e.printStackTrace();
316
                }
318
				}
317 319
			}
318 320
		}
319 321
	}

Also available in: Unified diff