Revision 21299

View differences:

branches/v2_0_0_prep/applications/appgvSIG/.classpath
7 7
	<classpathentry kind="lib" path="/libFMap/lib/units-0.01.jar"/>
8 8
	<classpathentry kind="lib" path="/libFMap/lib/geoapi-2.0.jar"/>
9 9
	<classpathentry kind="lib" path="/_fwAndami/lib/castor-0.9.5.3-xml.jar"/>
10
	<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/libIverUtiles/src"/>
10
	<classpathentry sourcepath="/libIverUtiles/src" kind="lib" path="/_fwAndami/lib/iver-utiles.jar"/>
11 11
	<classpathentry kind="lib" path="/_fwAndami/lib/log4j-1.2.8.jar"/>
12 12
	<classpathentry kind="lib" path="/_fwAndami/lib/xerces_2_5_0.jar"/>
13 13
	<classpathentry kind="lib" path="/_fwAndami/lib/xml-apis.jar"/>
......
29 29
	<classpathentry kind="lib" path="/libFMap/lib/batik-util.jar"/>
30 30
	<classpathentry kind="lib" path="/libFMap/lib/xml-apis-ext.jar"/>
31 31
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
32
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/>
33
	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip"/>
32
	<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"/>
34 33
	<classpathentry kind="lib" path="/libFMap/lib/jecw-0.0.5.jar"/>
35 34
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap_data"/>
36 35
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap_geometries"/>
36
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap_mapcontext"/>
37
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap_mapcontrol"/>
38
	<classpathentry combineaccessrules="false" kind="src" path="/libMetadata"/>
37 39
	<classpathentry kind="output" path="bin"/>
38 40
</classpath>
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/ProjectDocument.java
49 49
import java.util.Iterator;
50 50

  
51 51
import org.gvsig.data.ReadException;
52
import org.gvsig.fmap.drivers.reading.DriverIOException;
53 52
import org.gvsig.fmap.mapcontext.layers.XMLException;
54 53

  
55
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
56
import com.hardcode.gdbms.engine.data.driver.DriverException;
57 54
import com.iver.andami.PluginServices;
58 55
import com.iver.andami.messages.NotificationManager;
59 56
import com.iver.andami.ui.mdiManager.IWindow;
......
290 287
	 * @throws ReadDriverException
291 288
	 */
292 289
	public void setXMLEntity(XMLEntity xml)
