Revision 7348

View differences:

branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/ProjectExtension.java
66 66
import com.iver.andami.messages.Messages;
67 67
import com.iver.andami.messages.NotificationManager;
68 68
import com.iver.andami.plugins.Extension;
69
import com.iver.andami.ui.mdiManager.WindowInfo;
69 70
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
70 71
import com.iver.cit.gvsig.gui.layout.Layout;
71 72
import com.iver.cit.gvsig.gui.project.OpenException;
......
158 159
	 * Muestra la ventana con el gestor de proyectos.
159 160
	 */
160 161
	public void showProjectWindow() {
161
		PluginServices.getMDIManager().addWindow(projectFrame);
162
		if (Project.getSeedProjectWindow()!=null) {
163
			PluginServices.getMDIManager().changeWindowInfo(projectFrame, Project.getSeedProjectWindow());
162
		WindowInfo seedWindowInfo = Project.getSeedProjectWindow();
163
		if (seedWindowInfo!=null) {
164
			Project.setSeedProjectWindow(null);
165
			if (!seedWindowInfo.isClosed()) {
166
				PluginServices.getMDIManager().addWindow(projectFrame);
167
				PluginServices.getMDIManager().changeWindowInfo(projectFrame, seedWindowInfo);
168
			}
164 169
		}
170
		else
171
			PluginServices.getMDIManager().addWindow(projectFrame);
165 172
	}
173
	
174
	public XMLEntity getProjectWindowXMLEntity() {
175
		WindowInfo wi = PluginServices.getMDIManager().getWindowInfo(projectFrame);
176
		if (wi!=null) {
177
			if (wi.checkPersistence())
178
				return wi.getXMLEntity();
179
			else // if the window was marked as not persistent, return null (we don't want to save it)
180
				return null;
181
		}
182
		return null;
183
	}
166 184

  
167 185
	/**
168 186
	 * Guarda el proyecto actual en disco.
branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/project/Project.java
108 108
	private String owner;
109 109
	private String comments;
110 110
	private Color selectionColor = new Color(255, 255, 0);
111
	/**
112
	 * Stores the list of ProjectViews in the project
113
	 */
111 114
	private ArrayList views = new ArrayList();
112 115
	private ArrayList tables = new ArrayList();
113 116
	private ArrayList maps = new ArrayList();
......
509 512
	}
510 513

  
511 514
	/**
512
	 * DOCUMENT ME!
515
	 * Get the list of maps in the project.
513 516
	 *
514 517
	 * @return
515 518
	 */
......
518 521
	}
519 522

  
520 523
	/**
521
	 * DOCUMENT ME!
524
	 * Get the list of tables in the project.
522 525
	 *
523 526
	 * @return
524 527
	 */
......
527 530
	}
528 531

  
529 532
	/**
530
	 * DOCUMENT ME!
533
	 * Get the list of ProjectViews in the project.
531 534
	 *
532 535
	 * @return
533 536
	 */
......
636 639
		xml.putProperty("projection", defaultProjection.getAbrev());
637 640

  
638 641
		// save the properties of the Project Manager window
639
		IWindow []andamiViews = PluginServices.getMDIManager().getAllWindows();
640
		for (int i=0; i<andamiViews.length; i++) {
641
			if (andamiViews[i] instanceof ProjectWindow) {
642
				ProjectWindow pw = (ProjectWindow) andamiViews[i];
643
				try {
644
					XMLEntity xmlchild = null;
645
					xmlchild = getWindowInfoXMLEntity(pw);
646
					if (xmlchild!=null) {
647
						xml.addChild(xmlchild);
648
					}
649
				}
650
				catch (SaveException e){
651
					e.showError();
652
				}
642
		ProjectExtension pe =(ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
643
		if (pe!=null) {
644
			XMLEntity xmlchild = pe.getProjectWindowXMLEntity();
645
			if (xmlchild!=null) {
646
				xmlchild.putProperty("className", ProjectWindow.class.getName());
647
				xml.addChild(xmlchild);
653 648
			}
654 649
		}
655

  
650
		
656 651
		return xml;
657 652
	}
653
	
654
	/*private void saveWindowProperties(XMLEntity xml) {
655
		IWindow[] windowList = PluginServices.getMDIManager().getAllWindows();
656
		
657
		xml.putProperty("numWindows", windowList.length);
658
		XMLEntity xmlchild;
659
		for (int i=windowList.length-1; i>=0; i--) {
660
			try {
661
				xmlchild = getWindowInfoXMLEntity(windowList[i]);
662
				if (xmlchild!=null) {
663
					xml.addChild(xmlchild);
664
				}
665
			}
666
			catch (SaveException e){
667
				e.showError();
668
			}
669
		}
670
	}*/
671
	
658 672
	/**
659 673
	 * DOCUMENT ME!
660 674
	 *
......
811 825

  
812 826
		for (int i = childNumber; i < (numMaps + childNumber); i++) {
813 827
			try{
814
				// p.maps.add(ProjectMap.createFromXML(xml.getChild(i), p));
815 828
				ProjectMap map = (ProjectMap) ProjectMap.createFromXML(xml.getChild(i), p);
816 829
				p.maps.add(map);
817 830
				if (map.getSeedViewInfo()!=null) { // open the view, if it was open, and restore its dimensions
......
849 862
		}
850 863

  
851 864

  
852
		/* The project window defines its own size!!
853 865
		childNumber += numTables;
854
		if (childNumber < xml.getNumChild()) { // restore the position of the project manager window
866
		if (childNumber < xml.getChildrenCount()) { // restore the position of the project manager window
855 867
			XMLEntity child = xml.getChild(childNumber);
856 868
			if (child.contains("className")
857
					&& child.getStringProperty("className").equals("com.iver.cit.gvsig.project.Project")
869
					&& child.getStringProperty("className").equals(ProjectWindow.class.getName())
858 870
					&& child.contains("name")
859 871
					&& child.getStringProperty("name").equals("ViewInfoProperties")) {
860
				seedProjectWindow = Project.createViewInfoFromXMLEntity(xml.getChild(childNumber));
872
				seedProjectWindow = Project.createWindowInfoFromXMLEntity(xml.getChild(childNumber));
861 873
			}
862 874
		}
863
 		*/
864 875

  
865 876
		p.setLinkTable();
866 877

  
......
1239 1250
	public static WindowInfo getSeedProjectWindow() {
1240 1251
		return seedProjectWindow;
1241 1252
	}
1253
	
1254
	public static void setSeedProjectWindow(WindowInfo projectWindow) {
1255
		seedProjectWindow = projectWindow;
1256
	}
1242 1257

  
1243 1258
	public XMLEntity getSourceInfoXMLEntity(SourceInfo di) {
1244 1259
		XMLEntity child = new XMLEntity();

Also available in: Unified diff