Revision 10627

View differences:

trunk/extensions/extWMS/.classpath
15 15
	<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
16 16
	<classpathentry kind="src" path="test"/>
17 17
	<classpathentry kind="lib" path="/libFMap/lib/driver-manager-1.1.jar"/>
18
	<classpathentry sourcepath="/libUI" kind="lib" path="/_fwAndami/lib/beans.jar"/>
19
	<classpathentry kind="lib" path="/libFMap/lib/remote-clients.jar"/>
18 20
	<classpathentry kind="lib" path="/_fwAndami/lib/kxml2.jar"/>
19
	<classpathentry sourcepath="/libUI" kind="lib" path="/_fwAndami/lib/beans.jar"/>
21
	<classpathentry sourcepath="/libExceptions" kind="lib" path="/libFMap/lib/gvsig-exceptions.jar"/>
22
	<classpathentry sourcepath="/libGDBMS" kind="lib" path="/libFMap/lib/gdbms-0.8-SNAPSHOT.jar"/>
20 23
	<classpathentry kind="output" path="bin"/>
21 24
</classpath>
trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
82 82
import org.gvsig.remoteClient.wms.ICancellable;
83 83
import org.gvsig.remoteClient.wms.WMSStatus;
84 84

  
85
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
85 86
import com.iver.andami.PluginServices;
86 87
import com.iver.andami.messages.NotificationManager;
88
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException;
89
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
90
import com.iver.cit.gvsig.exceptions.layers.URLLayerException;
91
import com.iver.cit.gvsig.exceptions.layers.UnsupportedVersionLayerException;
92
import com.iver.cit.gvsig.exceptions.visitors.VisitorException;
87 93
import com.iver.cit.gvsig.fmap.ConnectionErrorExceptionType;
88
import com.iver.cit.gvsig.fmap.DriverException;
89 94
import com.iver.cit.gvsig.fmap.UnknownResponseFormatExceptionType;
90 95
import com.iver.cit.gvsig.fmap.UnsuportedProtocolVersionExceptionType;
91 96
import com.iver.cit.gvsig.fmap.ViewPort;
92 97
import com.iver.cit.gvsig.fmap.WMSDriverExceptionType;
93 98
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
94
import com.iver.cit.gvsig.fmap.drivers.UnsupportedVersionException;
95 99
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
96 100
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriverFactory;
97 101
import com.iver.cit.gvsig.fmap.drivers.wms.WMSException;
......
173 177
		super();
174 178
	}
175 179

  
176
	public FLyrWMS(Map args) throws DriverIOException{
180
	public FLyrWMS(Map args) throws LoadLayerException{
177 181
		FMapWMSDriver drv = null;
178 182
		String host = (String)args.get("host");
179 183
		String sLayer = (String)args.get("layer");
......
186 190
			this.setHost(new URL(host));
187 191
		} catch (MalformedURLException e) {
188 192
			//e.printStackTrace();
189
			throw new DriverIOException("Malformed host URL, '" + host + "' (" + e.toString() + ").");
193
			throw new URLLayerException(getName(),e);
190 194
		}
191
		try {
192
			drv = this.getDriver();
193
		} catch (Exception e) {
194
			// e.printStackTrace();
195
			throw new DriverIOException("Can't get driver to host '" + host + "' (" + e.toString() + ").");
196
		}
195
			try {
196
				drv = this.getDriver();
197
			} catch (IllegalStateException e) {
198
				throw new LoadLayerException(getName(),e);
199
			} catch (ValidationException e) {
200
				throw new LoadLayerException(getName(),e);
201
			} catch (IOException e) {
202
				throw new ConnectionErrorLayerException(getName(),e);
203
			}
197 204
		if( sFormat == null || sSRS == null || fullExtent == null ) {
198 205
			if (!drv.connect(null))
199
				throw new DriverIOException("Can't connect to host '" + host + "'.");
206
				throw new ConnectionErrorLayerException(getName(),null);
200 207

  
201 208
			WMSLayerNode wmsNode = drv.getLayer(sLayer);
202 209

  
203 210
			if (wmsNode == null){
204
				throw new DriverIOException("The server '" + host + "' doesn't has the layer '" + sLayer + "'.");
211
				throw new LoadLayerException(getName(),null);
205 212
			}
206 213
			if( sFormat == null ) {
207 214
				sFormat = this.getGreatFormat(drv.getFormats());
......
213 220
				for (int i=0; i<allSrs.size() ; i++){
214 221
     				if (((String)allSrs.get(i)).compareTo(sSRS) == 0){
215 222
     					isSRSSupported = true;
216
     				}     				
223
     				}
217 224
     			}
218 225
			}
219
			
226

  
220 227
     		if(!isSRSSupported) {
221 228
     			for (int i=0; i<allSrs.size() ; i++){
222 229
     				if (((String)wmsNode.getAllSrs().get(i)).compareTo("EPSG:4326") == 0){
223 230
     					sSRS = (String)wmsNode.getAllSrs().get(i);
224
     				}     				
231
     				}
225 232
     			}
226 233
     			if (sSRS==null){
227 234
     				sSRS = (String)wmsNode.getAllSrs().get(0);
......
512 519
	}
513 520

  
514 521
	/**
522
	 * @throws ReadDriverException
523
	 * @throws LoadLayerException
515 524
	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint#queryByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint)
516 525
	 */
517
	public XMLItem[] getInfo(Point p, double tolerance, Cancellable cancellable) throws DriverException {
526
	public XMLItem[] getInfo(Point p, double tolerance, Cancellable cancellable) throws VisitorException, ReadDriverException, LoadLayerException {
518 527
		XMLItem[] item =  new XMLItem[1];
519 528
		try {
520 529
			if (queryable)
......
566 575
		}
567 576
		*/
568 577
		catch (ValidationException e) {
569
			UnknownResponseFormatExceptionType type =
570
				new UnknownResponseFormatExceptionType();
571
			type.setLayerName(getName());
572
			try {
573
				type.setDriverName("WMS Driver");
574
			} catch (Exception e1) {
575
				e1.printStackTrace();
576
			}
577
			type.setFormat(m_Format);
578
			type.setHost(host);
579
			type.setProtocol("WMS");
580
			DriverException exception = new DriverException("unknown_response_format", type);
578
//			UnknownResponseFormatExceptionType type =
579
//				new UnknownResponseFormatExceptionType();
580
//			type.setLayerName(getName());
581
//			try {
582
//				type.setDriverName("WMS Driver");
583
//			} catch (Exception e1) {
584
//				e1.printStackTrace();
585
//			}
586
//			type.setFormat(m_Format);
587
//			type.setHost(host);
588
//			type.setProtocol("WMS");
589
			LoadLayerException exception = new LoadLayerException(getName(),e);
581 590
			throw exception;
582 591

  
583
		} catch (UnsupportedVersionException e) {
584
			UnsuportedProtocolVersionExceptionType type =
585
				new UnsuportedProtocolVersionExceptionType();
586
			type.setLayerName(getName());
587
			try {
588
				type.setDriverName("WMS Driver");
589
			} catch (Exception ex){
590
			}
591
			type.setUrl(host);
592
			throw new DriverException(PluginServices.getText(this, "version_conflict"), e, type);
592
		} //catch (UnsupportedVersionLayerException e) {
593
//			UnsuportedProtocolVersionExceptionType type =
594
//				new UnsuportedProtocolVersionExceptionType();
595
//			type.setLayerName(getName());
596
//			try {
597
//				type.setDriverName("WMS Driver");
598
//			} catch (Exception ex){
599
//			}
600
//			type.setUrl(host);
601
//			throw new ReadDriverException(PluginServices.getText(this, "version_conflict"));
593 602

  
594
		} catch (IOException e) {
595
			ConnectionErrorExceptionType type = new ConnectionErrorExceptionType();
596
			type.setLayerName(getName());
597
			try {
598
				type.setDriverName("WMS Driver");
599
			} catch (Exception e1) {
600
			}
601
			type.setHost(host);
602
			throw new DriverException(PluginServices.
603
					getText(this, "connect_error"), e, type);
603
//		}
604
		catch (IOException e) {
605
//			ConnectionErrorExceptionType type = new ConnectionErrorExceptionType();
606
//			type.setLayerName(getName());
607
//			try {
608
//				type.setDriverName("WMS Driver");
609
//			} catch (Exception e1) {
610
//			}
611
//			type.setHost(host);
612
			throw new ConnectionErrorLayerException(getName(),e);
604 613
		}
605 614
		catch (NoninvertibleTransformException e) {
606 615
			NotificationManager.addError("NotinvertibleTransform", e);
......
624 633
	private int callCount; // mess code, represents the amount of times the methods drawFixedSize or drawTile where tried for an extent
625 634
	private static final int MAX_RETRY_TIMES = 5; // mess code, represents the max amount of retries allowed.
626 635
	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
627
			Cancellable cancel,double scale) throws DriverException {
636
			Cancellable cancel,double scale) throws ReadDriverException {
628 637
		callCount = 0; // mess code
629 638
		if (isWithinScale(scale)){
630 639
			Point2D p = viewPort.getOffset();
......
642 651
				// This condition handles those situations in which the server can
643 652
				// only give static extent and resolution maps despite we need
644 653
				// a specific BBOX and pixel WIDTH and HEIGHT
645
				drawFixedSize(g, viewPort, cancel);
654
				try {
655
					drawFixedSize(g, viewPort, cancel);
656
				} catch (LoadLayerException e) {
657
					// TODO Auto-generated catch block
658
					e.printStackTrace();
659
				}
646 660

  
647 661
			} else {
648 662
				if(mustTileDraw){
......
656 670
							drawTile(g, vp, cancel);
657 671
						} catch (NoninvertibleTransformException e) {
658 672
							e.printStackTrace();
673
						} catch (LoadLayerException e) {
674
							// TODO Auto-generated catch block
675
							e.printStackTrace();
659 676
						}
660 677
					}
661
				}else
662
					drawTile(g, viewPort, cancel);
678
				} else
679
					try {
680
						drawTile(g, viewPort, cancel);
681
					} catch (LoadLayerException e) {
682
						// TODO Auto-generated catch block
683
						e.printStackTrace();
684
					}
663 685
			}
664 686
		}