293
		throws XMLException, OpenException, ReadDriverException{
290
		throws XMLException, OpenException{
294 291

  
295 292
		this.setComment(xml.getStringProperty("comment"));
296 293
		this.setCreationDate(xml.getStringProperty("creationDate"));
......
302 299
	/**
303 300
	 * DOCUMENT ME!
304 301
	 *
305
	 * @param xml DOCUMENT ME!
306
	 * @param p DOCUMENT ME!
307
	 *
308
	 * @throws XMLException
309
	 * @throws ReadDriverException
310
	 * @throws DriverIOException
311
	 */
312
	public void setXMLEntity03(XMLEntity xml)
313
		throws XMLException, ReadDriverException{
314

  
315
			this.setComment(xml.getStringProperty("comment"));
316
			this.setCreationDate(xml.getStringProperty("creationDate"));
317
			this.setName(xml.getStringProperty("name"));
318
			this.setOwner(xml.getStringProperty("owner"));
319

  
320
		}
321

  
322
	/**
323
	 * DOCUMENT ME!
324
	 *
325 302
	 * @return DOCUMENT ME!
326 303
	 */
327 304
	public Project getProject() {
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/table/gui/tablemodel/DataSourceDataModel.java
1 1
package com.iver.cit.gvsig.project.documents.table.gui.tablemodel;
2 2

  
3
import java.awt.Component;
4
import java.sql.Types;
5
import java.text.ParseException;
6 3
import java.util.Date;
7 4

  
8
import javax.swing.JOptionPane;
9 5
import javax.swing.table.AbstractTableModel;
10 6

  
11 7
import org.apache.log4j.Logger;
12
import org.gvsig.fmap.core.features.DefaultFeature;
13
import org.gvsig.fmap.core.features.DefaultRow;
14
import org.gvsig.fmap.core.features.IFeature;
15
import org.gvsig.fmap.core.features.IRow;
16
import org.gvsig.fmap.core.features.IRowEdited;
17
import org.gvsig.fmap.core.geometries.IGeometry;
18
import org.gvsig.fmap.drivers.exceptions.ValidateRowException;
19
import org.gvsig.fmap.drivers.writing.EditionEvent;
20
import org.gvsig.fmap.drivers.writing.IEditableSource;
8
import org.gvsig.data.ReadException;
9
import org.gvsig.data.vectorial.Feature;
10
import org.gvsig.data.vectorial.FeatureCollection;
11
import org.gvsig.data.vectorial.FeatureStore;
21 12
import org.gvsig.fmap.mapcontext.layers.FLayer;
22 13

  
23
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
24
import com.hardcode.gdbms.engine.values.DateValue;
25
import com.hardcode.gdbms.engine.values.Value;
26
import com.hardcode.gdbms.engine.values.ValueFactory;
27
import com.iver.andami.PluginServices;
28 14
import com.iver.cit.gvsig.project.documents.table.ProjectTable;
29 15

  
30 16
/**
......
37 23
	//private SelectableDataSource dataSource;
38 24
    ProjectTable pt;
39 25
    boolean hasAssociatedLayer=false;
40
    private IRowEdited lastRowEdited;
26
    private Feature lastRowEdited;
41 27
	private int lastNumRow=-1;
42 28
    /**
43 29
     * Crea un nuevo DataSourceDataModel.
......
91 77
     */
92 78
    public int getRowCount() {
93 79
        try {
94
        	IEditableSource des = pt.getModelo();
95
            return des.getRowCount();
96
        } catch (ReadDriverException e) {
80
        	FeatureStore fs = pt.getModelo();
81
            return ((FeatureCollection)fs.getDataCollection()).size();
82
        } catch (ReadException e) {
97 83
            return 0;
98 84
        }
99 85
    }
......
107 93
     * @return DOCUMENT ME!
108 94
     */
109 95
    public Object getValueAt(int row, int col) {
110
    	IEditableSource ies=pt.getModelo();
96
    	FeatureStore fs=pt.getModelo();
111 97
    	if (hasAssociatedLayer) {
112 98
    		Object stoppingEditing =((FLayer)pt.getAssociatedTable()).getProperty("stoppingEditing");
113 99

  
114 100
    		if (stoppingEditing != null && ((Boolean)(stoppingEditing)).booleanValue()) {
115
    			return ValueFactory.createValue("");
101
    			return new String("");
116 102
    		}
117 103
    	}
118 104
//       if (col==0){
......
127 113
    	   numRow=row;
128 114
       }
129 115
       Object obj =null;
130
    	try {
131
    		if (hasAssociatedLayer)
132
    			ies.getRecordset().start();
133
    		IRowEdited rowEdited=null;
116
////TODO    	try {
117
//    		if (hasAssociatedLayer)
118
//    			fs.getRecordset().start();
119
    		Feature rowEdited=null;
134 120
			if (lastNumRow==numRow){
135 121
				rowEdited=lastRowEdited;
136 122
			}else{
137
				rowEdited=ies.getRow(numRow);
123
//////////////TODO				rowEdited=fs.getFeatureByID(numRow);
138 124
				lastRowEdited=rowEdited;
139 125
				lastNumRow=numRow;
140 126
			}
141
    		obj= rowEdited.getAttribute(pt.getMapping()[col]);
127
    		obj= rowEdited.get(pt.getMapping()[col]);
142 128

  
143 129
			//CHEMA: Problema con las fechas:
144 130
			// Esto deberia solucionarse en el ValueFactory.createValueByType
145
			if (obj instanceof DateValue) {
146
				Date date = ((DateValue) obj).getValue();
131
			if (obj instanceof Date) {
132
				Date date = (Date) obj;
147 133

  
148 134
				String str = "" + (date.getMonth() +1) + "/" + date.getDate()+ "/" +(date.getYear() +1900);
149
				obj =  ValueFactory.createValue(str);
135
				obj =  str;
150 136

  
151 137
			}
152 138

  
......
155 141
//			if (hasAssociatedLayer)
156 142
//				pt.getModelo().getRecordset().stop();
157 143
//			return obj;
158
		} catch (ReadDriverException e1) {
159
			logger.error("Error reading data row= "+row+" column= "+col,e1);
160
			obj= ValueFactory.createValue("");
161
		}
162
		if (hasAssociatedLayer)
163
			try {
164
				ies.getRecordset().stop();
165
			} catch (ReadDriverException e1) {
166
				logger.error("Error reading data row= "+row+" column= "+col,e1);
167
				obj= ValueFactory.createValue("");
168
			}
144
////TODO		} catch (ReadException e1) {
145
////			logger.error("Error reading data row= "+row+" column= "+col,e1);
146
////			obj= new String("");
147
////		}
148
//		if (hasAssociatedLayer)
149
//			try {
150
//				ies.getRecordset().stop();
151
//			} catch (ReadDriverException e1) {
152
//				logger.error("Error reading data row= "+row+" column= "+col,e1);
153
//				obj= ValueFactory.createValue("");
154
//			}
169 155
		return obj;
170 156
    }
171 157

  
......
180 166
    public boolean isCellEditable(int rowIndex, int columnIndex) {
181 167
//    	if (columnIndex==0)
182 168
//            return false;
183
    	try {
184
			if (pt.getModelo().getRecordset().getFieldType(columnIndex)==Types.STRUCT)
185
				return true;
186
		} catch (ReadDriverException e) {
187
			e.printStackTrace();
188
		}
169
//    	try {
170
//			if (pt.getModelo().getFieldType(columnIndex)==Types.STRUCT)
171
//				return true;
172
//		} catch (ReadDriverException e) {
173
//			e.printStackTrace();
174
//		}
189 175
    	return pt.getModelo().isEditing();
190 176
    }
191 177

  
......
202 188
//    	 if (columnIndex==0)
203 189
//             throw new UnsupportedOperationException("Row Number is a read-only column");
204 190
//    	 columnIndex--;
205
    	Value v;
206
    	 int numRow;
207
         if (pt.getOrderIndexes() != null) {
208
      	   numRow=(int)pt.getOrderIndexes()[rowIndex];
209
         }else {
210
      	   numRow=rowIndex;
211
         }
212
    	if (getValueAt(rowIndex,columnIndex)==null || getValueAt(rowIndex,columnIndex).toString().equals(aValue))
213
        	return;
214
        try {
215
        	IEditableSource des = pt.getModelo();
216
        	try{
217
        	v = ValueFactory.createValueByType(aValue.toString(),
218
                    des.getRecordset().getFieldType(columnIndex));
219
            } catch (ParseException e) {
220
            	if (aValue.equals("")){
221
            		v = ValueFactory.createNullValue();
222
            	} else {
223
            		JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),"formato_del_campo_incorrecto");
224
            		return;
225
            	}
226
        	}
227
            IRowEdited row = des.getRow(numRow); //.getAttribute(columnIndex);
228
            Value[] values = row.getAttributes();
229
            values[columnIndex] = v;
230

  
231
            IRow newRow = null;
232

  
233
            if (row.getLinkedRow() instanceof IFeature) {
234
                IGeometry geometry = ((DefaultFeature) row.getLinkedRow()).getGeometry();
235
                newRow = new DefaultFeature(geometry, values,row.getID());
236
            } else {
237
                newRow = new DefaultRow(values,row.getID());
238
            }
239

  
240
            des.modifyRow(numRow, newRow,"Editar valor", EditionEvent.ALPHANUMERIC);
241
        } catch (ReadDriverException e1) {
242
            throw new RuntimeException(e1);
243
        } catch (NumberFormatException e) {
244
		/*	NotificationManager.addError(PluginServices.-getText(this,"numero_incorrecto")+
245
					"\n"+PluginServices.-getText(this,"fila")+" = "+rowIndex+
246
					"\n"+PluginServices.-getText(this,"columna")+ " = "+columnIndex,e);
247
		*/
248
		} catch (ValidateRowException e) {
249
			 throw new RuntimeException(e);
250
		}
191
//    	Object v;
192
//    	 int numRow;
193
//         if (pt.getOrderIndexes() != null) {
194
//      	   numRow=(int)pt.getOrderIndexes()[rowIndex];
195
//         }else {
196
//      	   numRow=rowIndex;
197
//         }
198
//    	if (getValueAt(rowIndex,columnIndex)==null || getValueAt(rowIndex,columnIndex).toString().equals(aValue))
199
//        	return;
200
//        try {
201
//        	FeatureStore fs = pt.getModelo();
202
//        	try{
203
//        	v = ValueFactory.createValueByType(aValue.toString(),
204
//                    des.getRecordset().getFieldType(columnIndex));
205
//            } catch (ParseException e) {
206
//            	if (aValue.equals("")){
207
//            		v = ValueFactory.createNullValue();
208
//            	} else {
209
//            		JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),"formato_del_campo_incorrecto");
210
//            		return;
211
//            	}
212
//        	}
213
//            IRowEdited row = des.getRow(numRow); //.getAttribute(columnIndex);
214
//            Value[] values = row.getAttributes();
215
//            values[columnIndex] = v;
216
//
217
//            IRow newRow = null;
218
//
219
//            if (row.getLinkedRow() instanceof IFeature) {
220
//                IGeometry geometry = ((DefaultFeature) row.getLinkedRow()).getGeometry();
221
//                newRow = new DefaultFeature(geometry, values,row.getID());
222
//            } else {
223
//                newRow = new DefaultRow(values,row.getID());
224
//            }
225
//
226
//            des.modifyRow(numRow, newRow,"Editar valor", EditionEvent.ALPHANUMERIC);
227
//        } catch (ReadDriverException e1) {
228
//            throw new RuntimeException(e1);
229
//        } catch (NumberFormatException e) {
230
//		/*	NotificationManager.addError(PluginServices.-getText(this,"numero_incorrecto")+
231
//					"\n"+PluginServices.-getText(this,"fila")+" = "+rowIndex+
232
//					"\n"+PluginServices.-getText(this,"columna")+ " = "+columnIndex,e);
233
//		*/
234
//		} catch (ValidateRowException e) {
235
//			 throw new RuntimeException(e);
236
//		}
251 237
    }
