Revision 9237 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/Project.java

View differences:

Project.java
112 112

  
113 113
/**
114 114
 * Clase que representa un proyecto de openSIG
115
 * 
115
 *
116 116
 * @author Fernando Gonz?lez Cort?s
117 117
 */
118 118
public class Project implements Serializable, PropertyChangeListener {
......
206 206

  
207 207
	/**
208 208
	 * Obtiene la fecha de creaci?n del proyecto
209
	 * 
209
	 *
210 210
	 * @return
211 211
	 */
212 212
	public String getCreationDate() {
......
215 215

  
216 216
	/**
217 217
	 * Obtiene el nombre del proyecto
218
	 * 
218
	 *
219 219
	 * @return
220 220
	 */
221 221
	public String getName() {
......
237 237
	 * por que al recuperar la fecha del XML hay que asignarla al objeto
238 238
	 * proyecto de alguna manera. La fecha se asigna en el constructor y no se
239 239
	 * deber?a de modificar nunca
240
	 * 
240
	 *
241 241
	 * @param string
242 242
	 */
243 243
	public void setCreationDate(String string) {
......
248 248

  
249 249
	/**
250 250
	 * Establece el nombre del proyecto
251
	 * 
251
	 *
252 252
	 * @param string
253 253
	 */
254 254
	public void setName(String string) {
......
270 270

  
271 271
	/**
272 272
	 * Devuelve a partir de la capa la tabla asociada.
273
	 * 
273
	 *
274 274
	 * @param co
275 275
	 *            Capa.
276
	 * 
276
	 *
277 277
	 * @return ProjectTable de la tabla asociada.
278 278
	 */
279 279
	public ProjectTable getTable(AlphanumericData co) {
......
293 293

  
294 294
	/**
295 295
	 * Devuelve a partir del nombre la tabla asociada.
296
	 * 
296
	 *
297 297
	 * @param name
298 298
	 *            Nombre.
299 299
	 * @deprecated utilizar getProjectDocumentByName(...);
......
317 317
	/**
318 318
	 * Devuelve true si el proyecto (o alguna tabla, vista o mapa que contiene)
319 319
	 * fue modificado
320
	 * 
320
	 *
321 321
	 * @return
322 322
	 */
323 323
	public boolean isModified() {
324
		if (this.getDocumentsByType(ProjectMapFactory.registerName).size() == 0
324
		if ((this.getDocumentsByType(ProjectMapFactory.registerName).size() == 0
325 325
				&& this.getDocumentsByType(ProjectViewFactory.registerName)
326 326
						.size() == 0
327 327
				&& this.getDocumentsByType(ProjectTableFactory.registerName)
328
						.size() == 0) {
328
						.size() == 0) || !modified) {
329 329
			return false;
330 330
		}
331 331
		return true;
......
336 336

  
337 337
	/**
338 338
	 * Obtiene los comentarios
339
	 * 
339
	 *
340 340
	 * @return
341 341
	 */
342 342
	public String getComments() {
......
345 345

  
346 346
	/**
347 347
	 * Obtiene la fecha de la ?ltima modificaci?n
348
	 * 
348
	 *
349 349
	 * @return
350 350
	 */
351 351
	public String getModificationDate() {
......
354 354

  
355 355
	/**
356 356
	 * Obtiene el propietario del proyecto
357
	 * 
357
	 *
358 358
	 * @return
359 359
	 */
360 360
	public String getOwner() {
......
363 363

  
364 364
	/**
365 365
	 * Establece una cadena como comentarios al proyecto
366
	 * 
366
	 *
367 367
	 * @param string
368 368
	 */
369 369
	public void setComments(String string) {
......
374 374

  
375 375
	/**
376 376
	 * Establece la fecha de la ?ltima modificaci?n
377
	 * 
377
	 *
378 378
	 * @param string
379 379
	 */
380 380
	public void setModificationDate(String string) {
......
385 385

  
386 386
	/**
387 387
	 * Establece el propietario del proyecto
388
	 * 
388
	 *
389 389
	 * @param string
390 390
	 */
391 391
	public void setOwner(String string) {
......
396 396

  
397 397
	/**
398 398
	 * Establece el flag de modificado del proyecto
399
	 * 
399
	 *
400 400
	 * @param b
401 401
	 */
402 402
	public void setModified(boolean b) {
......
405 405

  
406 406
	/**
407 407
	 * Obtiene el color de selecci?n que se usar? en el proyecto
408
	 * 
408
	 *
409 409
	 * @return
410 410
	 */
411 411
	public Color getSelectionColor() {
......
417 417

  
418 418
	/**
419 419
	 * Establece el color de selecci?n
420
	 * 
420
	 *
421 421
	 * @param color
422 422
	 */
423 423
	public void setSelectionColor(Color color) {
......
429 429

  
430 430
	/**
431 431
	 * Obtiene el color como un entero para su serializaci?n a XML
432
	 * 
432
	 *
433 433
	 * @return
434 434
	 */
435 435
	public String getColor() {
......
439 439
	/**
440 440
	 * M?todo invocado al recuperar de XML para establecer el color de seleccion
441 441
	 * del proyecto
442
	 * 
442
	 *
443 443
	 * @param color
444 444
	 *            Entero que representa un color
445 445
	 */
......
450 450

  
451 451
	/*
452 452
	 * (non-Javadoc)
453
	 * 
453
	 *
454 454
	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
455 455
	 */
456 456
	public void propertyChange(PropertyChangeEvent evt) {
......
460 460

  
461 461
	/**
462 462
	 * DOCUMENT ME!
463
	 * 
463
	 *
464 464
	 * @param arg1
465 465
	 */
466 466
	public void addExtent(ProjectExtent arg1) {
......
471 471

  
472 472
	/**
473 473
	 * DOCUMENT ME!
474
	 * 
474
	 *
475 475
	 * @param arg0
476
	 * 
476
	 *
477 477
	 * @return
478 478
	 */
479 479
	public Object removeExtent(int arg0) {
......
485 485

  
486 486
	/**
487 487
	 * DOCUMENT ME!
488
	 * 
488
	 *
489 489
	 * @return DOCUMENT ME!
490 490
	 */
491 491
	public ProjectExtent[] getExtents() {
......
494 494

  
495 495
	/**
496 496
	 * Metodo que a?ade una nueva camera a la lista de cameras
497
	 * 
497
	 *
498 498
	 * @param arg1
499 499
	 *            camera introducida
500 500
	 */
......
506 506

  
507 507
	/**
508 508
	 * Metodo que borra de la lisat un elemento seleccionado
509
	 * 
509
	 *
510 510
	 * @param arg0
511 511
	 *            indice del elemento que se va a borrar
512
	 * 
512
	 *
513 513
	 * @return resultado de la operacion de borrado
514 514
	 */
515 515
	public Object removeCamera(int arg0) {
......
521 521

  
522 522
	/**
523 523
	 * Metodo que devuelve la lista de cameras
524
	 * 
524
	 *
525 525
	 * @return lista de objetos de tipo camera
526 526
	 */
527 527
	public Object[] getCameras() {
......
530 530

  
531 531
	/**
532 532
	 * DOCUMENT ME!
533
	 * 
533
	 *
534 534
	 * @param arg0
535 535
	 */
536 536
	public synchronized void addPropertyChangeListener(
......
540 540

  
541 541
	/**
542 542
	 * DOCUMENT ME!
543
	 * 
543
	 *
544 544
	 * @deprecated utilizar getDocument(String s);
545 545
	 * @return
546 546
	 */
......
550 550

  
551 551
	/**
552 552
	 * DOCUMENT ME!
553
	 * 
553
	 *
554 554
	 * @deprecated utilizar getDocument(String s);
555 555
	 * @return
556 556
	 */
......
560 560

  
561 561
	/**
562 562
	 * DOCUMENT ME!
563
	 * 
563
	 *
564 564
	 * @deprecated utilizar getDocument(String s);
565 565
	 * @return
566 566
	 */
......
570 570

  
571 571
	/**
572 572
	 * A?ade un mapa al proyecto
573
	 * 
573
	 *
574 574
	 * @deprecated utilizar addDocument(ProjectDocument pD);
575 575
	 * @param m
576 576
	 */
......
580 580

  
581 581
	/**
582 582
	 * Elimina un mapa del proyecto
583
	 * 
583
	 *
584 584
	 * @deprecated utilizar delDocument(ProjectDocument pD);
585 585
	 * @param i
586 586
	 *            indice del mapa
......
592 592

  
593 593
	/**
594 594
	 * A?ade una tabla al proyecto
595
	 * 
595
	 *
596 596
	 * @deprecated utilizar addDocument(ProjectDocument pD);
597 597
	 * @param t
598 598
	 */
......
602 602

  
603 603
	/**
604 604
	 * Elimina una tabla del proyecto
605
	 * 
605
	 *
606 606
	 * @deprecated utilizar delDocument(ProjectDocument pD);
607 607
	 * @param i
608 608
	 *            indice de la tabla
......
614 614

  
615 615
	/**
616 616
	 * A?ade una vista al proyecto
617
	 * 
617
	 *
618 618
	 * @deprecated utilizar addDocument(ProjectDocument pD);
619 619
	 * @param v
620 620
	 */
......
624 624

  
625 625
	/**
626 626
	 * Elimina una tabla del proyecto
627
	 * 
627
	 *
628 628
	 * @deprecated utilizar delDocument(ProjectDocument pD);
629 629
	 * @param i
630 630
	 *            indice del proyecto
......
636 636

  
637 637
	/**
638 638
	 * DOCUMENT ME!
639
	 * 
639
	 *
640 640
	 * @return DOCUMENT ME!
641
	 * 
641
	 *
642 642
	 * @throws DriverException
643 643
	 * @throws XMLException
644 644
	 */
......
695 695
		 * XMLEntity xmlchild=((ProjectView) views.get(i)).getXMLEntity();
696 696
		 * xml.addChild(xmlchild); numViews++; } catch (SaveException e) {
697 697
		 * e.showError(); } } xml.putProperty("numViews", numViews);
698
		 * 
698
		 *
699 699
		 * int numMaps=0; for (int i = 0; i < maps.size(); i++) { try {
700 700
		 * XMLEntity xmlchild=((ProjectMap) maps.get(i)).getXMLEntity();
701 701
		 * xml.addChild(xmlchild); numMaps++; } catch (SaveException e) {
......
712 712
		 * int numTables=0; for (int i = 0; i < tables.size(); i++) { try {
713 713
		 * XMLEntity xmlchild=((ProjectTable) tables.get(i)).getXMLEntity();
714 714
		 * xml.addChild(xmlchild); numTables++; } catch (SaveException e) {
715
		 * 
715
		 *
716 716
		 * e.showError(); } } xml.putProperty("numTables", numTables);
717 717
		 */
718 718
		xml.putProperty("projection", defaultProjection.getAbrev());
......
779 779
								((ProjectDocument) viewWindow.getWindowModel())
780 780
										.getName());
781 781
						windowProperties.putProperty("zPosition", winIndex);
782
						
782

  
783 783
						// TODO this will be generalized to all ProjectDocuments as soon as possible
784 784
//						if (viewWindow instanceof BaseView) {
785 785
//							BaseView win = (BaseView) viewWindow;
......
789 789
							IDocumentWindow win = (IDocumentWindow) viewWindow;
790 790
							windowProperties.addChild(win.getWindowData().getXMLEntity());
791 791
						}
792
						
792

  
793 793
						propertyList.addChild(windowProperties);
794 794
					}
795 795
				}
......
938 938
	 * Restores the size, position and order of the windows, according to
939 939
	 * variable initialWindowProperties. If this variable is null, the method
940 940
	 * just opens the project manager window.
941
	 * 
941
	 *
942 942
	 */
943 943
	public void restoreWindowProperties() {
944 944
		boolean projectWindowRestored = false;
......
1022 1022

  
1023 1023
	/**
1024 1024
	 * DOCUMENT ME!
1025
	 * 
1025
	 *
1026 1026
	 * @param xml
1027 1027
	 *            DOCUMENT ME!
1028
	 * 
1028
	 *
1029 1029
	 * @return DOCUMENT ME!
1030 1030
	 * @throws XMLException
1031 1031
	 * @throws DriverException
......
1090 1090

  
1091 1091
	/**
1092 1092
	 * DOCUMENT ME!
1093
	 * 
1093
	 *
1094 1094
	 * @param xml
1095 1095
	 *            DOCUMENT ME!
1096
	 * 
1096
	 *
1097 1097
	 * @return DOCUMENT ME!
1098
	 * 
1098
	 *
1099 1099
	 * @throws XMLException
1100 1100
	 * @throws DriverException
1101 1101
	 * @throws DriverIOException
......
1273 1273

  
1274 1274
	/**
1275 1275
	 * Obtiene la vista que contiene a la capa que se pasa como par?metro
1276
	 * 
1276
	 *
1277 1277
	 * @param layer
1278 1278
	 *            Capa cuya vista se quiere obtener
1279
	 * 
1279
	 *
1280 1280
	 * @return
1281
	 * 
1281
	 *
1282 1282
	 * @throws RuntimeException
1283 1283
	 *             Si la capa que se pasa como par?metro no se encuentra en
1284 1284
	 *             ninguna vista
......
1311 1311
	 * Devuelve la vista cuyo nombre coincide (sensible a mayusculas) con el que
1312 1312
	 * se pasa como par?metro. Devuelve null si no hay ninguna vista con ese
1313 1313
	 * nombre
1314
	 * 
1314
	 *
1315 1315
	 * @param viewName
1316 1316
	 *            Nombre de la vista que se quiere obtener
1317
	 * 
1317
	 *
1318 1318
	 * @return DOCUMENT ME!
1319 1319
	 */
1320 1320
	/*
1321 1321
	 * public ProjectView getViewByName(String viewName) { ArrayList
1322 1322
	 * views=getDocuments(PluginServices.getText(this,"Vista")); Object o =
1323 1323
	 * getProjectDocumentByName(viewName, PluginServices.getText(this,"Vista"));
1324
	 * 
1324
	 *
1325 1325
	 * if (o == null) { return null; }
1326
	 * 
1326
	 *
1327 1327
	 * return (ProjectView) o; }
1328 1328
	 */
1329 1329
	/**
1330 1330
	 * DOCUMENT ME!
1331
	 * 
1331
	 *
1332 1332
	 * @return DOCUMENT ME!
1333 1333
	 */
1334 1334
	public IProjection getProjection() {
......
1339 1339

  
1340 1340
	/**
1341 1341
	 * DOCUMENT ME!
1342
	 * 
1342
	 *
1343 1343
	 * @param defaultProjection
1344 1344
	 *            DOCUMENT ME!
1345 1345
	 */
......
1349 1349

  
1350 1350
	/**
1351 1351
	 * Sets the projection used when no projection is defined
1352
	 * 
1352
	 *
1353 1353
	 * @param defaultProjection
1354 1354
	 *            DOCUMENT ME!
1355 1355
	 */
......
1365 1365
	 * Obtiene un documento a partir de su nombre y el nombre de registro en el
1366 1366
	 * pointExtension, este ?ltimo se puede obtener del
1367 1367
	 * Project****Factory.registerName.
1368
	 * 
1368
	 *
1369 1369
	 * @param name
1370 1370
	 *            Nombre del documento
1371 1371
	 * @param type
1372 1372
	 *            nombre de registro en el extensionPoint
1373
	 * 
1373
	 *
1374 1374
	 * @return Documento
1375 1375
	 */
1376 1376
	public ProjectDocument getProjectDocumentByName(String name, String type) {
......
1388 1388

  
1389 1389
	/**
1390 1390
	 * DOCUMENT ME!
1391
	 * 
1391
	 *
1392 1392
	 * @param name
1393
	 * 
1393
	 *
1394 1394
	 * @return
1395 1395
	 */
1396 1396
	/*
1397 1397
	 * public ProjectTable getTableByName(String name) { ArrayList
1398 1398
	 * tables=getDocuments(PluginServices.getText(this,"Tabla")); Object o =
1399 1399
	 * getProjectElementByName(name, tables);
1400
	 * 
1400
	 *
1401 1401
	 * if (o == null) { return null; }
1402
	 * 
1402
	 *
1403 1403
	 * return (ProjectTable) o; }
1404 1404
	 */
1405 1405
	/**
1406 1406
	 * DOCUMENT ME!
1407
	 * 
1407
	 *
1408 1408
	 * @param name
1409
	 * 
1409
	 *
1410 1410
	 * @return
1411 1411
	 */
1412 1412
	/*
1413 1413
	 * public ProjectMap getLayoutByName(String name) { Object o =
1414 1414
	 * getProjectElementByName(name, maps);
1415
	 * 
1415
	 *
1416 1416
	 * if (o == null) { return null; }
1417
	 * 
1417
	 *
1418 1418
	 * return (ProjectMap) o; }
1419 1419
	 */
1420 1420
	public SelectableDataSource getDataSourceByLayer(FLayer layer)
......
1455 1455
	 * que est?n registrados, y borramos aquellos que no est?n siendo usados, es
1456 1456
	 * decir, aquellos que no est?n en nuestra lista (un Hash con clave el
1457 1457
	 * nombre del GDBMS)
1458
	 * 
1458
	 *
1459 1459
	 */
1460 1460
	private void cleanBadReferences() {
1461 1461
		ArrayList tables = getDocumentsByType(ProjectTableFactory.registerName);
......
1539 1539

  
1540 1540
	/**
1541 1541
	 * DOCUMENT ME!
1542
	 * 
1542
	 *
1543 1543
	 * @return DOCUMENT ME!
1544 1544
	 * @throws SaveException
1545 1545
	 * @throws XMLException
......
1637 1637
	/**
1638 1638
	 * Devuelve un arrayList con todos los documentos del tipo especificado como
1639 1639
	 * par?metro.
1640
	 * 
1640
	 *
1641 1641
	 * @param registerName
1642 1642
	 *            nombre de registro en el extensionPoint
1643
	 * 
1643
	 *
1644 1644
	 * @return Documentos del tipo especificado
1645 1645
	 */
1646 1646
	public ArrayList getDocumentsByType(String registerName) {
......
1661 1661

  
1662 1662
	/**
1663 1663
	 * Devuelve un arrayList con todos los documentos.
1664
	 * 
1664
	 *
1665 1665
	 * @return Documentos
1666 1666
	 */
1667 1667
	public ArrayList getDocuments() {
......
1676 1676

  
1677 1677
	/**
1678 1678
	 * Inserta un documento.
1679
	 * 
1679
	 *
1680 1680
	 * @param doc
1681 1681
	 *            Documento
1682 1682
	 */
......
1692 1692

  
1693 1693
	/**
1694 1694
	 * Borra un documento.
1695
	 * 
1695
	 *
1696 1696
	 * @param doc
1697 1697
	 *            Documento
1698 1698
	 */
......
1706 1706
	/**
1707 1707
	 * Sets the default selection color that will be used in subsequent
1708 1708
	 * projects.
1709
	 * 
1709
	 *
1710 1710
	 * @param color
1711 1711
	 */
1712 1712
	public static void setDefaultSelectionColor(Color color) {
......
1716 1716
	/**
1717 1717
	 * Returns the current default selection color defined which is the color
1718 1718
	 * defined when the user does not define any other one
1719
	 * 
1719
	 *
1720 1720
	 * @return java.awt.Color
1721 1721
	 */
1722 1722
	public static Color getDefaultSelectionColor() {
......
1732 1732
	/**
1733 1733
	 * Returns the user's default map units. This is the cartography data
1734 1734
	 * distance units.
1735
	 * 
1735
	 *
1736 1736
	 * @return int (index of the <b>Attributes.NAMES array</b>)
1737 1737
	 */
1738 1738
	public static int getDefaultMapUnits() {
......
1762 1762
	/**
1763 1763
	 * Returns the user's default view units for measuring distances. This is
1764 1764
	 * the units that the user will see in the status bar of the view.
1765
	 * 
1765
	 *
1766 1766
	 * @return int (index of the <b>Attributes.NAMES array</b>)
1767 1767
	 */
1768 1768
	public static int getDefaultDistanceUnits() {
......
1791 1791

  
1792 1792
	/**
1793 1793
	 * Sets the default map unit (the units used by the data).
1794
	 * 
1794
	 *
1795 1795
	 * @param mapUnits
1796 1796
	 */
1797 1797
	public static void setDefaultMapUnits(int mapUnits) {
......
1800 1800

  
1801 1801
	/**
1802 1802
	 * Sets the default distance units (the units shown in the status bar)
1803
	 * 
1803
	 *
1804 1804
	 * @param distanceUnits
1805 1805
	 */
1806 1806
	public static void setDefaultDistanceUnits(int distanceUnits) {
......
1835 1835
		throw new Exception("Not Implemented");
1836 1836
		/*
1837 1837
		 * // FIXME: ?? Exceptions XMLEntity xmlEntity = new XMLEntity();
1838
		 * 
1838
		 *
1839 1839
		 * try { xmlEntity.parse(xml); } catch (Exception e) { throw new
1840 1840
		 * Exception(e); }
1841
		 * 
1841
		 *
1842 1842
		 * if (!checkExportXMLRootNode(xmlEntity)) { throw new Exception("Check
1843 1843
		 * Error"); //FIXME: traducir }
1844
		 * 
1844
		 *
1845 1845
		 * int i;
1846
		 * 
1846
		 *
1847 1847
		 * XMLEntity xmlDocumentRoot; ProjectDocument document = null;
1848 1848
		 * ProjectDocumentFactory documentFactory = null; for (i=0;i<xmlEntity.getChildrenCount();i++) {
1849 1849
		 * xmlDocumentRoot = xmlEntity.getChild(i); if

Also available in: Unified diff