665 687
//		Runtime r = Runtime.getRuntime();
......
667 689
//		System.err.println("Memoria total: " + (mem / 1024) +"KB");
668 690
	}
669 691

  
670
	private void drawFixedSize(Graphics2D g, ViewPort vp, Cancellable cancel) throws DriverException {
692
	private void drawFixedSize(Graphics2D g, ViewPort vp, Cancellable cancel) throws ReadDriverException, LoadLayerException {
671 693
		callCount++; // mess code, it is not unusual a wms server to response an error which is completely
672 694
					 // temporal and the response is available if we retry requesting.
673 695
					 //
......
713 735
		} catch (ValidationException e) {
714 736
			if (!c.isCanceled())
715 737
			{
716
				UnknownResponseFormatExceptionType type =
717
					new UnknownResponseFormatExceptionType();
718
				type.setLayerName(getName());
719
				try {
720
					type.setDriverName("WMS Driver");
721
				} catch (Exception e1) {
722
					e1.printStackTrace();
723
				}
724
				type.setFormat(m_Format);
725
				type.setHost(host);
726
				type.setProtocol("WMS");
727
				DriverException exception = new DriverException("unknown_response_format", type);
738
//				UnknownResponseFormatExceptionType type =
739
//					new UnknownResponseFormatExceptionType();
740
//				type.setLayerName(getName());
741
//				try {
742
//					type.setDriverName("WMS Driver");
743
//				} catch (Exception e1) {
744
//					e1.printStackTrace();
745
//				}
746
//				type.setFormat(m_Format);
747
//				type.setHost(host);
748
//				type.setProtocol("WMS");
749
				LoadLayerException exception = new LoadLayerException(getName(),e);
728 750
				throw exception;
729 751
			}
730 752
//	azabala			throw new DriverException(PluginServices.getText(this, "unknown_response_format"), e);
731
		} catch (UnsupportedVersionException e) {
732
			if (!c.isCanceled()){
733
				UnsuportedProtocolVersionExceptionType type =
734
					new UnsuportedProtocolVersionExceptionType();
735
				type.setLayerName(getName());
736
				try {
737
					type.setDriverName("WMS Driver");
738
				} catch (Exception ex){
739
				}
740
				type.setUrl(host);
741
				throw new DriverException(PluginServices.getText(this, "version_conflict"), e, type);
742
			}
753
//		} catch (UnsupportedVersionLayerException e) {
754
//			if (!c.isCanceled()){
755
//				UnsuportedProtocolVersionExceptionType type =
756
//					new UnsuportedProtocolVersionExceptionType();
757
//				type.setLayerName(getName());
758
//				try {
759
//					type.setDriverName("WMS Driver");
760
//				} catch (Exception ex){
761
//				}
762
//				type.setUrl(host);
763
//				throw new ReadDriverException(PluginServices.getText(this, "version_conflict"));
764
//			}
743 765
//	azabala		throw new DriverException(PluginServices.getText(this, "version_conflict"), e);
744 766
		} catch (IOException e) {
745 767
			if (!c.isCanceled())
......
758 780
					} catch (Exception e1) {
759 781
					}
760 782
					type.setHost(host);
761
					throw new DriverException(PluginServices.
762
							getText(this, "connect_error"), e, type);
783
					throw new ConnectionErrorLayerException(getName(),e);
763 784
//	azabala	throw new DriverException(PluginServices.getText(this, "connect_error"), e);
764 785
				} // mess code
765 786

  
......
774 795
				} // mess code
775 796
				if (callCount == 1) { // mess code
776 797
//		azabala			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), e.getMessage());
777
					WMSDriverExceptionType type = new WMSDriverExceptionType();
778
					type.setLayerName(getName());
779
					try {
780
						type.setDriverName("WMS Driver");
781
					} catch (Exception e1) {
782
					}
783
					type.setWcsStatus(this.wmsStatus);
798
//					WMSDriverExceptionType type = new WMSDriverExceptionType();
799
//					type.setLayerName(getName());
800
//					try {
801
//						type.setDriverName("WMS Driver");
802
//					} catch (Exception e1) {
803
//					}
804
//					type.setWcsStatus(this.wmsStatus);
784 805
					if (!isPrinting)
785 806
						this.setVisible(false);
786
					throw new DriverException("Error WMS", e,  type);
807
					throw new LoadLayerException(getName(),e);
787 808

  
788 809

  
789 810
				} // mess code