252 238
}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/FLyrVectEditPropertiesTocMenuEntry.java
4 4

  
5 5
import org.gvsig.fmap.mapcontext.layers.FLayer;
6 6
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
7
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrAnnotation;
8 7
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
9 8

  
10 9
import com.iver.andami.PluginServices;
......
126 125
            if ((lyr instanceof ClassifiableVectorial)) {
127 126
            	if (!((lyr instanceof FLyrVect) &&
128 127
            			!((FLyrVect)lyr).isPropertiesMenuVisible())){
129
            		if (!(lyr instanceof FLyrAnnotation))
130
            			return true;
128
//            		if (!(lyr instanceof FLyrAnnotation))
129
//            			return true;
131 130
            	}
132 131

  
133 132
            }
......
146 145
		if (actives[0].isAvailable()) {
147 146
			fThemeManagerWindow = new ThemeManagerWindow(actives[0]);
148 147
		}
149
		
148

  
150 149
		if (PluginServices.getMainFrame() == null) {
151 150
			JDialog dlg = new JDialog();
152 151
			fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
......
159 158
			System.err.println("open properties dialog time: "+(System.currentTimeMillis()-t1));
160 159
			PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
161 160
		}
162
		
161

  
163 162
		Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
164 163
		project.setModified(true);
165 164
	}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/CopyPasteLayersUtiles.java
2 2

  
3 3
import java.util.ArrayList;
4 4

  
5
import org.gvsig.data.ReadException;
5 6
import org.gvsig.fmap.mapcontext.layers.CancelationException;
6 7
import org.gvsig.fmap.mapcontext.layers.FLayer;
7 8
import org.gvsig.fmap.mapcontext.layers.FLayers;
......
9 10
import org.gvsig.fmap.mapcontext.layers.XMLException;
10 11
import org.gvsig.fmap.mapcontext.layers.operations.AlphanumericData;
11 12

  
12
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
13
import com.hardcode.gdbms.engine.data.DataSourceFactory;
14
import com.hardcode.gdbms.engine.data.SourceInfo;
15 13
import com.iver.andami.PluginServices;
16 14
import com.iver.cit.gvsig.ProjectExtension;
17 15
import com.iver.cit.gvsig.Version;
......
276 274
		} catch (SaveException e) {
277 275
			e.printStackTrace();
278 276
			return false;
279
		} catch (ReadDriverException e) {
277
		} catch (ReadException e) {
280 278
			e.printStackTrace();
281 279
			return false;
282 280
		}
......
311 309

  
312 310
            }
313 311

  
314
		} catch (ReadDriverException e) {
312
		} catch (ReadException e) {
315 313
			// TODO Auto-generated catch block
316 314
			e.printStackTrace();
317 315
			return false;
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/ZoomAlTemaTocMenuEntry.java
2 2

  
3 3
import java.awt.geom.Rectangle2D;
4 4

  
5
import org.gvsig.fmap.drivers.exceptions.ExpansionFileReadException;
5
import org.gvsig.data.ReadException;
6 6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7 7

  
8
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
9 8
import com.iver.andami.PluginServices;
10 9
import com.iver.cit.gvsig.ProjectExtension;
11 10
import com.iver.cit.gvsig.project.Project;
......
118 117
	        try {
119 118
	        	if (!selectedItems[0].isAvailable()) return;
120 119
	        	getMapContext().zoomToExtent(selectedItems[0].getFullExtent());
121
			} catch (ReadDriverException e1) {
120
			} catch (ReadException e1) {
122 121
				e1.printStackTrace();
123 122
			}
124 123
		} else {
125 124
			try {
126 125
				Rectangle2D maxExtent = setMaxExtent(selectedItems);
127 126
				getMapContext().zoomToExtent(maxExtent);
128
			} catch (ReadDriverException e1) {
127
			} catch (ReadException e1) {
129 128
				e1.printStackTrace();
130 129
			}
131 130
		}
......
134 133
	}
135 134

  
136 135
	private Rectangle2D setMaxExtent(FLayer[] actives)
137
			throws ReadDriverException {
136
			throws ReadException {
138 137
		Rectangle2D extRef = null;
139
		try {
140

  
141 138
			extRef = actives[0].getFullExtent();
142 139

  
143 140
			double minXRef = extRef.getMinX();
......
163 160
							- minYRef);
164 161
				}
165 162
			}
166
		} catch (ExpansionFileReadException e) {
167
			e.printStackTrace();
168
		}
169 163
		return extRef;
170 164
	}
171 165
}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/ChangeSymbolTocMenuEntry.java
1 1
package com.iver.cit.gvsig.project.documents.view.toc.actions;
2 2

  
3 3
import org.apache.log4j.Logger;
4
import org.gvsig.data.ReadException;
4 5
import org.gvsig.fmap.mapcontext.MapContext;
5 6
import org.gvsig.fmap.mapcontext.layers.FLayer;
6 7
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
......
11 12
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
12 13
import org.gvsig.fmap.mapcontext.rendering.symbols.MultiLayerFillSymbol;
13 14

  
14
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
15 15
import com.iver.andami.PluginServices;
16 16
import com.iver.andami.messages.NotificationManager;
17 17
import com.iver.cit.gvsig.ProjectExtension;
......
128 128
		boolean showDialog = isTocItemLeaf(item);
129 129

  
130 130
		if (!showDialog) return;
131
		
