Revision 10666 branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/ProjectDocument.java

View differences:

ProjectDocument.java
45 45
import java.io.Serializable;
46 46
import java.text.DateFormat;
47 47
import java.util.Date;
48
import java.util.HashMap;
49
import java.util.Iterator;
48 50

  
49 51
import com.hardcode.driverManager.DriverLoadException;
50 52
import com.iver.andami.messages.NotificationManager;
......
69 71
 * @author Fernando Gonz?lez Cort?s
70 72
 */
71 73
public abstract class ProjectDocument implements Serializable {
74
	public static HashMap NUMS = new HashMap();
72 75
	protected PropertyChangeSupport change;
73 76
	protected Project project;
74 77
	protected int index;
......
271 274
					e);
272 275
			}
273 276
			ProjectDocument pe=pde.create(p);
274
			pe.setProjectDocumentFactory(pde);		
277
			pe.setProjectDocumentFactory(pde);
275 278
			return pe;
276 279
		}catch (Exception e) {
277 280
			throw new OpenException(e,pde.getNameType());
......
291 294
	 */
292 295
	public void setXMLEntity(XMLEntity xml)
293 296
		throws XMLException, DriverException, DriverIOException, OpenException{
294
		
297

  
295 298
		this.setComment(xml.getStringProperty("comment"));
296 299
		this.setCreationDate(xml.getStringProperty("creationDate"));
297 300
		this.setName(xml.getStringProperty("name"));
298 301
		this.setOwner(xml.getStringProperty("owner"));
299
		
302

  
300 303
	}
301 304

  
302 305
	/**
......
311 314
	 */
312 315
	public void setXMLEntity03(XMLEntity xml)
313 316
		throws XMLException, DriverException, DriverIOException{
314
			
317

  
315 318
			this.setComment(xml.getStringProperty("comment"));
316 319
			this.setCreationDate(xml.getStringProperty("creationDate"));
317 320
			this.setName(xml.getStringProperty("name"));
318 321
			this.setOwner(xml.getStringProperty("owner"));
319
			
322

  
320 323
		}
321 324

  
322 325
	/**
......
380 383
	public ProjectDocumentFactory getProjectDocumentFactory() {
381 384
		return projectDocumentFactory;
382 385
	}
383
	
386

  
384 387
	public abstract void exportToXML(XMLEntity root, Project project)  throws SaveException ;
385
	
388

  
386 389
	public abstract void importFromXML(XMLEntity root, XMLEntity typeRoot,int elementIndex ,Project project, boolean removeDocumentsFromRoot) throws XMLException, DriverException, OpenException;
387
		
388
	
390

  
391

  
389 392
	public void importFromXML(XMLEntity root, XMLEntity typeRoot,int elementIndex ,Project project) throws XMLException, DriverException, OpenException{
390 393
		importFromXML(root,typeRoot, elementIndex,project,false);
391 394
	}
392
	
395

  
393 396
	/**
394 397
	 * Get the layout properties (size, position, state of the components)
395 398
	 * of the window associated with this ProjectDocument.
396 399
	 * This is used to re-open the window with the same properties it had
397 400
	 * when it was closed.
398
	 * 
401
	 *
399 402
	 * @return A WindowData object storing the properties of the window.
400 403
	 */
401 404
	public WindowData getWindowData() {
402 405
		return windowData;
403 406
	}
404
	
407

  
405 408
	/**
406 409
	 * Store the layout properties (size, position, state of the components)
407 410
	 * of the window associated with this ProjectDocument.
......
411 414
	public void storeWindowData(WindowData data) {
412 415
		windowData = data;
413 416
	}
417
	public static void initializeNUMS() {
418
		NUMS.clear();
419
		ExtensionPoints extensionPoints =
420
			ExtensionPointsSingleton.getInstance();
421
		ExtensionPoint extensionPoint =(ExtensionPoint)extensionPoints.get("Documents");
422
		Iterator iterator = extensionPoint.keySet().iterator();
423
		while (iterator.hasNext()) {
424
			try {
425
				ProjectDocumentFactory documentFactory = (ProjectDocumentFactory)extensionPoint.create((String)iterator.next());
426
				NUMS.put(documentFactory.getRegisterName(),new Integer(0));
427
			} catch (InstantiationException e) {
428
				e.printStackTrace();
429
			} catch (IllegalAccessException e) {
430
				e.printStackTrace();
431
			} catch (ClassCastException e) {
432
				e.printStackTrace();
433
			}
434
		}
435

  
436

  
437
	}
414 438
}

Also available in: Unified diff