......
794 815

  
795 816
	/**
796 817
	 * This is the method used to draw a tile in a WMS mosaic layer.
818
	 * @throws LoadLayerException
819
	 * @throws ReadDriverException
797 820
	 */
798
	private void drawTile(Graphics2D g, ViewPort vp, Cancellable cancel) throws DriverException {
821
	private void drawTile(Graphics2D g, ViewPort vp, Cancellable cancel) throws LoadLayerException, ReadDriverException {
799 822
		callCount++;
800 823
		// Compute the query geometry
801 824
		// 1. Check if it is within borders
......
887 910

  
888 911
			if (!c.isCanceled())
889 912
			{
890
				UnknownResponseFormatExceptionType type =
891
					new UnknownResponseFormatExceptionType();
892
				type.setLayerName(getName());
893
				try {
894
					type.setDriverName("WMS Driver");
895
				} catch (Exception e1) {
896
					e1.printStackTrace();
897
				}
898
				type.setFormat(m_Format);
899
				type.setHost(host);
900
				type.setProtocol("WMS");
901
				DriverException exception = new DriverException("unknown_response_format", type);
913
//				UnknownResponseFormatExceptionType type =
914
//					new UnknownResponseFormatExceptionType();
915
//				type.setLayerName(getName());
916
//				try {
917
//					type.setDriverName("WMS Driver");
918
//				} catch (Exception e1) {
919
//					e1.printStackTrace();
920
//				}
921
//				type.setFormat(m_Format);
922
//				type.setHost(host);
923
//				type.setProtocol("WMS");
924
				LoadLayerException exception = new LoadLayerException(getName(),e);
902 925
				throw exception;
903 926
			}
904
		} catch (UnsupportedVersionException e) {
905

  
906
//			if (!c.isCanceled())
907
//				throw new DriverException(PluginServices.getText(this, "version_conflict"), e);
908

  
909
			if (!c.isCanceled()){
910
				UnsuportedProtocolVersionExceptionType type =
911
					new UnsuportedProtocolVersionExceptionType();
912
				type.setLayerName(getName());
913
				try {
914
					type.setDriverName("WMS Driver");
915
				} catch (Exception ex){
916
				}
917
				type.setUrl(host);
918
				throw new DriverException(PluginServices.getText(this, "version_conflict"), e, type);
919
			}
920

  
927
//		} catch (UnsupportedVersionLayerException e) {
928
//
929
////			if (!c.isCanceled())
930
////				throw new DriverException(PluginServices.getText(this, "version_conflict"), e);
931
//
932
//			if (!c.isCanceled()){
933
//				UnsuportedProtocolVersionExceptionType type =
934
//					new UnsuportedProtocolVersionExceptionType();
935
//				type.setLayerName(getName());
936
//				try {
937
//					type.setDriverName("WMS Driver");
938
//				} catch (Exception ex){
939
//				}
940
//				type.setUrl(host);
941
//				throw new DriverException(PluginServices.getText(this, "version_conflict"), e, type);
942
//			}
943
//
921 944
		} catch (IOException e) {
922 945
			/*azabala
923 946
			if (!c.isCanceled())
......
942 965
				} // mess code
943 966
			}
944 967
			if (callCount == 1) { // mess code
945
				ConnectionErrorExceptionType type = new ConnectionErrorExceptionType();
946
				type.setLayerName(getName());
947
				try {
948
					type.setDriverName("WMS Driver");
949
				} catch (Exception e1) {}
950
				type.setHost(host);
951
				throw new DriverException(PluginServices.
952
							getText(this, "connect_error"), e, type);
968
//				ConnectionErrorExceptionType type = new ConnectionErrorExceptionType();
969
//				type.setLayerName(getName());
970
//				try {
971
//					type.setDriverName("WMS Driver");
972
//				} catch (Exception e1) {}
973
//				type.setHost(host);
974
				throw new ConnectionErrorLayerException(getName(),e);
953 975
			}//if
954 976
		} catch (WMSException e) {
955 977
			/*azabala
......
986 1008
					type.setWcsStatus(this.wmsStatus);
987 1009
					if (!isPrinting)
988 1010
						this.setVisible(false);
989
					throw new DriverException("Error WMS", e,  type);
1011
					throw new LoadLayerException(getName(),e);
990 1012

  
991 1013

  
992 1014
				} //if
......
1090 1112
	 * 		com.iver.cit.gvsig.fmap.operations.Cancellable)
1091 1113
	 */
1092 1114
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties)
1093
		throws DriverException {
1115
		throws ReadDriverException {
1094 1116
		if (isVisible() && isWithinScale(scale)){
1095 1117
		isPrinting = true;
1096 1118
		if (!mustTilePrint) {
......
1110 1132
	        		drawTile(g, vp, cancel);
1111 1133
				} catch (NoninvertibleTransformException e) {
1112 1134
					e.printStackTrace();
1135
				} catch (LoadLayerException e) {
1136
					// TODO Auto-generated catch block
1137
					e.printStackTrace();
1113 1138
				}
1114 1139
	        }
1115 1140
		}
......
1118 1143
	}
1119 1144

  
1120 1145
	public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel,double scale)