131

  
132 132
		try {
133 133
			FLyrVect layer = (FLyrVect) selectedItems[0];
134 134
			ISymbol oldSymbol = ((TocItemLeaf) item).getSymbol();
135
			// patch, figure out an ellegant way to solve this 
135
			// patch, figure out an ellegant way to solve this
136 136
			if (oldSymbol instanceof MultiLayerFillSymbol) {
137 137
				MultiLayerFillSymbol ms = (MultiLayerFillSymbol) oldSymbol;
138 138
				for (int i = 0; i < ms.getLayerCount(); i++) {
139 139
					if (ms.getLayer(i).getClassName().equals("org.gvsig.symbology.symbols.DotDensityFillSymbol")) {
140
						/* 
141
						 * since dot density symbol works together with the 
140
						/*
141
						 * since dot density symbol works together with the
142 142
						 * legend, there is no way to edit it from the symbol selector and editor
143 143
						 * we have to break now!
144 144
						 */
......
147 147
				}
148 148
			}
149 149
			// end patch
150
			
151
			
150

  
151

  
152 152
			int shapeType = ((IVectorLegend) layer.getLegend()).getShapeType();
153 153
			if (shapeType == 0) {
154 154
				Logger.getLogger(ChangeNameTocMenuEntry.class).debug("Error legend "+layer.getLegend()+" does not have shapetype initialized");
......
160 160
			try {
161 161
				symSel = SymbolSelector.createSymbolSelector(oldSymbol, shapeType);
162 162
			} catch (IllegalArgumentException iaEx) {
163
				/* 
164
				 * this usually happens when the Legend has a composed 
163
				/*
164
				 * this usually happens when the Legend has a composed
165 165
				 * symbol that collides with the normal operation and
166 166
				 * it only can be changed from the panel of the legend
167
				 */ 
167
				 */
168 168
				// TODO throw a signal and show a warning message box telling
169
				// that the operation cannot be performed 
169
				// that the operation cannot be performed
170 170
				return;
171 171
			}
172 172
			PluginServices.getMDIManager().addWindow(symSel);
173 173
			ISymbol newSymbol = (ISymbol) symSel.getSelectedObject();
174
			
174

  
175 175
			if (newSymbol == null)
176 176
				return;
177
			
177

  
178 178
			newSymbol.setDescription(oldSymbol.getDescription());
179
			
179

  
180 180
			for (int i = 0; i < selectedItems.length; i++) {
181 181
				FLyrVect theLayer = ((FLyrVect) selectedItems[i]);
182
				
182

  
183 183
				try {
184 184
					ILegend legend = theLayer.getLegend();
185 185
					if (legend instanceof IClassifiedVectorLegend) {
......
192 192
				} catch (Exception e) {
193 193
					NotificationManager.addWarning(PluginServices.getText(this, "skipped_symbol_changed_for_layer")+": "+theLayer.getName(), e);
194 194
				}
195
					
195

  
196 196
			}
197 197
		     // refresh view treak
198 198
			MapContext mc = layer.getMapContext();
......
200 200
			Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
201 201
			project.setModified(true);
202 202
			mc.callLegendChanged();
203
			
204
		} catch (ReadDriverException e) {
203

  
204
		} catch (ReadException e) {
205 205
			NotificationManager.addError(PluginServices.getText(this, "getting_shape_type"), e);
206 206
		}
207 207
	}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/gui/TOC.java
77 77
import javax.swing.tree.TreePath;
78 78
import javax.swing.tree.TreeSelectionModel;
79 79

  
80
import org.gvsig.data.ReadException;
80 81
import org.gvsig.fmap.mapcontext.MapContext;
81 82
import org.gvsig.fmap.mapcontext.events.AtomicEvent;
82 83
import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener;
......
89 90
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable;
90 91
import org.gvsig.fmap.mapcontext.layers.operations.IHasImageLegend;
91 92
import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
92
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrAnnotation;
93 93
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
94 94
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
95 95
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
......
99 99
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
100 100
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
101 101

  
102
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
103 102
import com.iver.andami.PluginServices;
104 103
import com.iver.andami.messages.NotificationManager;
105 104
import com.iver.cit.gvsig.project.documents.IContextMenuAction;
......
314 313
                LayerCollection group = (LayerCollection) lyr;
315 314
                doRefresh(group, nodeLayer);
316 315
            } else {
317
                if (lyr instanceof Classifiable && !(lyr instanceof FLyrAnnotation)) {
316
                if (lyr instanceof Classifiable){// && !(lyr instanceof FLyrAnnotation)) {
318 317

  
319 318
                    Classifiable aux = (Classifiable) lyr;
320 319
                    ILegend legendInfo = aux.getLegend();
......
356 355
                            //			nodeValue));
357 356
                            // m_Tree.makeVisible(pathSymbol);
358 357
                        }
359
                    } catch (ReadDriverException e) {
358
                    } catch (ReadException e) {
360 359
						e.printStackTrace();
361 360
					}
362 361
                }
......
593 592
        JColorChooser colorChooser;
594 593
        FPopupMenu popmenu = null;
595 594
        DefaultMutableTreeNode node;
596
        
595

  
597 596
        /**
598 597
         * Crea un nuevo NodeSelectionListener.
599 598
         *
......
619 618
        	if (path != null) {
620 619
        		if (e.getClickCount() == 1) {
621 620
        			// this fixes a bug when double-clicking. JTree by default
622
        			// expands the tree when double-clicking, so we capture a 
621
        			// expands the tree when double-clicking, so we capture a
623 622
        			// different node in the second click than in the first
624 623
        			node = (DefaultMutableTreeNode) path.getLastPathComponent();
625 624
        		}
......
638 637
        					IContextMenuAction action = leaf.getDoubleClickAction();
639 638
        					if (action != null) {
640 639
        						/* if there is an action associated with the double-clicked element
641
        						 * it will be fired for it and FOR ALL OTHER COMPATIBLES THAT HAVE 
640
        						 * it will be fired for it and FOR ALL OTHER COMPATIBLES THAT HAVE
642 641
        						 * BEEN ACTIVATED.
643
        						 */ 
642
        						 */
644 643
        						ArrayList<FLayer> targetLayers = new ArrayList<FLayer>();
645 644

  
646 645
        						TocItemBranch owner = (TocItemBranch) node.getUserObject();
647
        						
646

  
648 647
        						FLayer masterLayer = owner.getLayer();
649 648
        						targetLayers.add(masterLayer);
650 649
        						FLayer[] actives = mapContext.getLayers().getActives();
......
658 657
											} else {
659 658
												vectorLayer.setActive(false);
660 659
											}
661
										} 
660
										}
662 661
										// TODO for the rest of layer types (i.e. FLyrRaster)
663 662
									} else {
664 663
										actives[i].setActive(false);
......
742 741
        					IContextMenuAction action = leaf.getDoubleClickAction();
743 742
        					if (action != null) {
744 743
        						/* if there is an action associated with the double-clicked element
745
        						 * it will be fired for it and FOR ALL OTHER COMPATIBLES THAT HAVE 
744
        						 * it will be fired for it and FOR ALL OTHER COMPATIBLES THAT HAVE
746 745
        						 * BEEN ACTIVATED.
747
        						 */ 
746
        						 */
748 747
        						ArrayList<FLayer> targetLayers = new ArrayList<FLayer>();
749
        						
748

  
750 749
        						TocItemBranch owner = (TocItemBranch) ((DefaultMutableTreeNode) node.getParent())
751 750
        													.getUserObject();
752
        						
751

  
753 752
        						FLayer masterLayer = owner.getLayer();
754 753
        						targetLayers.add(masterLayer);
755 754
        						FLayer[] actives = mapContext.getLayers().getActives();
......
765 764
											} else {
766 765
												vectorLayer.setActive(false);
767 766
											}
768
										} 
767
										}
769 768
										// TODO for the rest of layer types (i.e. FLyrRaster)
770 769
									} else {
771 770
										actives[i].setActive(false);
......
780 779
        				}
781 780
        				return;
782 781
        			}
783
        			
784
        			
782

  
783

  
785 784
        			// Boton derecho sobre un Simbolo
786 785
        			// TocItemLeaf auxLeaf = (TocItemLeaf) node.getUserObject();
787 786
        			// FSymbol theSym = auxLeaf.getSymbol();
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/TocItemLeaf.java
59 59
import javax.swing.Icon;
60 60
import javax.swing.ImageIcon;
61 61

  
62
import org.gvsig.fmap.core.shapes.FShape;
62
import org.gvsig.fmap.geom.Geometry;
63 63
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
64 64
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
65 65
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbologyFactory;
......
81 81
	private int layerType;
82 82
	private static int w_1symbol = 20;
83 83
	private static int h_1symbol = 15;
84
	
84

  
85 85
	private Dimension sz;
86 86
	BufferedImage imgLegend = null;
87
	
87

  
88 88
    final public static DataFlavor INFO_FLAVOR =
89 89
	    new DataFlavor(TocItemLeaf.class, "ItemLeaf");
90 90

  
91 91
	static DataFlavor flavors[] = {INFO_FLAVOR };
92
	
93
	
92

  
93

  
94 94
	public TocItemLeaf(ISymbol symbol, String description, int layerType)
95 95
	{
96 96
		this.symbol = symbol;
......
99 99
	}
100 100
	public TocItemLeaf()
