Revision 9044
trunk/extensions/extWMS/src/com/iver/cit/gvsig/wmc/ImportWebMapContextExtension.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.9 2006-09-27 13:28:51 jaume |
|
46 |
* Revision 1.10 2006-11-28 11:46:59 cesar |
|
47 |
* Add support to persist the document internal layout |
|
48 |
* |
|
49 |
* Revision 1.9 2006/09/27 13:28:51 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.8 2006/09/20 10:32:15 jaume |
... | ... | |
224 | 227 |
// show the view in a new window |
225 | 228 |
View v = null; |
226 | 229 |
v = new View(); |
230 |
v.initialize(); |
|
227 | 231 |
v.setModel(dstView); |
228 | 232 |
PluginServices.getMDIManager().addWindow(v); |
229 | 233 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/IProjectView.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import com.iver.cit.gvsig.fmap.MapContext; |
6 | 6 |
import com.iver.cit.gvsig.project.Project; |
7 |
import com.iver.cit.gvsig.project.documents.gui.WindowData; |
|
7 | 8 |
|
8 | 9 |
public interface IProjectView { |
9 | 10 |
|
... | ... | |
96 | 97 |
* @return DOCUMENT ME! |
97 | 98 |
*/ |
98 | 99 |
public String getSelectedField(); |
99 |
|
|
100 |
|
|
101 |
/** |
|
102 |
* Store the properties of the window associated with this |
|
103 |
* IProjectView. |
|
104 |
*/ |
|
105 |
public void storeWindowData(WindowData data); |
|
106 |
|
|
100 | 107 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/ProjectView.java | ||
---|---|---|
59 | 59 |
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory; |
60 | 60 |
import com.iver.cit.gvsig.project.documents.exceptions.OpenException; |
61 | 61 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
62 |
import com.iver.cit.gvsig.project.documents.gui.WindowData; |
|
62 | 63 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
63 | 64 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
64 | 65 |
import com.iver.cit.gvsig.project.documents.view.gui.ViewProperties; |
... | ... | |
191 | 192 |
public String getFrameName() { |
192 | 193 |
return PluginServices.getText(this,"Vista"); |
193 | 194 |
} |
195 |
|
|
194 | 196 |
public IWindow createWindow() { |
195 | 197 |
com.iver.cit.gvsig.project.documents.view.gui.View view = new com.iver.cit.gvsig.project.documents.view.gui.View(); |
198 |
if (windowData != null) |
|
199 |
view.setWindowData(windowData); |
|
200 |
view.initialize(); |
|
196 | 201 |
view.setModel(this); |
197 | 202 |
return view; |
198 | 203 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/gui/IView.java | ||
---|---|---|
73 | 73 |
* @return DOCUMENT ME! |
74 | 74 |
*/ |
75 | 75 |
public abstract TOC getTOC(); |
76 |
|
|
77 |
/** |
|
78 |
* Create the internal componentes and populate the window with them. |
|
79 |
* If the layout properties were set using the |
|
80 |
* <code>setWindowData(WindowData)</code> |
|
81 |
* method, the window will be populated according to this |
|
82 |
* properties. |
|
83 |
*/ |
|
84 |
//public abstract void initialize(); |
|
76 | 85 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/gui/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 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/gui/View.java | ||
---|---|---|
135 | 135 |
protected boolean isShowConsole=false; |
136 | 136 |
private ViewPortListener viewPortListener; |
137 | 137 |
/** |
138 |
* Creates a new View object. |
|
138 |
* Creates a new View object. Before being used, the object must be |
|
139 |
* initialized. |
|
140 |
* |
|
141 |
* @see initialize() |
|
139 | 142 |
*/ |
140 | 143 |
public View() { |
144 |
super(); |
|
141 | 145 |
this.setName("View"); |
142 |
//this.setName(Utilities.getMessage(this, "Vista")+ " : "+modelo.getName()); |
|
143 |
// this.setPreferredSize(new Dimension(500, 300)); |
|
144 |
initComponents(); |
|
145 |
hideConsole(); |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* Create the internal componentes and populate the window with them. |
|
150 |
* If the layout properties were set using the |
|
151 |
* <code>setWindowData(WindowData)</code> |
|
152 |
* method, the window will be populated according to this |
|
153 |
* properties. |
|
154 |
*/ |
|
155 |
public void initialize() { |
|
156 |
super.initialize(); |
|
157 |
initComponents(); |
|
158 |
hideConsole(); |
|
146 | 159 |
getConsolePanel().addResponseListener(consoleResponseAdapter); |
147 |
/* getConsolePanel().addContainerListener(new ContainerAdapter() { |
|
148 |
public void componentAdded(ContainerEvent e) { |
|
149 |
// Mostramos consola |
|
150 |
SwingUtilities.invokeLater(new Runnable() { |
|
151 |
public void run() { |
|
152 |
|
|
153 |
getMapControl().doLayout(); // drawMap(false); |
|
154 |
getConsolePanel().invalidate(); |
|
155 |
getConsolePanel().repaint(); |
|
156 |
getMapControl().repaint(); |
|
157 |
getConsolePanel().getTxt().doLayout(); |
|
158 |
} |
|
159 |
}); |
|
160 |
} |
|
161 |
|
|
162 |
public void componentRemoved(ContainerEvent e) { |
|
163 |
// Ocultamos consola |
|
164 |
SwingUtilities.invokeLater(new Runnable() { |
|
165 |
public void run() { |
|
166 |
getMapControl().repaint(); |
|
167 |
} |
|
168 |
}); |
|
169 |
|
|
170 |
} |
|
171 |
|
|
172 |
}); */ |
|
173 | 160 |
} |
174 | 161 |
|
175 | 162 |
/** |
... | ... | |
386 | 373 |
m_MapControl = new MapControl(); // Default is paintEnabled = false. |
387 | 374 |
// Remember to activate it |
388 | 375 |
m_MapControl.addExceptionListener(mapControlExceptionListener); |
389 |
// modelo.setMapContext(m_MapControl.getMapContext()); |
|
390 |
|
|
391 |
// m_MapControl.setAcceptEvents(true); Lo comento porque ya se hace en el setModel |
|
392 | 376 |
m_TOC = new TOC(); |
393 | 377 |
|
394 |
|
|
395 | 378 |
// Ponemos el localizador |
396 |
m_MapLoc = new MapOverview(m_MapControl); |
|
397 |
m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
|
379 |
m_MapLoc = new MapOverview(m_MapControl); |
|
398 | 380 |
removeAll(); |
399 |
//JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
|
400 | 381 |
tempMainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
401 |
tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
|
382 |
|
|
383 |
if (windowData==null) { |
|
384 |
m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
|
385 |
tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
|
386 |
} |
|
387 |
|
|
402 | 388 |
if (!isPalette()){ |
403 |
JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
389 |
tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
|
404 | 390 |
tempSplitToc.setTopComponent(m_TOC); |
405 | 391 |
tempSplitToc.setBottomComponent(m_MapLoc); |
406 | 392 |
tempSplitToc.setResizeWeight(0.7); |
... | ... | |
416 | 402 |
this.setLayout(new BorderLayout()); |
417 | 403 |
this.add(tempMainSplit, BorderLayout.CENTER); |
418 | 404 |
|
419 |
// hideConsole(); |
|
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
405 |
|
|
406 |
if (windowData!=null) { |
|
407 |
try { |
|
408 |
tempMainSplit.setDividerLocation(Integer.valueOf(windowData.get("MainDivider.Location")).intValue()); |
|
409 |
if (windowData.get("TOCDivider.Location")!=null) { |
|
410 |
tempSplitToc.setDividerLocation(Integer.valueOf(windowData.get("TOCDivider.Location")).intValue()); |
|
411 |
} |
|
412 |
} |
|
413 |
catch (NumberFormatException ex) { |
|
414 |
PluginServices.getLogger().error("Error restoring View properties"); |
|
415 |
} |
|
416 |
} |
|
417 |
|
|
424 | 418 |
//Listener de eventos de movimiento que pone las coordenadas del rat?n en la barra de estado |
425 | 419 |
StatusBarListener sbl = new StatusBarListener(m_MapControl); |
426 | 420 |
|
... | ... | |
514 | 508 |
getMapControl().getViewPort().removeViewPortListener(viewPortListener); |
515 | 509 |
if (getMapOverview()!=null) |
516 | 510 |
getMapOverview().getViewPort().removeViewPortListener(getMapOverview()); |
511 |
|
|
517 | 512 |
} |
518 | 513 |
public void toPalette() { |
519 | 514 |
isPalette=true; |
... | ... | |
601 | 596 |
public static void setDefaultBackColor(Color color) { |
602 | 597 |
defaultViewBackColor = color; |
603 | 598 |
} |
599 |
|
|
604 | 600 |
|
605 | 601 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/gui/WindowData.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package com.iver.cit.gvsig.project.documents.gui; |
|
5 |
|
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Iterator; |
|
8 |
|
|
9 |
import com.iver.utiles.XMLEntity; |
|
10 |
|
|
11 |
/** |
|
12 |
* @author cesar |
|
13 |
* |
|
14 |
*/ |
|
15 |
public class WindowData { |
|
16 |
|
|
17 |
HashMap data = null; |
|
18 |
|
|
19 |
public WindowData() { |
|
20 |
data = new HashMap(); |
|
21 |
} |
|
22 |
|
|
23 |
public void set(String key, String value) { |
|
24 |
data.put(key, value); |
|
25 |
} |
|
26 |
|
|
27 |
public String get(String key) { |
|
28 |
return (String) data.get(key); |
|
29 |
} |
|
30 |
|
|
31 |
public XMLEntity getXMLEntity() { |
|
32 |
XMLEntity xml = new XMLEntity(); |
|
33 |
xml.setName("windowData"); |
|
34 |
Iterator keyList = data.keySet().iterator(); |
|
35 |
while (keyList.hasNext()) { |
|
36 |
String key = (String) keyList.next(); |
|
37 |
xml.putProperty(key, get(key)); |
|
38 |
} |
|
39 |
return xml; |
|
40 |
} |
|
41 |
|
|
42 |
public void setXMLEntity(XMLEntity xml) { |
|
43 |
for (int i=xml.getPropertyCount()-1; i>0; i--) { |
|
44 |
data.put(xml.getPropertyName(i), xml.getPropertyValue(i)); |
|
45 |
} |
|
46 |
} |
|
47 |
|
|
48 |
} |
|
0 | 49 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/ProjectDocument.java | ||
---|---|---|
56 | 56 |
import com.iver.cit.gvsig.project.Project; |
57 | 57 |
import com.iver.cit.gvsig.project.documents.exceptions.OpenException; |
58 | 58 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
59 |
import com.iver.cit.gvsig.project.documents.gui.WindowData; |
|
59 | 60 |
import com.iver.utiles.XMLEntity; |
60 | 61 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
61 | 62 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
... | ... | |
76 | 77 |
protected String owner; |
77 | 78 |
protected String comment; |
78 | 79 |
private boolean locked = false; |
80 |
protected WindowData windowData = null; |
|
79 | 81 |
|
80 | 82 |
private ProjectDocumentFactory projectDocumentFactory; |
81 | 83 |
/** |
... | ... | |
387 | 389 |
public void importFromXML(XMLEntity root, XMLEntity typeRoot,int elementIndex ,Project project) throws XMLException, DriverException, OpenException{ |
388 | 390 |
importFromXML(root,typeRoot, elementIndex,project,false); |
389 | 391 |
} |
390 |
|
|
391 |
|
|
392 |
|
|
393 |
/** |
|
394 |
* Get the layout properties (size, position, state of the components) |
|
395 |
* of the window associated with this ProjectDocument. |
|
396 |
* This is used to re-open the window with the same properties it had |
|
397 |
* when it was closed. |
|
398 |
* |
|
399 |
* @return A WindowData object storing the properties of the window. |
|
400 |
*/ |
|
401 |
public WindowData getWindowData() { |
|
402 |
return windowData; |
|
403 |
} |
|
404 |
|
|
405 |
/** |
|
406 |
* Store the layout properties (size, position, state of the components) |
|
407 |
* of the window associated with this ProjectDocument. |
|
408 |
* This is used to re-open the window with the same properties it had |
|
409 |
* when it was closed. |
|
410 |
*/ |
|
411 |
public void storeWindowData(WindowData data) { |
|
412 |
windowData = data; |
|
413 |
} |
|
392 | 414 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/Project.java | ||
---|---|---|
93 | 93 |
import com.iver.cit.gvsig.project.documents.exceptions.OpenException; |
94 | 94 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
95 | 95 |
import com.iver.cit.gvsig.project.documents.gui.ProjectWindow; |
96 |
import com.iver.cit.gvsig.project.documents.gui.WindowData; |
|
96 | 97 |
import com.iver.cit.gvsig.project.documents.layout.ProjectMap; |
97 | 98 |
import com.iver.cit.gvsig.project.documents.layout.ProjectMapFactory; |
98 | 99 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
99 | 100 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
100 | 101 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
101 | 102 |
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory; |
103 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
|
102 | 104 |
import com.iver.utiles.IPersistance; |
103 | 105 |
import com.iver.utiles.PostProcessSupport; |
104 | 106 |
import com.iver.utiles.StringUtilities; |
... | ... | |
776 | 778 |
((ProjectDocument) viewWindow.getWindowModel()) |
777 | 779 |
.getName()); |
778 | 780 |
windowProperties.putProperty("zPosition", winIndex); |
781 |
|
|
782 |
// TODO this will be generalized to all ProjectDocuments as soon as possible |
|
783 |
if (viewWindow instanceof BaseView) { |
|
784 |
BaseView win = (BaseView) viewWindow; |
|
785 |
windowProperties.addChild(win.getWindowData().getXMLEntity()); |
|
786 |
} |
|
779 | 787 |
propertyList.addChild(windowProperties); |
780 | 788 |
} |
781 | 789 |
} |
... | ... | |
953 | 961 |
.getStringProperty("documentType"); |
954 | 962 |
ProjectDocument pd = this.getProjectDocumentByName( |
955 | 963 |
documentName, documentType); |
956 |
IWindow win = pd.createWindow(); |
|
964 |
IWindow win = null; |
|
965 |
if (pd instanceof ProjectView |
|
966 |
&& child.getChildrenCount()>0 |
|
967 |
&& child.getChild(0).getName().equals("windowData")) { |
|
968 |
// this will be generalized to all ProjectDocuments as soon as possible |
|
969 |
WindowData windowData = new WindowData(); |
|
970 |
windowData.setXMLEntity(child.getChild(0)); |
|
971 |
((ProjectView)pd).storeWindowData(windowData); |
|
972 |
win = ((ProjectView)pd).createWindow(); |
|
973 |
} else { |
|
974 |
win = pd.createWindow(); |
|
975 |
} |
|
957 | 976 |
PluginServices.getMDIManager().addWindow(win); |
958 | 977 |
PluginServices.getMDIManager().changeWindowInfo(win, |
959 | 978 |
windowProps); |
Also available in: Unified diff