1121
		throws DriverException {
1146
		throws ReadDriverException {
1122 1147
		draw(null, g, viewPort, cancel,scale);
1123 1148
	}
1124 1149

  
......
1129 1154
	 *
1130 1155
	 * @throws IllegalStateException
1131 1156
	 * @throws ValidationException
1132
	 * @throws UnsupportedVersionException
1157
	 * @throws UnsupportedVersionLayerException
1133 1158
	 * @throws IOException
1134 1159
	 */
1135 1160
	private FMapWMSDriver getDriver()
1136 1161
		throws IllegalStateException, ValidationException,
1137
			UnsupportedVersionException, IOException {
1162
			UnsupportedVersionLayerException, IOException {
1138 1163
		return FMapWMSDriverFactory.getFMapDriverForURL(host);
1139 1164
	}
1140 1165

  
......
1145 1170
	 *
1146 1171
	 * @throws IllegalStateException
1147 1172
	 * @throws ValidationException
1148
	 * @throws UnsupportedVersionException
1173
	 * @throws UnsupportedVersionLayerException
1149 1174
	 * @throws IOException
1150 1175
	 */
1151 1176
	public void setDriver(FMapWMSDriver drv) {
......
1577 1602
	 * layer(s).
1578 1603
	 * @param version, The desired version of the resulting document. (1.1.0)
1579 1604
	 * @return String containing the xml.
1580
	 * @throws UnsupportedVersionException
1605
	 * @throws UnsupportedVersionLayerException
1581 1606
	 */
1582 1607
	public String toMapContext(String mapContextVersion) {
1583 1608
		XmlBuilder xml = new XmlBuilder();
trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/exceptions/CannotReprojectException.java
1
package com.iver.cit.gvsig.fmap.exceptions;
2

  
3

  
4
/**
5
* <p>
6
* Exception thrown when requested projection is not supported by
7
* Cresques package. We can not reproject LatLon BBox to serve the
8
* layer in the requested coordenate system
9
* </p>
10
* @author Laura
11
*
12
*/
13
public class CannotReprojectException extends Exception {
14
   public CannotReprojectException(){
15
       super();
16
   }
17
   
18
   public CannotReprojectException(String message){
19
       super(message);
20
   }
21
   
22
	/**
23
	 * Create CanNotReprojectException.
24
	 *
25
	 * @param message
26
	 * @param cause
27
	 */
28
	public CannotReprojectException(String message, Throwable cause) {
29
		super(message, cause);
30
	}
31

  
32
	/**
33
	  * Crea CanNotReprojectException.
34
	 *
35
	 * @param cause
36
	 */
37
	public CannotReprojectException(Throwable cause) {
38
		super(cause);
39
	}   
40
}
trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/exceptions/CannotReprojectExceptionOld.java
1
package com.iver.cit.gvsig.fmap.exceptions;
2

  
3

  
4
/**
5
* <p>
6
* Exception thrown when requested projection is not supported by
7
* Cresques package. We can not reproject LatLon BBox to serve the
8
* layer in the requested coordenate system
9
* </p>
10
* @author Laura
11
*
12
*/
13
public class CannotReprojectExceptionOld extends Exception {
14
   public CannotReprojectExceptionOld(){
15
       super();
16
   }
17
   
18
   public CannotReprojectExceptionOld(String message){
19
       super(message);
20
   }
21
   
22
	/**
23
	 * Create CanNotReprojectException.
24
	 *
25
	 * @param message
26
	 * @param cause
27
	 */
28
	public CannotReprojectExceptionOld(String message, Throwable cause) {
29
		super(message, cause);
30
	}
31

  
32
	/**
33
	  * Crea CanNotReprojectException.
34
	 *
35
	 * @param cause
36
	 */
37
	public CannotReprojectExceptionOld(Throwable cause) {
38
		super(cause);
39
	}   
40
}
0 41

  
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/dialogs/WMSPropsDialog.java
54 54
import javax.swing.JPanel;
55 55
import javax.swing.tree.TreePath;
56 56

  
57
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
57 58
import com.iver.andami.PluginServices;
58 59
import com.iver.andami.ui.mdiManager.IWindow;
59 60
import com.iver.andami.ui.mdiManager.WindowInfo;
60
import com.iver.cit.gvsig.fmap.DriverException;
61
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException;
62
import com.iver.cit.gvsig.exceptions.layers.DriverLayerException;
63
import com.iver.cit.gvsig.exceptions.layers.LegendLayerException;
64
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
65
import com.iver.cit.gvsig.exceptions.layers.NameLayerException;
66
import com.iver.cit.gvsig.exceptions.layers.ProjectionLayerException;
67
import com.iver.cit.gvsig.exceptions.layers.TypeLayerException;
68
import com.iver.cit.gvsig.exceptions.layers.URLLayerException;
69
import com.iver.cit.gvsig.exceptions.layers.UnsupportedVersionLayerException;
70
import com.iver.cit.gvsig.exceptions.layers.XMLLayerException;
61 71
import com.iver.cit.gvsig.fmap.MapControl;
62
import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException;
63 72
import com.iver.cit.gvsig.fmap.layers.FLayer;
64 73
import com.iver.cit.gvsig.fmap.layers.FLayers;
65 74
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
......
218 227
                toc.refreshInfo();
219 228
                applied = false;
220 229
	            return toc;
221
	        } catch (DriverException ioe){
230
	        } catch (ConnectionErrorLayerException ioe){
222 231
	            JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE);
223 232
	        } catch (Exception e) {
224 233
	            e.printStackTrace();
......
297 306
            else{
298 307
            	try {
299 308
					((FLyrWMS) fLayer).setFullExtent(wmsParamsTabbedPane.getLayersRectangle());
300
				} catch (CannotReprojectException ex) {
309
				} catch (ProjectionLayerException ex) {
301 310
					ex.printStackTrace();
302
		        	JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage());
303
		        	return;
311
			        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage());
312
			        return;
304 313
				}
305
                ((FLyrWMS) fLayer).setFormat(wmsParamsTabbedPane.getFormat());
306

  
314
				((FLyrWMS) fLayer).setFormat(wmsParamsTabbedPane.getFormat());
315
                try {
307 316
                if (!wmsParamsTabbedPane.getDisagregatedLayers())
308 317
                	((FLyrWMS) fLayer).setLayerQuery(wmsParamsTabbedPane.getLayersQuery());
309 318
                ((FLyrWMS) fLayer).setInfoLayerQuery(wmsParamsTabbedPane.getQueryableLayerQuery());
......
318 327
            	FLayers parent = fLayer.getParentLayer();
319 328

  
320 329
                if (e.getActionCommand() == "APPLY"){
321
                    com.iver.cit.gvsig.project.documents.view.gui.View vista = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow();
330

  
331
                	com.iver.cit.gvsig.project.documents.view.gui.View vista = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow();
322 332
                    MapControl mapCtrl = vista.getMapControl();
323 333

  
324 334
                    if (parent != null){
325 335
                    	if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){
326
                    		mapCtrl.getMapContext().getLayers().
327
                    		replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer()));
336

  
337
								mapCtrl.getMapContext().getLayers().
338
								replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer()));
339

  
328 340
                    	}
329 341
                    }
330 342
                    else {
......
353 365
                    }
354 366
                    close();
355 367
                }
368
                } catch (ConnectionErrorLayerException e1) {
369
    				// TODO Auto-generated catch block
370
    				e1.printStackTrace();
371
    			} catch (DriverLayerException e1) {
372
    				// TODO Auto-generated catch block
373
    				e1.printStackTrace();
374
    			} catch (LegendLayerException e1) {
375
    				// TODO Auto-generated catch block
376
    				e1.printStackTrace();
377
    			} catch (NameLayerException e1) {
378
    				// TODO Auto-generated catch block
379
    				e1.printStackTrace();
380
    			} catch (ProjectionLayerException e1) {
381
    				// TODO Auto-generated catch block
382
    				e1.printStackTrace();
383
    			} catch (TypeLayerException e1) {
384
    				// TODO Auto-generated catch block
385
    				e1.printStackTrace();
386
    			} catch (UnsupportedVersionLayerException e1) {
387
    				// TODO Auto-generated catch block
388
    				e1.printStackTrace();
389
    			} catch (URLLayerException e1) {
390
    				// TODO Auto-generated catch block
391
    				e1.printStackTrace();
392
    			} catch (XMLLayerException e1) {
393
    				// TODO Auto-generated catch block
394
    				e1.printStackTrace();
395
    			} catch (LoadLayerException e1) {
396
    				// TODO Auto-generated catch block
397
    				e1.printStackTrace();
398
    			}
356 399
            }
357 400
		}