101 101
	{
102
		
102

  
103 103
	}
104
	public void setImageLegend(Image imageLegend, String descrip, Dimension size) 
105
	{		
104
	public void setImageLegend(Image imageLegend, String descrip, Dimension size)
105
	{
106 106
		this.description = descrip;
107 107
		this.sz = size;
108 108
		imgLegend = new BufferedImage(sz.width, sz.height, BufferedImage.TYPE_INT_ARGB);
......
121 121
//			int newWidth = (int) (sz.height * ratioImage);
122 122
//			boolean resul = g2.drawImage(imageLegend, 0, 0, newWidth, sz.height, null);
123 123
//		}
124
		
124

  
125 125
	}
126 126
	/* (non-Javadoc)
127 127
	 * @see com.iver.cit.gvsig.gui.toc.ITocItem#getLabel()
......
141 141
//			g2.drawString("Prueba", 10, 20);
142 142
			return new ImageIcon(imgLegend);
143 143
		}
144
		
144

  
145 145
		BufferedImage img = null;
146 146
		Graphics2D g2 = null;
147 147
		Rectangle r = null;
148
		
148

  
149 149
		switch (layerType)
150 150
		{
151
			case FShape.POINT:
152
			case FShape.LINE:
153
			case FShape.POLYGON:
154
			case FShape.MULTIPOINT:
151
			case Geometry.TYPES.POINT:
152
			case Geometry.TYPES.CURVE:
153
			case Geometry.TYPES.SURFACE:
154
			case Geometry.TYPES.MULTIPOINT:
155 155
				img = new BufferedImage(w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB);
156 156
				g2 = img.createGraphics();
157
				r = new Rectangle(w_1symbol, h_1symbol);	
157
				r = new Rectangle(w_1symbol, h_1symbol);
158 158

  
159 159
//				// TODO: CAMBIAR PARA QUE NO DEPENDA DE FSYMBOL
160 160
//				if (symbol instanceof FSymbol)
161 161
//					FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, (FSymbol) symbol);
162 162
//				// Por ahora, los que no sean FSymbol no se renderizan en el TOC.
163
				break;									
164
			case FShape.MULTI:
163
				break;
164
			case Geometry.TYPES.AGGREGATE:
165 165
				img = new BufferedImage(3*w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB);
166 166
				g2 = img.createGraphics();
167 167
				r = new Rectangle(3*w_1symbol, h_1symbol);
168 168
//				if (symbol instanceof FSymbol)
169 169
//					FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, (FSymbol) symbol);
170
				break;					
171
			
170
				break;
171

  
172 172
		}
173
		
173

  
174 174
		if (g2 == null) return null;//TODO tipo de shape no soportado.
175 175
		try {
176 176
			symbol.drawInsideRectangle(g2, AffineTransform.getScaleInstance(0.8,0.8), r);
......
192 192
		}
193 193
		return new ImageIcon(img);
194 194
	}
195
	
195

  
196 196
	/* (non-Javadoc)
197 197
	 * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
198 198
	 */
......
227 227
	 */
228 228
	public void setSize(Dimension sz) {
229 229
		this.sz = sz;
230
		
230

  
231 231
	}
232
	
233 232

  
233

  
234 234
	/**
235 235
	 * @return Returns the symbol.
236 236
	 */
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toolListeners/InfoListener.java
47 47
import java.awt.geom.Point2D;
48 48
import java.util.Vector;
49 49

  
50
import javax.swing.ImageIcon;
51 50
import javax.swing.JDialog;
52 51
import javax.swing.tree.DefaultMutableTreeNode;
53 52
import javax.swing.tree.DefaultTreeModel;
54 53
import javax.swing.tree.TreePath;
55 54

  
56 55
import org.apache.log4j.Logger;
57
import org.gvsig.fmap.drivers.exceptions.VisitorException;
58
import org.gvsig.fmap.drivers.reading.DriverIOException;
56
import org.gvsig.data.ReadException;
57
import org.gvsig.data.vectorial.FeatureCollection;
58
import org.gvsig.data.vectorial.FeatureStore;
59 59
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
60 60
import org.gvsig.fmap.mapcontext.layers.FBitSet;
61 61
import org.gvsig.fmap.mapcontext.layers.FLayer;
......
70 70
import org.xml.sax.ContentHandler;
71 71
import org.xml.sax.SAXException;
72 72

  
73
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
74 73
import com.iver.andami.PluginServices;
75 74
import com.iver.andami.messages.NotificationManager;
76 75
import com.iver.cit.gvsig.project.documents.view.info.gui.FInfoDialog;
......
98 97

  
99 98
	/**
100 99
	 * The cursor used to work with this tool listener.
101
	 * 
100
	 *
102 101
	 * @see #getCursor()
103 102
	 */
104 103
	private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img,
......
116 115

  
117 116
	/**
118 117
	 * <p>Creates a new <code>InfoListener</code> object.</p>
119
	 * 
118
	 *
120 119
	 * @param mc the <code>MapControl</code> where will be applied the changes
121 120
	 */
122 121
	public InfoListener(MapControl mc) {
......
126 125
	/**
127 126
	 * When user clicks on the associated <code>MapControl</code>'s view, the point is caught and handled by this method,
128 127
	 *  which will look for alphanumeric information in features at that position in the active layers.
129
	 * 
128
	 *
130 129
	 * @param event mouse event with the coordinates of the point pressed
131 130
	 *
132 131
	 * @throws BehaviorException will be thrown when fails this process
......
153 152
            if (laCapa instanceof FLyrVect)
154 153
            {
155 154
                FLyrVect lyrVect = (FLyrVect) laCapa;
156
                FBitSet newBitSet;
155
                FeatureCollection newSelection;
157 156
                try {
158
                    newBitSet = lyrVect.queryByPoint(pReal, tol);
159
                    items[i] = new VectorialXMLItem(newBitSet, laCapa);
157
                    newSelection = lyrVect.queryByPoint(pReal, tol);
158
                    items[i] = new VectorialXMLItem(newSelection, laCapa);
160 159
                    numLayersInfoable++;
161
                } catch (ReadDriverException e) {
160
                } catch (ReadException e) {
162 161
                    e.printStackTrace();
163 162
                    throw new BehaviorException("Fallo al consultar " + lyrVect.getName());
164
                } catch (VisitorException e) {
165
                	 e.printStackTrace();
166
                     throw new BehaviorException("Fallo al consultar " + lyrVect.getName());
167
				}
163
                }
168 164

  
169 165
			}
170 166
			// TODO: PROVISIONAL PARA LA CAPA WMS
......
237 233
//					items[i] = new StringXMLItem(text);
238 234
					items[i] = layer.getInfo(imagePoint, tol, null)[0];
239 235
					numLayersInfoable++;
240
				} catch (ReadDriverException e) {
236
				} catch (ReadException e) {
241 237
					throw new BehaviorException("No se pudo procesar la capa",
242 238
							e);
243
				} catch (VisitorException e) {
244
					throw new BehaviorException("No se pudo procesar la capa",
245
							e);
246 239
				} catch (LoadLayerException e) {
247 240
					throw new BehaviorException("No se pudo procesar la capa",
248 241
							e);
......
304 297
	/**
305 298
	 * When user clicks on the associated <code>MapControl</code>'s view, the point is caught and handled by this method, which will look
306 299
	 * for alphanumeric information in features at that position in the active layers.
307
	 * 
300
	 *
308 301
	 * @param event mouse event with the coordinates of the point pressed
309 302
	 *
310 303
	 * @throws BehaviorException will be thrown when fails this process
......
334 327
						itemsVector.add(aux[j]);
335 328
						numLayersInfoable++;
336 329
					}
337
				} catch (ReadDriverException e) {
330
				} catch (ReadException e) {
338 331
					throw new BehaviorException("Processing layer",e);
339
				} catch (VisitorException e) {
340
					throw new BehaviorException("Processing layer",e);
341 332
				} catch (LoadLayerException e) {
342 333
					throw new BehaviorException("No se pudo procesar la capa",
343 334
							e);
......
426 417
							numLayersInfoable++;
427 418
						}
428 419
					}
429
				} catch (ReadDriverException e) {
420
				} catch (ReadException e) {
430 421
					throw new BehaviorException("Processing layer",e);
431
				} catch (VisitorException e) {
432
					throw new BehaviorException("Processing layer",e);
433 422
				} catch (LoadLayerException e) {
434 423
					throw new BehaviorException("No se pudo procesar la capa",
435 424
							e);
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/SingleSymbol.java
58 58
import javax.swing.JTextField;
59 59
import javax.swing.border.TitledBorder;
60 60

  
61
import org.gvsig.data.ReadException;
61 62
import org.gvsig.fmap.mapcontext.layers.FLayer;
62 63
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
63 64
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
......
68 69
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
69 70
import org.gvsig.gui.beans.swing.JButton;
70 71

  
71
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
72 72
import com.iver.andami.PluginServices;
73 73
import com.iver.andami.messages.NotificationManager;
74 74
import com.iver.cit.gvsig.gui.styling.SymbolLevelsWindow;
......
88 88
	private JButton btnOpenSymbolLevelsEditor;
89 89
	private SingleSymbolLegend legend;
90 90
	private ZSort zSort;
91
	
92 91

  
92

  
93 93
	public SingleSymbol() {
94 94
		super();
95 95
		initialize();
......
109 109
	public void setData(FLayer lyr, ILegend legend) {
110 110
		try {
111 111
			shapeType = ((FLyrVect) lyr).getShapeType();
112
		} catch (ReadDriverException e) {
112
		} catch (ReadException e) {
113 113
			NotificationManager.addError("Could not find out the shape type" ,e);
114 114
		}
115 115
		if (legend instanceof SingleSymbolLegend) {
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/AttrInTableLabeling.java
45 45
import java.awt.event.ActionEvent;
46 46
import java.sql.Types;
47 47
import java.util.ArrayList;
48
import java.util.Iterator;
48 49

  
49 50
import javax.swing.ButtonGroup;
50 51
import javax.swing.JPanel;
51 52
import javax.swing.JRadioButton;
52 53
import javax.swing.JTextField;
53 54

  
55
import org.gvsig.data.ReadException;
56
import org.gvsig.data.vectorial.FeatureAttributeDescriptor;
57
import org.gvsig.data.vectorial.FeatureStore;
58
import org.gvsig.data.vectorial.FeatureType;
54 59
import org.gvsig.fmap.mapcontext.layers.FLayer;
55 60
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
56 61
import org.gvsig.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy;
57 62
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy;
58 63
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
59 64

  
60
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
61 65
import com.iver.andami.PluginServices;
62 66
import com.iver.andami.messages.NotificationManager;
63 67
import com.iver.cit.gvsig.gui.JComboBoxUnits;
......
70 74
			PluginServices.getText(LabelingManager.class, "none") + " --";
71 75
	private String[] fieldNames;
72 76
	private String[] numericFieldNames;
73
	
77

  
74 78
	private JRadioButton rdBtnFixedHeight;
75 79
	private JRadioButton rdBtnHeightField;
76 80
	private JComboBox cmbTextField;
......
100 104
		group.add(getRdBtnHeightField());
101 105

  
102 106
		getRdBtnHeightField().setEnabled(true);
103
	}	
104
	
107
	}
105 108

  
109

  
106 110
	private JRadioButton getRdBtnFixedHeight() {
107 111
		if (rdBtnFixedHeight == null) {
108 112
			rdBtnFixedHeight = new JRadioButton(PluginServices.getText(this, "fixed_height") + ":");
......
122 126

  
123 127
		return rdBtnHeightField;
124 128
	}
125
	
129

  
126 130
	private JComboBoxUnits getCmbUnits() {
127 131
		if (cmbUnits == null) {
128 132
			cmbUnits = new JComboBoxUnits();
......
148 152
		refreshCmbUnits();
149 153

  
150 154
	}
151
	
155

  
152 156
	private JComboBox getCmbRotationField() {
153 157
		if (cmbRotationField == null) {
154 158
			cmbRotationField = new JComboBox();
......
175 179
		}
176 180
		return cmbTextField;
177 181
	}
178
	
179 182

  
183

  
180 184
	private JTextField getTxtHeightField() {
181 185
		if (txtHeightField == null) {
182 186
			txtHeightField = new JTextField(10);
......
190 194
	public void actionPerformed(ActionEvent e) {
191 195
		// TODO Auto-generated method stub
192 196
		throw new Error("Not yet implemented!");
193
		
197

  
194 198
	}
195 199

  
196 200
	public ILabelingStrategy getLabelingStrategy() {
......
224 228
		// to allow the labeling of non-FLyrVect layers
225 229
		if (layer instanceof FLyrVect) {
226 230
			FLyrVect lv = (FLyrVect) layer;
227
			try {
228
				fieldNames = lv.getRecordset().getFieldNames();
231
//			try {
232
//				fieldNames =
233
				FeatureType featureType=((FeatureType)((FeatureStore)lv.getDataStore()).getFeatureTypes().get(0));
234
				Iterator iterator=featureType.iterator();
235
				ArrayList<String> l = new ArrayList<String>();
236
				while (iterator.hasNext()) {
237
					FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator.next();
238
					if (descriptor.getDataType().equals(FeatureAttributeDescriptor.TYPE_DOUBLE)||
239
							descriptor.getDataType().equals(FeatureAttributeDescriptor.TYPE_FLOAT)||
240
							descriptor.getDataType().equals(FeatureAttributeDescriptor.TYPE_LONG)||
241
							descriptor.getDataType().equals(FeatureAttributeDescriptor.TYPE_INT)){
242
						l.add(descriptor.getName());
243
					}
229 244

  
245

  
230 246
				// detect the numeric fields
231
				ArrayList<String> l = new ArrayList<String>();
232
				for (int i = 0; i < fieldNames.length; i++) {
233
					switch (lv.getRecordset().getFieldType(i)) {
234
					case Types.DECIMAL:
235
					case Types.NUMERIC:
236
					case Types.FLOAT:
237
					case Types.DOUBLE:
238
					case Types.INTEGER:
239
					case Types.REAL:
240
					case Types.SMALLINT:
241
					case Types.TINYINT:
242
					case Types.BIGINT:
243
						l.add(fieldNames[i]);
244
						break;
245
					}
247

  
248
//				for (int i = 0; i < fieldNames.length; i++) {
249
//					switch (lv.getRecordset().getFieldType(i)) {
250
//					case Types.DECIMAL:
251
//					case Types.NUMERIC:
252
//					case Types.FLOAT:
253
//					case Types.DOUBLE:
254
//					case Types.INTEGER:
255
//					case Types.REAL:
256
//					case Types.SMALLINT:
257
//					case Types.TINYINT:
258
//					case Types.BIGINT:
259
//						l.add(fieldNames[i]);
260
//						break;
261
//					}
246 262
				}
247 263
				numericFieldNames = l.toArray(new String[l.size()]);
248
			} catch (ReadDriverException e) {
249
				NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e);
250
			}
264
//			} catch (ReadException e) {
265
//				NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e);
266
//			}
251 267
			refreshControls();
252 268
		}
253 269
	}
......
261 277
		}
262 278
	}
263 279

  
264
	
280

  
265 281
	private void refreshTextHeight() {
266 282
		getCmbHeightField().removeAllItems();
267
		
283

  
268 284
		boolean enabled = numericFieldNames.length>0;
269 285
		getCmbHeightField().setEnabled(enabled);
270 286
		getRdBtnHeightField().setEnabled(enabled);
271
		
287

  
272 288
		if (!enabled) {
273 289
			getRdBtnFixedHeight().setSelected(true);
274 290
		}
275
		
291

  
276 292
		for (int i = 0; i < numericFieldNames.length; i++) {
277 293
			getCmbHeightField().addItem(numericFieldNames[i]);
278 294
		}
......
287 303
				String item = aux.getHeightField();
288 304
				getCmbHeightField().setSelectedItem(item);
289 305

  
290
			} catch (ReadDriverException e) {
306
			} catch (ReadException e) {
291 307
				// should never happen
292 308
				NotificationManager.addWarning(PluginServices.getText(this, "could_not_restore_text_height_field"), e);
293 309
			}
......
307 323
			try {
308 324
				String item = aux.getRotationField();
309 325
				getCmbRotationField().setSelectedItem(item != null? item : NO_FIELD_ITEM);
310
			} catch (ReadDriverException e) {
326
			} catch (ReadException e) {
311 327
				// should never happen
312 328
				NotificationManager.addWarning(PluginServices.getText(this, "could_not_restore_rotation_field"), e);
313 329
			}
......
325 341
			try {
326 342
				String item = aux.getTextField();
327 343
				getCmbTextField().setSelectedItem(item != null? item : NO_FIELD_ITEM);
328
			} catch (ReadDriverException e) {
344
			} catch (ReadException e) {
329 345
				// should never happen
330 346
				NotificationManager.addWarning(PluginServices.getText(this, "could_not_restore_text_field"), e);
331 347
			}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialUniqueValue.java
45 45
import java.awt.FlowLayout;
46 46
import java.awt.event.ActionEvent;
47 47
import java.awt.event.ActionListener;
48
import java.util.ArrayList;
49
import java.util.Iterator;
48 50
import java.util.Random;
49 51

  
50 52
import javax.swing.DefaultComboBoxModel;
......
56 58
import javax.swing.JPanel;
57 59

  
58 60
import org.apache.log4j.Logger;
61
import org.gvsig.data.ReadException;
62
import org.gvsig.data.vectorial.Feature;
63
import org.gvsig.data.vectorial.FeatureAttributeDescriptor;
64
import org.gvsig.data.vectorial.FeatureStore;
59 65
import org.gvsig.fmap.mapcontext.layers.FLayer;
60 66
import org.gvsig.fmap.mapcontext.layers.operations.AlphanumericData;
61 67
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
......
64 70
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
65 71
import org.gvsig.fmap.mapcontext.rendering.legend.LegendFactory;
66 72
import org.gvsig.fmap.mapcontext.rendering.legend.NullUniqueValue;
73
import org.gvsig.fmap.mapcontext.rendering.legend.NullValue;
67 74
import org.gvsig.fmap.mapcontext.rendering.legend.VectorialUniqueValueLegend;
68 75
import org.gvsig.fmap.mapcontext.rendering.legend.ZSort;
69 76
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
70 77
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbologyFactory;
71 78
import org.gvsig.gui.beans.swing.JButton;
72 79
import org.gvsig.raster.datastruct.ColorItem;
80
import org.omg.CORBA.portable.ValueFactory;
73 81

  
74
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
75
import com.hardcode.gdbms.engine.data.DataSource;
76
import com.hardcode.gdbms.engine.values.NullValue;
77
import com.hardcode.gdbms.engine.values.Value;
78
import com.hardcode.gdbms.engine.values.ValueFactory;
79 82
import com.iver.andami.PluginServices;
80 83
import com.iver.andami.messages.NotificationManager;
81 84
import com.iver.cit.gvsig.gui.styling.JComboBoxColorScheme;
......
188 191
     * DOCUMENT ME!
189 192
     */
190 193
    private void fillTableValues() {
191
        DataSource elRs;
194
        FeatureStore elRs;
192 195

  
193 196
        try {
194
            elRs = ((FLyrVect) layer).getRecordset();
195
            logger.debug("elRs.start()");
196
            elRs.start();
197
            elRs = ((FLyrVect) layer).getFeatureStore();
198
//            logger.debug("elRs.start()");
199
//            elRs.start();
197 200

  
198 201
            int idField = -1;
199 202
            String fieldName = (String) cmbFields.getSelectedItem();
......
202 205
            	return;
203 206
            }
204 207

  
205
            idField = elRs.getFieldIndexByName(fieldName);
208
//            idField = elRs.getFieldIndexByName(fieldName);
206 209
            theLegend.setClassifyingFieldNames(new String[] {fieldName});
207 210

  
208 211
            //long numReg = elRs.getRowCount();
209
            if (idField == -1) {
210
                NotificationManager.addWarning(
211
                		PluginServices.getText(this, "unrecognized_field_name")+" " + fieldName, null);
212
//            if (idField == -1) {
213
//                NotificationManager.addWarning(
214
//                		PluginServices.getText(this, "unrecognized_field_name")+" " + fieldName, null);
215
//
216
//                return;
217
//            }
212 218

  
213
                return;
214
            }
215

  
216 219
            symbolTable.removeAllItems();
217 220

  
218 221
            int numSymbols = 0;
......
221 224
            //auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend();
222 225
            auxLegend = LegendFactory.createVectorialUniqueValueLegend(layer.getShapeType());
223 226

  
224
            Value clave;
227
            Object clave=null;
225 228

  
226 229
            //Object resul;
227 230
            if (chbUseDefault.isSelected()) {
......
233 236
            ColorItem[] colorScheme = cmbColorScheme.getSelectedColors();
234 237
            Random rand = new Random(System.currentTimeMillis());
235 238

  
236
            for (int j = 0; j < elRs.getRowCount(); j++) {
237
                clave = elRs.getFieldValue(j, idField);
239
            Iterator iterator=elRs.getDataCollection().iterator();
240
            while (iterator.hasNext()) {
241
				Feature feature = (Feature) iterator.next();
242
				feature.get(fieldName);
243
//			}
244
//            for (int j = 0; j < elRs.getRowCount(); j++) {
245
//                clave = elRs.getFieldValue(j, idField);
238 246

  
239 247
                if (clave instanceof NullValue) {
240 248
                    continue;
......
270 278

  
271 279
            symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(),
272 280
                auxLegend.getValues(), auxLegend.getDescriptions());
273
            elRs.stop();
274
        } catch (ReadDriverException e) {
281
//            elRs.stop();
282
        } catch (ReadException e) {
275 283
        	NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e);
276 284
        }
277 285

  
......
286 294
     * el symbolList, si no tambi�n el arrayKeys y el defaultRenderer
287 295
     */
288 296
    private void fillSymbolListFromTable() {
289
        Value clave;
297
        Object clave=null;
290 298
        ISymbol theSymbol;
291 299

  
292 300
        // Borramos las anteriores listas:
......
298 306
        /////////////////////////////////////////PEPE
299 307
        FLyrVect m = (FLyrVect) layer;
300 308
        try {
301
        	int fieldType = m.getSource().getRecordset().getFieldType((int)cmbFields.getSelectedIndex());
302
        	theLegend.setClassifyingFieldTypes(new int[] {fieldType});
303
        } catch (ReadDriverException e) {
309
        	String fieldType=m.getFeatureStore().getDefaultFeatureType().getByOrder((int)cmbFields.getSelectedIndex()).getName();
310
//        	int fieldType = m.getSource().getRecordset().getFieldType((int)cmbFields.getSelectedIndex());
311
        	theLegend.setClassifyingFieldTypes(new String[] {fieldType});
312
        } catch (ReadException e) {
304 313
        	NotificationManager.addError(PluginServices.getText(this, "could_not_setup_legend"), e);
305 314
        }
306 315
        /////////////////////////////////////////PEPE
......
311 320
        }
312 321

  
313 322
        for (int row = 0; row < symbolTable.getRowCount(); row++) {
314
            clave = (Value) symbolTable.getFieldValue(row, 1);
323
            clave = (Object) symbolTable.getFieldValue(row, 1);
315 324
            theSymbol = (ISymbol) symbolTable.getFieldValue(row, 0);
316 325
            theSymbol.setDescription((String) symbolTable.getFieldValue(row, 2));
317 326
            theLegend.addSymbol(clave, theSymbol);
......
327 336
     * DOCUMENT ME!
328 337
     */
329 338
    private void fillFieldNames() {
330
        DataSource rs;
339
        FeatureStore rs;
331 340

  
332 341
        try {
333
            rs = ((AlphanumericData) layer).getRecordset();
334
            logger.debug("rs.start()");
335
            rs.start();
342
            rs = ((AlphanumericData) layer).getFeatureStore();
343
//            logger.debug("rs.start()");
344
//            rs.start();
336 345

  
337
            String[] nomFields = new String[rs.getFieldCount()];
346
            ArrayList names=new ArrayList();
347
            Iterator iterator=rs.getDefaultFeatureType().iterator();
348
            while (iterator.hasNext()) {
349
				FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator.next();
350
				names.add(descriptor.getDataType());
351
			}
352
//            String[] nomFields = new String[rs.getFieldCount()];
353
//
354
//            for (int i = 0; i < rs.getFieldCount(); i++) {
355
//                nomFields[i] = rs.getFieldName(i).trim();
356
//            }
357
//
358
//            rs.stop();
338 359

  
339
            for (int i = 0; i < rs.getFieldCount(); i++) {
340
                nomFields[i] = rs.getFieldName(i).trim();
341
            }
342

  
343
            rs.stop();
344

  
345
            DefaultComboBoxModel cM = new DefaultComboBoxModel(nomFields);
360
            DefaultComboBoxModel cM = new DefaultComboBoxModel((String[])names.toArray(new String[0]));
346 361
            cmbFields.setModel(cM);
347 362

  
348 363
            // fieldsListValor.setSelectedIndex(0);
349
        } catch (ReadDriverException e) {
364
        } catch (ReadException e) {
350 365
        	NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e);
351 366
        }
352 367
    }
......
356 371
      	int shapeType = 0;
357 372
      	try {
358 373
      		shapeType = this.layer.getShapeType();
359
      	} catch (ReadDriverException e) {
374
      	} catch (ReadException e) {
360 375
    		NotificationManager.addError(PluginServices.getText(this, "generating_intervals"), e);
361 376
		}
362 377

  
......
478 493
    		try {
479 494
    			symbolTable.addTableRecord(SymbologyFactory.
480 495
    					createDefaultSymbolByShapeType(layer.getShapeType()),
481
    					ValueFactory.createValue(0.0), "0 - 0");
482
    		} catch (ReadDriverException ex) {
496
    					new Double(0.0), "0 - 0");
497
    		} catch (ReadException ex) {
483 498
    			NotificationManager.addError(PluginServices.getText(this, "getting_shape_type"), ex);
484 499
    		}
485 500
    	}
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/SymbolTable.java
66 66

  
67 67
import org.gvsig.fmap.mapcontext.rendering.legend.NullIntervalValue;
68 68
import org.gvsig.fmap.mapcontext.rendering.legend.NullUniqueValue;
69
import org.gvsig.fmap.mapcontext.rendering.legend.NullValue;
69 70
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
70 71

  
71
import com.hardcode.gdbms.engine.values.NullValue;
72 72
import com.iver.andami.PluginServices;
73 73
import com.iver.andami.ui.mdiFrame.JMenuItem;
74 74
import com.iver.andami.ui.mdiFrame.JPopUpMenu;
......
82 82
/**
83 83
 * JPanel que contiene la tabla con los s?mbolos intervalos o valores y
84 84
 * etiquetado de estos valores.
85
 * 
85
 *
86 86
 * @author Vicente Caballero Navarro
87 87
 */
88 88
public class SymbolTable extends JPanel {
......
94 94
	private JTable table;
95 95
	private String type;
96 96
	private int shapeType;
97
	private OnTableMouseAdapter rightClickActions; 
97
	private OnTableMouseAdapter rightClickActions;
98 98

  
99 99
	/**
100 100
	 * Crea un nuevo FSymbolTable.
101
	 * 
101
	 *
102 102
	 * @param type
103 103
	 *            tipo de valor si es intervalo: "intervals" y si es por
104 104
	 *            valores: "values".
......
107 107
		super(new GridLayout(1, 0));
108 108
		this.type = type;
109 109
		this.shapeType = shapeType;
110
		
110

  
111 111
		rightClickActions = new OnTableMouseAdapter();
112 112
		table = new JTable();
113 113
		table.setModel(new MyTableModel());
114 114
		table.setPreferredScrollableViewportSize(new Dimension(480, 110));
115
		
115

  
116 116
		initializeCellEditors();
117
		
117

  
118 118
		// Create the scroll pane and add the table to it.
119 119
		JScrollPane scrollPane = new JScrollPane(table);
120 120

  
121 121
		// Set up column sizes.
122 122
		// initColumnSizes(table);
123 123
		setUpSymbolColumn(table, table.getColumnModel().getColumn(0));
124
		
124

  
125 125
		if(cellEditors.get(type) == null)
126 126
			throw new Error("Symbol table type not set!");
127
			
127

  
128 128
		setUpValueColumn(table, table.getColumnModel().getColumn(1),cellEditors.get(this.type));
129 129
		setUpLabelColumn(table, table.getColumnModel().getColumn(2));
130 130

  
......
141 141
		this.cellEditors.put(this.VALUES_TYPE, new ValueCellEditor());
142 142
	}
143 143
	/**
144
	 * A?ade un nuevo CellEditor a la lista de disponibles 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff