Revision 9044 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/gui/BaseView.java

View differences:

BaseView.java
54 54
import com.iver.andami.ui.mdiManager.SingletonWindow;
55 55
import com.iver.andami.ui.mdiManager.WindowInfo;
56 56
import com.iver.cit.gvsig.fmap.MapControl;
57
import com.iver.cit.gvsig.project.documents.gui.WindowData;
57 58
import com.iver.cit.gvsig.project.documents.view.IProjectView;
58 59
import com.iver.cit.gvsig.project.documents.view.MapOverview;
59 60
import com.iver.cit.gvsig.project.documents.view.toc.gui.TOC;
......
79 80

  
80 81
  protected boolean isPalette=false;
81 82
  protected MapOverViewPalette movp;
82
  protected JSplitPane tempMainSplit;
83
  protected JSplitPane tempMainSplit, tempSplitToc=null;
84
  
85
  
86
  protected WindowData windowData = null;
83 87

  
84 88
  // OVERRIDE THESE
85 89
  public void windowActivated() {}
......
88 92

  
89 93

  
90 94
  /**
91
   * Creates a new View object.
95
   * Creates a new View object. Before using it, it must be initialized
96
   * using the <code>initialize()</code> method.
97
   * 
98
   * @see initialize()
92 99
   */
93 100
  public BaseView() {
94 101

  
95 102
  }
103
  
104
  /**
105
   * Create the internal componentes and populate the window with them.
106
   * If the layout properties were set using the
107
   * <code>setWindowData(WindowData)</code>
108
   * method, the window will be populated according to this
109
   * properties.
110
   */
111
  public void initialize() {}
96 112

  
97 113
  /**
98 114
   * This method is used to get <strong>an initial</strong> ViewInfo object
......
124 140
		if (movp!=null)
125 141
			PluginServices.getMDIManager().closeWindow(movp);
126 142
		///PluginServices.getMainFrame().getStatusBar().setMessage("1","");
143
		
144
		if (modelo != null)
145
			modelo.storeWindowData(getWindowData());
127 146
	}
128 147

  
129 148
  /**
......
218 237
		return getMapControl().getProjection();
219 238
	}
220 239

  
240
	public WindowData getWindowData() {
241
		updateWindowData();
242
		return windowData;
243
	}
244
	
245
	private void updateWindowData() {
246
		if (windowData == null)
247
			windowData = new WindowData();
248
		windowData.set("MainWindow.X", Integer.toString(this.getX()));
249
		windowData.set("MainWindow.Y", Integer.toString(this.getY()));
250
		windowData.set("MainWindow.Width", Integer.toString(this.getWidth()));
251
		windowData.set("MainWindow.Height", Integer.toString(this.getHeight()));
252
		
253
		windowData.set("MainDivider.Location", Integer.toString(tempMainSplit.getDividerLocation()));
254
		windowData.set("MainDivider.X", Integer.toString(tempMainSplit.getX()));
255
		windowData.set("MainDivider.Y", Integer.toString(tempMainSplit.getY()));
256
		windowData.set("MainDivider.Width", Integer.toString(tempMainSplit.getWidth()));
257
		windowData.set("MainDivider.Height", Integer.toString(tempMainSplit.getHeight()));
258
		
259
		if (isPalette())
260
			windowData.set("GraphicLocator.isPalette", "true");
261
		else {
262
			windowData.set("GraphicLocator.isPalette", "false");
263
			if (tempSplitToc!=null) {
264
				windowData.set("TOCDivider.Location", Integer.toString(tempSplitToc.getDividerLocation()));
265
				windowData.set("TOCDivider.X", Integer.toString(tempSplitToc.getX()));
266
				windowData.set("TOCDivider.Y", Integer.toString(tempSplitToc.getY()));
267
				windowData.set("TOCDivider.Width", Integer.toString(tempSplitToc.getWidth()));
268
				windowData.set("TOCDivider.Height", Integer.toString(tempSplitToc.getHeight()));
269
			}
270
		}
271
		if (m_TOC!=null) {
272
			windowData.set("TOC.Width", Integer.toString(m_TOC.getWidth()));
273
			windowData.set("TOC.Height", Integer.toString(m_TOC.getHeight()));
274
		}
275
		if (m_MapControl!=null) {
276
			windowData.set("MapControl.Width", Integer.toString(m_MapControl.getWidth()));
277
			windowData.set("MapControl.Height", Integer.toString(m_MapControl.getHeight()));
278
		}
279
		if (m_MapLoc!=null) {
280
			windowData.set("GraphicLocator.Width", Integer.toString(m_MapLoc.getWidth()));
281
			windowData.set("GraphicLocator.Height", Integer.toString(m_MapLoc.getHeight()));
282
		}
283

  
284
	}
285
	
286
	public void setWindowData(WindowData data) {
287
		windowData = data;
288
	}
221 289
}

Also available in: Unified diff