358 401
    }
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/WebMapContextSettingsPanel.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.18  2006-09-20 10:09:37  jaume
46
* Revision 1.19  2007-03-06 17:06:43  caballero
47
* Exceptions
48
*
49
* Revision 1.18  2006/09/20 10:09:37  jaume
47 50
* *** empty log message ***
48 51
*
49 52
* Revision 1.17  2006/09/20 07:45:21  caballero
......
124 127
import javax.swing.SwingConstants;
125 128
import javax.swing.filechooser.FileFilter;
126 129

  
130
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
127 131
import com.iver.andami.PluginServices;
128 132
import com.iver.andami.messages.NotificationManager;
129 133
import com.iver.andami.ui.mdiManager.SingletonWindow;
130 134
import com.iver.andami.ui.mdiManager.WindowInfo;
131
import com.iver.cit.gvsig.fmap.DriverException;
132 135
import com.iver.cit.gvsig.fmap.MapContext;
133 136
import com.iver.cit.gvsig.project.Project;
134 137
import com.iver.cit.gvsig.project.documents.view.ProjectView;
......
1063 1066
			// Bounding Box
1064 1067
			if (useFullExtent)
1065 1068
				try {
1066
				wmc.bBox = mc.getFullExtent();
1067
				} catch (DriverException dEx) {
1068
					NotificationManager.addError(dEx);
1069
					wmc.bBox = mc.getFullExtent();
1070
				} catch (ReadDriverException e) {
1071
					NotificationManager.addError(e);
1069 1072
					return;
1070 1073
				}
1071 1074
			else
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/WMSParamsPanel.java
75 75

  
76 76
import com.iver.andami.PluginServices;
77 77
import com.iver.andami.messages.NotificationManager;
78
import com.iver.cit.gvsig.exceptions.layers.ProjectionLayerException;
78 79
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
79 80
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
80
import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException;
81 81
import com.iver.cit.gvsig.fmap.layers.FLayer;
82 82
import com.iver.cit.gvsig.fmap.layers.FLayers;
83 83
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
......
867 867
		getJTxtNomCapa().setText(name);
868 868
	}
869 869

  
870
	public Rectangle2D getLayersRectangle() throws CannotReprojectException {
870
	public Rectangle2D getLayersRectangle() throws ProjectionLayerException {
871 871
		ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel())
872 872
				.getElements();
873 873
		WMSLayerNode[] layers = (WMSLayerNode[]) elements
......
898 898
				reprojectedRect = ct.convert(rect);
899 899
				rect = reprojectedRect;
900 900
			} else {
901
				throw new CannotReprojectException(PluginServices.getText(this,
902
						"cannotReproject")
903
						+ " " + getSRS() + " -> " + latLonID);
901
//				throw new ProjectionLayerException(PluginServices.getText(this,
902
//						"cannotReproject")
903
//						+ " " + getSRS() + " -> " + latLonID);
904
				throw new ProjectionLayerException(getName(),null);
904 905
			}
905 906
		}
