Revision 11101 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java

View differences:

FLyrVect.java
40 40
 */
41 41
package com.iver.cit.gvsig.fmap.layers;
42 42

  
43
import java.awt.Color;
44 43
import java.awt.Font;
45 44
import java.awt.Graphics2D;
46 45
import java.awt.Point;
......
734 733
			return this.orgXMLEntity;
735 734
		}
736 735
		XMLEntity xml = super.getXMLEntity();
737
		xml.addChild(getLegend().getXMLEntity());
736
		if (getLegend()!=null)
737
			xml.addChild(getLegend().getXMLEntity());
738 738
		try {
739
			xml.addChild(getRecordset().getSelectionSupport().getXMLEntity());
740

  
739
			if (getRecordset()!=null)
740
				xml.addChild(getRecordset().getSelectionSupport().getXMLEntity());
741 741
		} catch (DriverException e1) {
742 742
			e1.printStackTrace();
743 743
			throw new XMLException(e1);
744 744
		}
745 745
		//Repongo el mismo ReadableVectorial m?s abajo para cuando se guarda el proyecto.
746 746
		ReadableVectorial rv=getSource();
747
		if (getSource() instanceof VectorialEditableAdapter) {
748
			setSource(((VectorialEditableAdapter) source).getOriginalAdapter());
749
		}
750
		if (getSource() instanceof VectorialFileAdapter) {
751
			xml.putProperty("type", "vectorial");
752
			xml.putProperty("file", ((VectorialFileAdapter) getSource())
753
					.getFile());
754
			// try {
755
			try {
756
				xml.putProperty("recordset-name", getSource().getRecordset()
757
						.getName());
758
			} catch (DriverLoadException e) {
759
				// TODO Auto-generated catch block
760
				e.printStackTrace();
747
		xml.putProperty("type", "vectorial");
748
		if (source instanceof VectorialEditableAdapter) {
749
				setSource(((VectorialEditableAdapter) source)
750
						.getOriginalAdapter());
761 751
			}
762
			// } catch (DriverException e) {
763
			// throw new XMLException(e);
764
			// }
765
		} else if (source instanceof VectorialDBAdapter) {
766
			xml.putProperty("type", "vectorial");
752
			if (source instanceof VectorialFileAdapter) {
753
				xml.putProperty("file", ((VectorialFileAdapter) source)
754
						.getFile());
755
				try {
756
					xml.putProperty("recordset-name", source
757
							.getRecordset().getName());
758
				} catch (DriverLoadException e) {
759
					e.printStackTrace();
760
				} catch (RuntimeException e) {
761
					e.printStackTrace();
762
				}
763
			} else if (source instanceof VectorialDBAdapter) {
764
				VectorialDatabaseDriver dbDriver = (VectorialDatabaseDriver) source
765
						.getDriver();
767 766

  
768
			VectorialDatabaseDriver dbDriver = (VectorialDatabaseDriver) getSource()
769
					.getDriver();
767
				// Guardamos el nombre del driver para poder recuperarlo
768
				// con el DriverManager de Fernando.
769
				xml.putProperty("db", dbDriver.getName());
770
				try {
771
					xml.putProperty("recordset-name", source
772
							.getRecordset().getName());
773
				} catch (DriverLoadException e) {
774
					e.printStackTrace();
775
				} catch (RuntimeException e) {
776
					e.printStackTrace();
777
				}
778
				if (dbDriver!=null)
779
					xml.addChild(dbDriver.getXMLEntity()); // Tercer child. Antes
780
														// hemos
781
				// metido la leyenda y el
782
				// selection support
783
			} else if (source instanceof VectorialAdapter) {
784
				VectorialDriver driver = (VectorialDriver) source.getDriver();
770 785

  
771
			// Guardamos el nombre del driver para poder recuperarlo
772
			// con el DriverManager de Fernando.
773
			xml.putProperty("db", dbDriver.getName());
774
			// try {
775
			try {
776
				xml.putProperty("recordset-name", getSource().getRecordset()
777
						.getName());
778
			} catch (DriverLoadException e) {
779
				// TODO Auto-generated catch block
780
				e.printStackTrace();
786
				// Guardamos el nombre del driver para poder recuperarlo
787
				// con el DriverManager de Fernando.
788
				xml.putProperty("other", driver.getName());
789
				try {
790
					xml.putProperty("recordset-name", source
791
							.getRecordset().getName());
792
				} catch (DriverLoadException e) {
793
					e.printStackTrace();
794
				} catch (RuntimeException e) {
795
					e.printStackTrace();
796
				}
797
				if (driver instanceof IPersistance) {
798
					// xml.putProperty("className",
799
					// driver.getClass().getName());
800
					IPersistance persist = (IPersistance) driver;
801
					xml.addChild(persist.getXMLEntity()); // Tercer child.
802
															// Antes
803
					// hemos metido la
804
					// leyenda y el
805
					// selection support
806
				}
781 807
			}
782
			// } catch (DriverException e) {
783
			// throw new XMLException(e);
784
			// }
785
			xml.addChild(dbDriver.getXMLEntity()); // Tercer child. Antes hemos
786
													// metido la leyenda y el
787
													// selection support
788
		} else if (source instanceof VectorialAdapter) {
789
			// Se supone que hemos hecho algo gen?rico.
790
			xml.putProperty("type", "vectorial");
791

  
792
			VectorialDriver driver = (VectorialDriver) getSource().getDriver();
793

  
794
			// Guardamos el nombre del driver para poder recuperarlo
795
			// con el DriverManager de Fernando.
796
			xml.putProperty("other", driver.getName());
797
			// try {
798
			try {
799
				xml.putProperty("recordset-name", getSource().getRecordset()
800
						.getName());
801
			} catch (DriverLoadException e) {
802
				// TODO Auto-generated catch block
803
				e.printStackTrace();
804
			}
805
			// } catch (DriverException e) {
806
			// throw new XMLException(e);
807
			// }
808
			if (driver instanceof IPersistance) {
809
				// xml.putProperty("className", driver.getClass().getName());
810
				IPersistance persist = (IPersistance) driver;
811
				xml.addChild(persist.getXMLEntity()); // Tercer child. Antes
812
														// hemos metido la
813
														// leyenda y el
814
														// selection support
815
			}
816
		}
817
		setSource(rv);
818
		xml.putProperty("driverName", getSource().getDriver().getName());
808
			if (rv!=null)
809
				setSource(rv);
810
			xml.putProperty("driverName", source.getDriver().getName());
811
	
819 812
		if (bHasJoin)
820 813
			xml.putProperty("hasJoin", "true");
821 814

  
......
1181 1174
				VectorialEditableAdapter vea = (VectorialEditableAdapter) getSource();
1182 1175
				//CHEMA
1183 1176
				vea.stop();
1184
				//CHEMA				
1177
				//CHEMA
1185 1178
				setSource(vea.getOriginalAdapter());
1186 1179
			}
1187 1180
			// Si tenemos una leyenda, hay que pegarle el cambiazo a su
......
1217 1210
		} catch (FieldNotFoundException e) {
1218 1211
			e.printStackTrace();
1219 1212
			throw new EditionException(e);
1220
		//CHEMA	
1213
		//CHEMA
1221 1214
		} catch (DriverIOException e) {
1222 1215
			e.printStackTrace();
1223 1216
			throw new EditionException(e);

Also available in: Unified diff