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

View differences:

Project.java
101 101
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory;
102 102
import com.iver.cit.gvsig.project.documents.view.ProjectView;
103 103
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory;
104
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
105 104
import com.iver.utiles.IPersistance;
106 105
import com.iver.utiles.PostProcessSupport;
107 106
import com.iver.utiles.StringUtilities;
......
134 133

  
135 134
	private PropertyChangeSupport change;
136 135

  
137
	boolean modified = false;
136
	private boolean modified = false;
138 137

  
139 138
	private String name;
140 139

  
......
242 241
	 */
243 242
	public void setCreationDate(String string) {
244 243
		creationDate = string;
245
		modified = true;
244
		//modified = true;
246 245
		change.firePropertyChange("", null, null);
247 246
	}
248 247

  
......
253 252
	 */
254 253
	public void setName(String string) {
255 254
		name = string;
256
		modified = true;
255
		//modified = true;
257 256
		change.firePropertyChange("", null, null);
258 257
	}
259 258

  
......
314 313
		return null;
315 314
	}
316 315

  
316
	private boolean isModifiedDocuments() {
317
		ProjectDocument[] documents=(ProjectDocument[])getDocuments().toArray(new ProjectDocument[0]);
318
		for (int i=0;i<documents.length;i++) {
319
			if (documents[i].isModified()) {
320
				return true;
321
			}
322
		}
323
		return false;
324
	}
317 325
	/**
318 326
	 * Devuelve true si el proyecto (o alguna tabla, vista o mapa que contiene)
319 327
	 * fue modificado
......
321 329
	 * @return
322 330
	 */
323 331
	public boolean isModified() {
324
		if ((this.getDocumentsByType(ProjectMapFactory.registerName).size() == 0
325
				&& this.getDocumentsByType(ProjectViewFactory.registerName)
326
						.size() == 0
327
				&& this.getDocumentsByType(ProjectTableFactory.registerName)
328
						.size() == 0) || !modified) {
332
		if ((this.getDocuments().size() == 0) || !modified || !isModifiedDocuments()) {
329 333
			return false;
330 334
		}
331 335
		return true;
......
368 372
	 */
369 373
	public void setComments(String string) {
370 374
		comments = string;
371
		modified = true;
375
		//modified = true;
372 376
		change.firePropertyChange("", null, null);
373 377
	}
374 378

  
......
379 383
	 */
380 384
	public void setModificationDate(String string) {
381 385
		modificationDate = string;
382
		modified = true;
386
		//modified = true;
383 387
		change.firePropertyChange("", null, null);
384 388
	}
385 389

  
......
390 394
	 */
391 395
	public void setOwner(String string) {
392 396
		owner = string;
393
		modified = true;
397
		//modified = true;
394 398
		change.firePropertyChange("", null, null);
395 399
	}
396 400

  
......
401 405
	 */
402 406
	public void setModified(boolean b) {
403 407
		modified = b;
408
		if (modified==false) {
409
			ProjectDocument[] documents=(ProjectDocument[])getDocuments().toArray(new ProjectDocument[0]);
410
			for (int i=0;i<documents.length;i++) {
411
				documents[i].setModified(false);
412
			}
413
		}
404 414
	}
405 415

  
406 416
	/**
......
423 433
	public void setSelectionColor(Color color) {
424 434
		selectionColor = color;
425 435
		FSymbol.setSelectionColor(color);
426
		modified = true;
436
		//modified = true;
427 437
		change.firePropertyChange("selectionColor", null, color);
428 438
	}
429 439

  
......
444 454
	 *            Entero que representa un color
445 455
	 */
446 456
	public void setColor(String color) {
447
		modified = true;
457
		//modified = true;
448 458
		selectionColor = StringUtilities.string2Color(color);
449 459
	}
450 460

  
......
454 464
	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
455 465
	 */
456 466
	public void propertyChange(PropertyChangeEvent evt) {
457
		this.modified = true;
467
		//this.modified = true;
458 468
		change.firePropertyChange(evt);
459 469
	}
460 470

  
......
465 475
	 */
466 476
	public void addExtent(ProjectExtent arg1) {
467 477
		extents.add(arg1);
468
		modified = true;
478
		//modified = true;
469 479
		change.firePropertyChange("addExtent", null, null);
470 480
	}
471 481

  
......
477 487
	 * @return
478 488
	 */
479 489
	public Object removeExtent(int arg0) {
480
		modified = true;
490
		//modified = true;
481 491
		change.firePropertyChange("delExtent", null, null);
482 492

  
483 493
		return extents.remove(arg0);
......
500 510
	 */
501 511
	public void addCamera(Object arg1) {
502 512
		this.cameras.add(arg1);
503
		modified = true;
513
		//modified = true;
504 514
		change.firePropertyChange("addCamera", null, null);
505 515
	}
506 516

  
......
513 523
	 * @return resultado de la operacion de borrado
514 524
	 */
515 525
	public Object removeCamera(int arg0) {
516
		modified = true;
526
		//modified = true;
517 527
		change.firePropertyChange("delCamera", null, null);
518 528

  
519 529
		return this.cameras.remove(arg0);
......
702 712
		 * e.showError(); } } xml.putProperty("numMaps", numMaps);
703 713
		 */
704 714
		xml.putProperty("modificationDate", modificationDate);
705
		xml.putProperty("modified", modified);
715
		//xml.putProperty("modified", modified);
706 716
		xml.putProperty("name", name);
707 717
		xml.putProperty("owner", owner);
708 718
		// xml.putProperty("path", path);
......
1073 1083
			}
1074 1084

  
1075 1085
			p.modificationDate = xml.getStringProperty("modificationDate");
1076
			p.modified = xml.getBooleanProperty("modified");
1086
			//p.modified = xml.getBooleanProperty("modified");
1077 1087
			p.name = xml.getStringProperty("name");
1078 1088
			p.owner = xml.getStringProperty("owner");
1079 1089
			p.selectionColor = StringUtilities.string2Color(xml
......
1187 1197
			childNumber += numDocuments;
1188 1198

  
1189 1199
			p.modificationDate = xml.getStringProperty("modificationDate");
1190
			p.modified = xml.getBooleanProperty("modified");
1200
			//p.modified = xml.getBooleanProperty("modified");
1191 1201
			p.name = xml.getStringProperty("name");
1192 1202
			p.owner = xml.getStringProperty("owner");
1193 1203
			p.selectionColor = StringUtilities.string2Color(xml
......
1683 1693
	public void addDocument(ProjectDocument doc) {
1684 1694
		documents.add(doc);
1685 1695
		doc.addPropertyChangeListener(this);
1686
		modified = true;
1696
		//modified = true;
1687 1697
		change.firePropertyChange("", "", null);
1688 1698
		doc.setProject(this, 0);
1689 1699
		doc.afterAdd();
......
1698 1708
	 */
1699 1709
	public void delDocument(ProjectDocument doc) {
1700 1710
		documents.remove(doc);
1701
		modified = true;
1711
		//modified = true;
1702 1712
		change.firePropertyChange("", null, null);
1703 1713
		doc.afterRemove();
1704 1714
	}

Also available in: Unified diff