906 907

  
......
1357 1358
			try {
1358 1359
				layer.setHost(new URL(dataSource.getHost()));
1359 1360
				layer.setFullExtent(getLayersRectangle());
1360
			} catch (CannotReprojectException e) {
1361
			} catch (ProjectionLayerException e) {
1361 1362
				e.printStackTrace();
1362 1363
				return null;
1363 1364
			} catch (MalformedURLException e) {
......
1460 1461
				try {
1461 1462
					layer.setHost(new URL(dataSource.getHost()));
1462 1463
					layer.setFullExtent(getLayersRectangle());
1463
				} catch (CannotReprojectException e) {
1464
				} catch (ProjectionLayerException e) {
1464 1465
					e.printStackTrace();
1465 1466
					return null;
1466 1467
				} catch (MalformedURLException e) {
......
1500 1501
		try {
1501 1502
			layer.setFullExtent(getLayersRectangle());
1502 1503
			layer.setHost(new URL(dataSource.getHost()));
1503
		} catch (CannotReprojectException ex) {
1504
		} catch (ProjectionLayerException ex) {
1504 1505
			ex.printStackTrace();
1505 1506
			JOptionPane.showMessageDialog((Component) PluginServices
1506 1507
					.getMainFrame(), ex.getMessage());
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizardData.java
52 52
import javax.swing.JOptionPane;
53 53

  
54 54
import com.iver.andami.PluginServices;
55
import com.iver.cit.gvsig.fmap.DriverException;
55
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException;
56 56
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
57 57
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriverFactory;
58 58
import com.iver.cit.gvsig.fmap.layers.WMSLayerNode;
......
82 82
        return wms.getHost();
83 83
    }
84 84

  
85
    public void setHost(URL host, boolean override) throws DriverException{
85
    public void setHost(URL host, boolean override) throws ConnectionErrorLayerException{
86 86
        try {
87 87
        	wms = FMapWMSDriverFactory.getFMapDriverForURL(host);
88 88

  
89 89
        	// Send a getCapabilities request;
90 90
        	if (!wms.connect(override, null))
91
        		throw new DriverException(PluginServices.getText(this, "wms_cant_connect") + host.toString());
91
        		throw new ConnectionErrorLayerException(layer.getName(),null);
92 92
        } catch (ConnectException e) {
93
        	JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout"));
94
			return;
93
        	throw new ConnectionErrorLayerException(layer.getName(),e);
94
        	//JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout"));
95
			//return;
95 96
		} catch (IOException e) {
96
			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "wms_cant_connect"));
97
			return;
97
			throw new ConnectionErrorLayerException(layer.getName(),e);
98
			//JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "wms_cant_connect"));
99
			//return;
98 100
		}
99 101
        if (wms.getAbstract()  != null)
100 102
            theAbstract = wms.getAbstract();
trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizard.java
63 63

  
64 64
import com.iver.andami.PluginServices;
65 65
import com.iver.andami.persistence.serverData.ServerDataPersistence;
66
import com.iver.cit.gvsig.exceptions.layers.ProjectionLayerException;
66 67
import com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver;
67
import com.iver.cit.gvsig.fmap.exceptions.CannotReprojectException;
68 68
import com.iver.cit.gvsig.fmap.layers.FLayer;
69 69
import com.iver.cit.gvsig.fmap.layers.FLayers;
70 70
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
......
146 146
		this.add(lblServerType, null);
147 147
		this.add(lblServerTypeValue, null);
148 148
		getPanelPage2().setVisible(true);
149
		
149

  
150 150
		connected = true;
151 151
	}
152 152

  
......
661 661
	 * DOCUMENT ME!
662 662
	 *
663 663
	 * @return DOCUMENT ME!
664
	 * @throws ProjectionLayerException
664 665
	 */
665
	public Rectangle2D getLayersRectangle() throws CannotReprojectException{
666
	public Rectangle2D getLayersRectangle() throws ProjectionLayerException{
666 667
		return wmsParamsPanel.getLayersRectangle();
667 668
	}
668 669

  
......
804 805
				layer.setHost(getHost());
805 806
				try {
806 807
					layer.setFullExtent(getLayersRectangle());
807
				} catch (CannotReprojectException e) {
808
				} catch (ProjectionLayerException e) {
808 809
					e.printStackTrace();
809 810
					return null;
810 811
				}
......
840 841
        layer.setHost(getHost());
841 842
        try{
842 843
        	layer.setFullExtent(getLayersRectangle());
843
        }catch(CannotReprojectException ex)
844
        }catch(ProjectionLayerException ex)
844 845
        {
845 846
        	ex.printStackTrace();
846 847
        	JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage());
trunk/extensions/extWMS/src/com/iver/cit/gvsig/wmc/ImportWebMapContextExtension.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.10  2006-11-28 11:46:59  cesar
46
* Revision 1.11  2007-03-06 17:06:43  caballero
47
* Exceptions
48
*
49
* Revision 1.10  2006/11/28 11:46:59  cesar
47 50
* Add support to persist the document internal layout
48 51
*
49 52
* Revision 1.9  2006/09/27 13:28:51  jaume
......
108 111
import com.iver.andami.plugins.Extension;
109 112
import com.iver.andami.ui.mdiManager.IWindow;
110 113
import com.iver.cit.gvsig.ProjectExtension;
111
import com.iver.cit.gvsig.fmap.drivers.UnsupportedVersionException;
114
import com.iver.cit.gvsig.exceptions.layers.UnsupportedVersionLayerException;
112 115
import com.iver.cit.gvsig.fmap.exceptions.ImportMapContextException;
113 116
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
114 117
import com.iver.cit.gvsig.gui.panels.WebMapContextFileChooserAccessory;
......
186 189
		WebMapContext wmc = new WebMapContext();
187 190
		try {
188 191
			wmc.readFile(wmcFile);
189
		} catch (UnsupportedVersionException e) {
192
		} catch (UnsupportedVersionLayerException e) {
190 193
			JOptionPane.showMessageDialog(
191 194
					(Component) PluginServices.getMainFrame(),
192 195
					e.getMessage(),
trunk/extensions/extWMS/src/com/iver/cit/gvsig/wmc/WebMapContext.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.8  2007-01-08 07:57:34  jaume
46
* Revision 1.9  2007-03-06 17:06:43  caballero
47
* Exceptions
48
*
49
* Revision 1.8  2007/01/08 07:57:34  jaume
47 50
* *** empty log message ***
48 51
*
49 52
* Revision 1.7  2006/09/26 14:41:48  jaume
......
126 129

  
127 130
import com.iver.andami.PluginServices;
128 131
import com.iver.andami.messages.NotificationManager;
132
import com.iver.cit.gvsig.exceptions.layers.UnsupportedVersionLayerException;
129 133
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
130
import com.iver.cit.gvsig.fmap.drivers.UnsupportedVersionException;
131 134
import com.iver.cit.gvsig.fmap.exceptions.ImportMapContextException;
132 135
import com.iver.cit.gvsig.fmap.layers.FLayer;
133 136
import com.iver.cit.gvsig.fmap.layers.FLayers;
......
246 249
	 * Initializes the WebMapContext properties from the values in the WebMapContext (.cml)
247 250
	 * file passed in the argument.
248 251
	 * @param file
249
	 * @throws UnsupportedVersionException
252
	 * @throws UnsupportedVersionLayerException
250 253
	 * @throws ImportMapContextException
251 254
	 */
252
	public void readFile(File file) throws UnsupportedVersionException, ImportMapContextException {
255
	public void readFile(File file) throws UnsupportedVersionLayerException, ImportMapContextException {
253 256
		this.mapContextFile = file;
254 257
		errorMessages = new StringBuffer();
255 258
		if (getVersion()!=null) {
......
269 272
				// Once parsed, check errors
270 273
				if (errorMessages.length()>0)
271 274
					throw new ImportMapContextException(errorMessages.toString(), false);
272
			} else throw new UnsupportedVersionException(PluginServices.getText(this, "file_version")+": "+getVersion());
275
			} else throw new UnsupportedVersionLayerException(file.getName(),null);
273 276
		}
274 277
	}
275 278

  
trunk/extensions/extWFS2/src-test/com/iver/cit/gvsig/fmap/layers/gml/GMLWriterTest.java
9 9
import org.cresques.cts.IProjection;
10 10

  
11 11
import com.hardcode.driverManager.DriverLoadException;
12
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
13
import com.hardcode.gdbms.driver.exceptions.SchemaEditionException;
12 14
import com.hardcode.gdbms.engine.values.Value;
13 15
import com.hardcode.gdbms.engine.values.ValueFactory;
14
import com.iver.cit.gvsig.fmap.DriverException;
16
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
17
import com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException;
18
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
19
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
15 20
import com.iver.cit.gvsig.fmap.core.FPolyline2D;
16 21
import com.iver.cit.gvsig.fmap.core.FShape;
17 22
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
......
23 28
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
24 29
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
25 30
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited;
26
import com.iver.cit.gvsig.fmap.edition.EditionException;
27 31
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
28 32
import com.iver.cit.gvsig.fmap.edition.writers.gml.GMLWriter;
29 33
import com.iver.cit.gvsig.fmap.layers.FLayer;
......
76 80
 *
77 81
 * $Id$
78 82
 * $Log$
79
 * Revision 1.4  2006-12-26 09:10:37  ppiqueras
83
 * Revision 1.5  2007-03-06 17:06:25  caballero
84
 * Exceptions
85
 *
86
 * Revision 1.4  2006/12/26 09:10:37  ppiqueras
80 87
 * Cambiado "atttibutes" en todas las aparaciones en atributos, métodos, clases o comentarios por "fields". (Sólo a aquellas que afectan a clases dentro del proyecto extWFS2).
81 88
 *
82 89
 * Revision 1.3  2006/10/02 09:09:45  jorpiell
......
95 102
 */
96 103
public class GMLWriterTest extends TestCase {
97 104
	private String gmlFile = "MUNIC.gml";
98
	
105

  
99 106
	protected void setUp(){
100 107
		LayerFactory.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
101 108
		LayerFactory.setWritersPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
......
109 116
		}
110 117
		System.out.println("****************COMENZANDO****************");
111 118
	}
112
	
113
	public void test1() throws DriverLoadException, DriverException, EditionException, DriverIOException, com.hardcode.gdbms.engine.data.driver.DriverException{
119

  
120
	public void test1() throws DriverLoadException, ReadDriverException, StartWriterVisitorException, SchemaEditionException, ProcessWriterVisitorException, ExpansionFileReadException, StopWriterVisitorException {
114 121
        // DRIVER DEFINITION (SHAPE TYPE AND FIELDS)
115 122
        ConcreteMemoryDriver driver = new ConcreteMemoryDriver();
116 123
        driver.setShapeType(FShape.LINE);
117
        
124

  
118 125
        ArrayList arrayFields = new ArrayList();
119 126
        arrayFields.add("ID");
120 127
        Value[] auxRow = new Value[1];
121
  
128

  
122 129
        driver.getTableModel().setColumnIdentifiers(arrayFields.toArray());
123
                
130

  
124 131
        //GEOMETRY DEFINITION
125 132
        GeneralPathX gp = new GeneralPathX();
126
        
133

  
127 134
        gp.moveTo(20,80);
128 135
        gp.lineTo(80,60);
129 136
        gp.lineTo(100, 140);
130
        
137

  
131 138
        FShape shp = new FPolyline2D(gp);
132
        
133
        
139

  
140

  
134 141
        // ATRIBUTES
135 142
        auxRow[0] = ValueFactory.createValue(0);
136
        
143

  
137 144
        // ADD RECORD
138 145
        driver.addShape(shp, auxRow);
139
         
146

  
140 147
        //GEOMETRY DEFINITION
141 148
        gp = new GeneralPathX();
142
        
149

  
143 150
        gp.moveTo(20,80);
144 151
        gp.lineTo(80,60);
145 152
        gp.lineTo(100, 140);
146
        
153

  
147 154
        shp = new FPolyline2D(gp);
148
        
149
        
155

  
156

  
150 157
        // ATRIBUTES
151 158
        auxRow[0] = ValueFactory.createValue(1);
152
        
159

  
153 160
        // ADD RECORD
154 161
        driver.addShape(shp, auxRow);
155 162

  
156 163
        // CREATE AND ADD LAYER
157 164
        FLyrVect lyr;
158 165
        String layerName = "Example";
159
       	lyr = (FLyrVect) LayerFactory.createLayer(layerName,driver, CRSFactory.getCRS("EPSG:4326"));           	
160
		
161
       	       	
166
       	lyr = (FLyrVect) LayerFactory.createLayer(layerName,driver, CRSFactory.getCRS("EPSG:4326"));
167

  
168

  
162 169
       	SHPLayerDefinition lyrDef = new SHPLayerDefinition();
163 170
		SelectableDataSource sds = lyr.getRecordset();
164 171
		FieldDescription[] fieldsDescrip = sds.getFieldsDescription();
165 172
		lyrDef.setFieldsDesc(fieldsDescrip);
166 173
		lyrDef.setName(lyr.getName());
167
       	
174

  
168 175
		File newFile = new File(gmlFile);
169
		
176

  
170 177
		GMLWriter writer = (GMLWriter)LayerFactory.getWM().getWriter("GML Writer");
171 178
		writer.setFile(new File(gmlFile));
172
		writer.setSchema(lyrDef);		
179
		writer.setSchema(lyrDef);
173 180
		Rectangle2D rectangle = new Rectangle2D.Double(0,
174 181
				0,
175 182
				100,
176
				100);		
183
				100);
177 184
		writer.setBoundedBy(rectangle,CRSFactory.getCRS("EPSG:23030"));
178
		
185

  
179 186
		writer.preProcess();
180
		
187

  
181 188
		ReadableVectorial adapter = lyr.getSource();
182 189
		for (int i=0; i < adapter.getShapeCount(); i++){
183 190
			IFeature feat = adapter.getFeature(i);
184 191
			IRowEdited editFeat = new DefaultRowEdited(feat, IRowEdited.STATUS_MODIFIED, i);
185 192
			writer.process(editFeat);
186 193
		}
187
		writer.postProcess();		
194
		writer.postProcess();
188 195
	}
189
	
190 196

  
191
	
197

  
198

  
192 199
	private static FLayer createLayer(String layerName, VectorialFileDriver d,
193
			File f, IProjection proj) throws DriverException {
200
			File f, IProjection proj) {
194 201
			//TODO Comprobar si hay un adaptador ya
195 202
			VectorialFileAdapter adapter = new VectorialFileAdapter(f);
196 203
			adapter.setDriver(d);
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java
40 40
import org.gvsig.remoteClient.gml.schemas.XMLElement;
41 41
import org.gvsig.remoteClient.gml.types.IXMLType;
42 42

  
43
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
43 44
import com.hardcode.gdbms.engine.data.driver.DriverException;
44 45
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException;
45 46
import com.hardcode.gdbms.engine.values.BooleanValue;
......
119 120
/**
120 121
 * This will be the tab for add a filter to a WFS query.
121 122
 * This class gets the graphical interface from FilterQueryJPanel and add logic.
122
 * 
123
 *
123 124
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
124 125
 */
125 126
public class WFSFilterPanel extends FilterQueryJPanel {
......
134 135
	private TreePath currentPath;
135 136
	private String featureName;
136 137
	private Map allFieldsAndValuesKnownOfCurrentLayer; // This will have all values (not repeated) known of all fields (not repeated)
137
	
138

  
138 139
	///// GUI METHODS ////
139
	
140

  
140 141
	/**
141 142
	 * This method initializes
142
	 * 
143
	 *
143 144
	 * @param parent A reference to the parent container component of this component
144 145
	 */
145 146
	public WFSFilterPanel(WFSParamsPanel parent) {
......
153 154
		super.getValuesJList().setEnabled(false);
154 155
		getValuesJList().setBackground(new Color(220, 220, 220));
155 156
	}
156
	
157

  
157 158
	/*
158 159
	 *  (non-Javadoc)
159 160
	 * @see org.gvsig.gui.beans.filterPanel.AbstractFilterQueryJPanel#initialize()
......
163 164
		this.resizeHeight(380);
164 165

  
165 166
		defaultTreeModel = (DefaultTreeModel)fieldsJTree.getModel();
166
		
167

  
167 168
		this.addNewListeners();
168 169
		panelAsATabForWFSLayersLoad = true;
169 170
		getValidateFilterExpressionJCheckBox().setSelected(true);
170
		
171

  
171 172
		getValuesJLabel().setToolTipText(Messages.getText("values_of_the_selected_field_explanation"));
172 173
		getFieldsJLabel().setToolTipText(Messages.getText("fields_of_the_selected_feature_explanation"));
173 174
	}
174
	
175

  
175 176
	/**
176 177
	 * Adds some more listener to the components of the panel
177 178
	 */
178 179
	private void addNewListeners() {
179
		
180

  
180 181
		// Enable "Apply" button when user changes the filter query
181 182
		txtExpression.getDocument().addDocumentListener(new DocumentListener() {
182 183
			/*
......
204 205
					parent.isApplicable(true);
205 206
			}
206 207
		});
207
		
208
		// Listener for "fieldsJTree" 
208

  
209
		// Listener for "fieldsJTree"
209 210
		getFieldsJTree().addMouseListener(new MouseAdapter() {
210 211
			/*
211 212
			 *  (non-Javadoc)
......
217 218

  
218 219
				if (row > -1) {
219 220
					switch (e.getClickCount()) {
220
						case 2:							
221
						case 2:
221 222
							putSymbolOfSelectedByMouseBranch(treePath);
222 223
							break;
223 224
					}
224 225
				}
225 226
			}
226 227
		});
227
		
228

  
228 229
		// Listener for "valuesJList"
229 230
		getValuesJList().addMouseListener(new MouseAdapter() {
230 231
			/*
......
233 234
			 */
234 235
			public void mouseClicked(MouseEvent e) {
235 236
				int index = getValuesJList().getSelectedIndex();
236
				
237

  
237 238
				// Avoids exception when no value is in the list
238 239
				if (index == -1)
239 240
					return;
240
					
241

  
241 242
				if (e.getClickCount() == 2){
242 243
					String valor = ((JLabel) valuesListModel.getElementAt(index)).getText();
243
					
244

  
244 245
					// If value is an string -> set it between apostrophes
245 246
					if (getNodeOfCurrentPath().getEntityType().getName().compareTo("xs:string") == 0) {
246 247
						putSymbol("'" + valor + "'");
......
251 252
				}
252 253
			}
253 254
		});
254
		
255

  
255 256
		// Listener for a branch of the tree selection
256 257
		getFieldsJTree().addTreeSelectionListener(new TreeSelectionListener() {
257 258
			/*
......
259 260
			 * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
260 261
			 */
261 262
			public void valueChanged(TreeSelectionEvent e) {
262
				if (!panelAsATabForWFSLayersLoad) {					
263
				if (!panelAsATabForWFSLayersLoad) {
263 264
					DataReturnedOfDataLoadingFromActiveView data = DataLoadingFromActiveView.getDefaultExpressionDataSource();
264
		
265

  
265 266
					if ((data != null) && (data.getData() != null)) {
266 267
//						setModel(data.getData());
267 268
						currentPath = e.getPath();
268 269
						fillValuesByPath(currentPath);
269 270
					}
270 271
				}
271
			}			
272
			}
272 273
		});
273
		
274

  
274 275
		// Listener: when a user writes something on the textarea -> set it's foreground color to black
275 276
		getTxtExpression().getDocument().addDocumentListener(new DocumentListener() {
276 277
			/*
......
292 293
			 *  (non-Javadoc)
293 294
			 * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
294 295
			 */
295
			public void removeUpdate(DocumentEvent e) {				
296
			public void removeUpdate(DocumentEvent e) {
296 297
				getTxtExpression().setForeground(Color.BLACK);
297
			}			
298
			}
298 299
		});
299
		
300

  
300 301
//		// Listener: if user wants or not that the filter expression would be validated
301 302
//		getValidateFilterExpressionJCheckBox().addItemListener(new ItemListener() {
302 303
//			/*
......
313 314
//			}
314 315
//		});
315 316
	}
316
	
317

  
317 318
	/**
318 319
	 * Gets the element that the 'currentPath' field aims
319
	 * 
320
	 *
320 321
	 * @return An XMLElement
321 322
	 */
322 323
	private XMLElement getNodeOfCurrentPath() {
323
		
324

  
324 325
		if (currentPath != null) {
325 326
			Object node = currentPath.getLastPathComponent();
326
			
327

  
327 328
			if ((node != null) && (node instanceof XMLElement)) {
328 329
				return (XMLElement) node;
329 330
			}
330 331
		}
331
		
332

  
332 333
		return null;
333 334
	}
334
	
335

  
335 336
	/**
336 337
	 * Puts the symbol of selected brach
337
	 * 
338
	 *
338 339
	 * @param mouseEvent A MouseEvent with information  of the selected branch
339 340
	 */
340 341
	public void putSymbolOfSelectedByMouseBranch(TreePath treePath) {
......
343 344
			putSymbol("\"" + this.getPathOfLeafWithoutRoot(treePath.getLastPathComponent()) + "\"");
344 345
		}
345 346
	}
346
	
347

  
347 348
	/**
348 349
	 * This method returns the path of a node of a tree
349 350
	 * Each node is separated from its parent with the symbol "/"
350
	 * 
351
	 * @param node A node of a 
351
	 *
352
	 * @param node A node of a
352 353
	 * @return An string with the path
353 354
	 */
354 355
	private String getPathOfLeaf(Object node) {
355 356
		String path = "";
356
		
357

  
357 358
		if ((node != null) && (node instanceof XMLElement)) {
358 359
			XMLElement element = (XMLElement) node;
359 360
			XMLElement parent = element.getParentElement();
360 361
			path = element.getName();
361
		
362

  
362 363
			while (parent != null){
363 364
				path = parent.getName() + "/" + path;
364 365
				parent = parent.getParentElement();
365 366
			}
366 367
		}
367
			
368

  
368 369
		return path;
369 370
	}
370
	
371

  
371 372
	/**
372 373
	 * This method returns the path without the root, of a node of a tree
373 374
	 * Each node is separated from its parent with the symbol "/"
374
	 * 
375
	 * @param node A node of a 
375
	 *
376
	 * @param node A node of a
376 377
	 * @return An string with the path
377 378
	 */
378 379
	private String getPathOfLeafWithoutRoot(Object node) {
379 380
		String path = "";
380
		
381

  
381 382
		if ((node != null) && (node instanceof XMLElement)) {
382 383
			XMLElement element = (XMLElement) node;
383 384
			XMLElement parent = element.getParentElement();
384 385
			path = element.getName();
385
		
386

  
386 387
			while (parent.getParentElement() != null){
387 388
				path = parent.getName() + "/" + path;
388 389
				parent = parent.getParentElement();
389 390
			}
390 391
		}
391
			
392

  
392 393
		return path;
393 394
	}
394
	
395

  
395 396
	/**
396 397
	 * Gets the value of the inner attribute: 'panelAsATabForWFSLayersLoad'
397
	 * 
398
	 *
398 399
	 * @return A boolean value
399 400
	 */
400 401
	public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() {
401 402
		return this.panelAsATabForWFSLayersLoad;
402 403
	}
403
	
404

  
404 405
	/**
405 406
	 * Sets the value of the inner attribute: 'panelAsATabForWFSLayersLoad'
406
	 * 
407
	 *
407 408
	 * @param b A boolean value
408 409
	 */
409 410
	public void setWFSFilterPanelIsAsTabForWFSLayersLoad (boolean b) {
410 411
		this.panelAsATabForWFSLayersLoad = b;
411
		
412

  
412 413
		if (this.panelAsATabForWFSLayersLoad == true) {
413 414
			// At beginning, the JList is disabled (and its set a particular color for user could knew it)
414 415
			super.getValuesJList().setEnabled(false);
415 416
			super.getValuesJList().setBackground(new Color(220, 220, 220)); // a grey color
416
			
417

  
417 418
			this.allFieldsAndValuesKnownOfCurrentLayer.clear();
418 419
			getValidateFilterExpressionJCheckBox().setSelected(true);
419 420
		}
......
423 424
				this.currentPath = null;
424 425
				this.getFieldsJTree().removeSelectionPath(this.getFieldsJTree().getSelectionPath());
425 426
			}
426
			
427

  
427 428
			// Resets data loaded
428 429
			super.getValuesJList().setEnabled(true);
429 430
			super.getValuesJList().setBackground(Color.WHITE);
430
			
431

  
431 432
			this.getFieldsJTree().removeAll();
432 433
			this.getValuesJList().removeAll();
433
			
434

  
434 435
			// Updates data associated to view with the new layer data
435 436
			this.setNewDataToTable();
436
			
437

  
437 438
			// If theres is any table associated to the current view -> update that table/s
438 439
//			this.updateTablesThatHasNewData();
439
			
440

  
440 441
			// Reads that new data
441 442
			DataReturnedOfDataLoadingFromActiveView data = DataLoadingFromActiveView.getDefaultExpressionDataSource();
442
			
443

  
443 444
			if ((data != null) && (data.getData() != null)) {
444 445
				setModel(data.getData());
445 446
//				currentPath = e.getPath();
446 447
//				fillValuesByPath(currentPath);
447 448
			}
448
			
449

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff