Revision 8711 trunk/libraries/libJCRS/src/org/gvsig/crs/persistence/RecentCRSsPersistence.java

View differences:

RecentCRSsPersistence.java
61 61
 */
62 62
public class RecentCRSsPersistence {
63 63
	private XMLEntity xml = null;
64
	private XMLEntity recentsXml = null;
64 65
	private PluginServices ps = null;
66
	private static final String CRS_RECENTS = "recentCrss";
65 67
	private static final String CRS_AUTHORITY = "authority";
66 68
	private static final String CRS_NAME = "name";
67 69
	private static final String CRS_CODE = "code";
......
78 80
	public RecentCRSsPersistence(Object pluginClassInstance){
79 81
		ps = PluginServices.getPluginServices(pluginClassInstance);
80 82
		xml = ps.getPersistentXML();
83
		for (int child = 0; child<xml.getChildrenCount();child++)
84
			if (xml.getChild(child).getPropertyValue(0).equals(CRS_RECENTS))
85
				recentsXml = xml.getChild(child); 
86
		if (recentsXml == null){
87
			XMLEntity xmlEntity = new XMLEntity();
88
			xmlEntity.putProperty("groupName", CRS_RECENTS);
89
			xml.addChild(xmlEntity);
90
			recentsXml = xmlEntity;
91
		}
81 92
	}
82 93
	
83 94
	/**
......
86 97
	public RecentCRSsPersistence(){
87 98
		ps = PluginServices.getPluginServices(pluginClassInstance);
88 99
		xml = ps.getPersistentXML();
100
		for (int child = 0; child<xml.getChildrenCount();child++)
101
			if (xml.getChild(child).getPropertyValue(0).equals(CRS_RECENTS))
102
				recentsXml = xml.getChild(child); 
103
		if (recentsXml == null){
104
			XMLEntity xmlEntity = new XMLEntity();
105
			xmlEntity.putProperty("groupName", CRS_RECENTS);
106
			xml.addChild(xmlEntity); 
107
			recentsXml = xmlEntity;
108
		}
89 109
	}
90 110

  
91 111
	/**
......
102 122
	 * Array of crss
103 123
	 */
104 124
	public void setArrayOfCrsData(CrsData[] crss){
105
		xml.getXmlTag().removeAllXmlTag();
125
		recentsXml.getXmlTag().removeAllXmlTag();
106 126

  
107 127
		for (int i=0 ; i<crss.length ; i++){
108
			xml.addChild(crsDataToXml(crss[i]));
128
			recentsXml.addChild(crsDataToXml(crss[i]));
109 129
		}
110 130

  
111 131
	}
......
157 177
	 * CrsData[]
158 178
	 */
159 179
	public CrsData[] getArrayOfCrsData(){
160
		CrsData[] crss = new CrsData[xml.getChildrenCount()];
161
		for (int i=0 ; i<xml.getChildrenCount() ; i++){
162
			crss[i] = xmlToCrsData(xml.getChild(i));
180
		CrsData[] crss = new CrsData[recentsXml.getChildrenCount()];
181
		for (int i=0 ; i<recentsXml.getChildrenCount() ; i++){
182
			crss[i] = xmlToCrsData(recentsXml.getChild(i));
163 183
		}
164 184
		
165 185
		/*

Also available in: Unified diff