svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / castor / ProjectMap.java @ 652
History | View | Annotate | Download (1.79 KB)
1 |
package com.iver.cit.gvsig.project.castor; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.engine.data.DriverException; |
4 |
|
5 |
import com.iver.cit.gvsig.gui.layout.Layout; |
6 |
|
7 |
import com.iver.utiles.XMLEntity; |
8 |
|
9 |
import java.text.DateFormat; |
10 |
|
11 |
import java.util.Date; |
12 |
|
13 |
|
14 |
/**
|
15 |
* DOCUMENT ME!
|
16 |
*
|
17 |
* @author Fernando Gonz?lez Cort?s
|
18 |
*/
|
19 |
public class ProjectMap extends ProjectElement { |
20 |
private static int numMaps = 0; |
21 |
private Layout model;
|
22 |
|
23 |
/**
|
24 |
* DOCUMENT ME!
|
25 |
*
|
26 |
* @param baseName DOCUMENT ME!
|
27 |
*
|
28 |
* @return DOCUMENT ME!
|
29 |
*/
|
30 |
public static ProjectMap createMap(String baseName) { |
31 |
ProjectMap m = new ProjectMap();
|
32 |
m.setName(baseName + " - " + numMaps);
|
33 |
m.setCreationDate(DateFormat.getInstance().format(new Date())); |
34 |
numMaps++; |
35 |
|
36 |
return m;
|
37 |
} |
38 |
|
39 |
/**
|
40 |
* @see com.iver.cit.gvsig.project.ProjectMap#getModel()
|
41 |
*/
|
42 |
public Layout getModel() {
|
43 |
return model;
|
44 |
} |
45 |
|
46 |
/**
|
47 |
* @see com.iver.cit.gvsig.project.ProjectMap#setMapContext(com.iver.cit.gvsig.project.castor.XMLEntity)
|
48 |
*/
|
49 |
public void setModel(Layout f) { |
50 |
model = f; |
51 |
f.setName(getName()); |
52 |
} |
53 |
|
54 |
/**
|
55 |
* @see com.iver.cit.gvsig.project.ProjectElement#setName(java.lang.String)
|
56 |
*/
|
57 |
public void setName(String string) { |
58 |
super.setName(string);
|
59 |
|
60 |
Layout m = getModel(); |
61 |
|
62 |
if (m != null) { |
63 |
m.setName(string); |
64 |
} |
65 |
} |
66 |
|
67 |
/**
|
68 |
* DOCUMENT ME!
|
69 |
*
|
70 |
* @return DOCUMENT ME!
|
71 |
*
|
72 |
* @throws DriverException
|
73 |
*/
|
74 |
public XMLEntity getXMLEntity() {
|
75 |
XMLEntity xml = super.getXMLEntity();
|
76 |
xml.putProperty("nameClass", this.getClass().getName()); |
77 |
xml.putProperty("numMaps", numMaps);
|
78 |
xml.addChild(model.getXMLEntity()); |
79 |
|
80 |
return xml;
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* @see com.iver.cit.gvsig.project.castor.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
|
85 |
*/
|
86 |
public void setXMLEntity(XMLEntity xml, Project p) { |
87 |
numMaps = xml.getIntProperty("numMaps");
|
88 |
model = Layout.createLayout(xml.getChild(0), p);
|
89 |
} |
90 |
} |