Revision 24691 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/TestIClassifiedLegend.java

View differences:

TestIClassifiedLegend.java
60 60
import org.gvsig.fmap.dal.exception.ReadException;
61 61
import org.gvsig.fmap.dal.exception.WriteException;
62 62
import org.gvsig.fmap.dal.feature.CommandsRecord;
63
import org.gvsig.fmap.dal.feature.EditableFeature;
64
import org.gvsig.fmap.dal.feature.EditableFeatureType;
63 65
import org.gvsig.fmap.dal.feature.Feature;
64 66
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
67
import org.gvsig.fmap.dal.feature.FeatureIndex;
68
import org.gvsig.fmap.dal.feature.FeatureIndexes;
65 69
import org.gvsig.fmap.dal.feature.FeatureQuery;
66 70
import org.gvsig.fmap.dal.feature.FeatureReference;
71
import org.gvsig.fmap.dal.feature.FeatureSelection;
67 72
import org.gvsig.fmap.dal.feature.FeatureSet;
68 73
import org.gvsig.fmap.dal.feature.FeatureStore;
74
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
69 75
import org.gvsig.fmap.dal.feature.FeatureType;
70
import org.gvsig.fmap.dal.feature.expressionevaluator.AttributeValueEvaluator;
71
import org.gvsig.fmap.dal.index.IndexException;
72
import org.gvsig.fmap.dal.operation.DataStoreOperationContext;
73
import org.gvsig.fmap.dal.operation.DataStoreOperationException;
74
import org.gvsig.fmap.dal.operation.DataStoreOperationNotSupportedException;
76
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
77
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
78
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection;
75 79
import org.gvsig.fmap.geom.Geometry;
76 80
import org.gvsig.fmap.geom.GeometryFactory;
77 81
import org.gvsig.fmap.geom.GeometryManager;
82
import org.gvsig.fmap.geom.primitive.Envelope;
78 83
import org.gvsig.fmap.geom.primitive.GeneralPathX;
79 84
import org.gvsig.fmap.mapcontext.rendering.legend.AbstractIntervalLegend;
80 85
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
......
85 90
import org.gvsig.metadata.Metadata;
86 91
import org.gvsig.tools.exception.BaseException;
87 92
import org.gvsig.tools.observer.Observer;
93
import org.gvsig.tools.operations.OperationContext;
94
import org.gvsig.tools.operations.OperationException;
95
import org.gvsig.tools.operations.OperationNotSupportedException;
96
import org.gvsig.tools.persistence.PersistenceException;
97
import org.gvsig.tools.persistence.PersistentState;
88 98

  
89 99
import com.iver.utiles.XMLEntity;
90 100
import com.iver.utiles.XMLException;
......
142 152
	 */
143 153
	private class MockDataSource implements FeatureStore {
144 154

  
145
		public DataSet getDataCollection(FeatureType type, String filter, String order) throws ReadException {
155
		public boolean allowWrite() {
146 156
			// TODO Auto-generated method stub
147
			return null;
157
			return false;
148 158
		}
149 159

  
150
		public DataSet getDataCollection(String[] fields, String filter, String order) throws ReadException {
160
		public void beginEditingGroup(String description)
161
				throws NeedEditingModeException {
151 162
			// TODO Auto-generated method stub
152
			return null;
153
		}
154 163

  
155
		public void getDataCollection(FeatureType type, String filter, String order, Observer observer) throws DataException {
156
			// TODO Auto-generated method stub
157

  
158 164
		}
159 165

  
160
		public void getDataCollection(String[] fields, String filter, String order, Observer observer) throws DataException {
166
		public boolean canWriteGeometry(int gvSIGgeometryType)
167
				throws DataException {
161 168
			// TODO Auto-generated method stub
162

  
169
			return false;
163 170
		}
164 171

  
165
		public void getDataSet(Observer observer) {
172
		public void cancelEditing() throws DataException {
166 173
			// TODO Auto-generated method stub
167 174

  
168 175
		}
169 176

  
170
		public Feature getFeatureByReference(FeatureReference reference) throws ReadException {
177
		public FeatureSelection createFeatureSelection() throws DataException {
171 178
			// TODO Auto-generated method stub
172 179
			return null;
173 180
		}
174 181

  
175
		public Feature getFeatureByReference(FeatureReference reference, FeatureType featureType) throws ReadException {
182
		public FeatureIndex createIndex(FeatureType featureType,
183
				String attributeName, String indexName) throws DataException {
176 184
			// TODO Auto-generated method stub
177 185
			return null;
178 186
		}
179 187

  
180
		public FeatureType getDefaultFeatureType() {
188
		public EditableFeature createNewFeature() throws DataException {
181 189
			// TODO Auto-generated method stub
182 190
			return null;
183 191
		}
184 192

  
185
		public List getFeatureTypes() {
193
		public EditableFeature createNewFeature(FeatureType type,
194
				Feature defaultValues) throws DataException {
186 195
			// TODO Auto-generated method stub
187 196
			return null;
188 197
		}
189 198

  
190
		public Feature createNewFeature(FeatureType type, boolean defaultValues) throws InitializeException {
199
		public EditableFeature createNewFeature(FeatureType type,
200
				boolean defaultValues) throws DataException {
191 201
			// TODO Auto-generated method stub
192 202
			return null;
193 203
		}
194 204

  
195
		public Feature createNewFeature(boolean defaultValues) throws InitializeException {
205
		public EditableFeature createNewFeature(boolean defaultValues)
206
				throws DataException {
196 207
			// TODO Auto-generated method stub
197 208
			return null;
198 209
		}
199 210

  
200
		public void update(Feature feature) throws DataException {
201
			// TODO Auto-generated method stub
202

  
203
		}
204

  
205 211
		public void delete(Feature feature) throws DataException {
206 212
			// TODO Auto-generated method stub
207 213

  
208 214
		}
209 215

  
210
		public void insert(Feature feature) throws DataException {
216
		public void edit() throws DataException {
211 217
			// TODO Auto-generated method stub
212 218

  
213 219
		}
214 220

  
215
		public void update(FeatureAttributeDescriptor attributeDescriptor) throws DataException {
221
		public void edit(int mode) throws DataException {
216 222
			// TODO Auto-generated method stub
217 223

  
218 224
		}
219 225

  
220
		public void delete(FeatureAttributeDescriptor attributeDescriptor) throws DataException {
226
		public void endEditingGroup() throws NeedEditingModeException {
221 227
			// TODO Auto-generated method stub
222 228

  
223 229
		}
224 230

  
225
		public void insert(FeatureAttributeDescriptor attributeDescriptor) throws DataException {
231
		public void export(DataExplorer explorer,
232
				NewFeatureStoreParameters params) throws DataException {
226 233
			// TODO Auto-generated method stub
227 234

  
228 235
		}
229 236

  
230
		public void disableNotifications() {
237
		public void finishEditing() throws DataException {
231 238
			// TODO Auto-generated method stub
232 239

  
233 240
		}
234 241

  
235
		public void enableNotifications() {
242
		public CommandsRecord getCommandsRecord() throws DataException {
236 243
			// TODO Auto-generated method stub
237

  
244
			return null;
238 245
		}
239 246

  
240
		public boolean isLocked(FeatureReference id) {
247
		public FeatureType getDefaultFeatureType() throws DataException {
241 248
			// TODO Auto-generated method stub
242
			return false;
249
			return null;
243 250
		}
244 251

  
245
		public boolean lock(FeatureReference id) {
252
		public Envelope getEnvelope() {
246 253
			// TODO Auto-generated method stub
247
			return false;
254
			return null;
248 255
		}
249 256

  
250
		public boolean isWithDefaultLegend() {
257
		public Feature getFeatureByReference(FeatureReference reference)
258
				throws DataException {
251 259
			// TODO Auto-generated method stub
252
			return false;
260
			return null;
253 261
		}
254 262

  
255
		public Object getDefaultLegend() throws ReadException {
263
		public Feature getFeatureByReference(FeatureReference reference,
264
				FeatureType featureType) throws DataException {
256 265
			// TODO Auto-generated method stub
257 266
			return null;
258 267
		}
259 268

  
260
		public Object getDefaultLabelingStrategy() {
269
		public FeatureSelection getFeatureSelection() throws DataException {
261 270
			// TODO Auto-generated method stub
262 271
			return null;
263 272
		}
264 273

  
265
		public boolean canAlterFeatureType() {
274
		public FeatureSet getFeatureSet() throws DataException {
266 275
			// TODO Auto-generated method stub
267
			return false;
268
		}
269

  
270
		public DataStoreParameters getParameters() {
271
			// TODO Auto-generated method stub
272 276
			return null;
273 277
		}
274 278

  
275
		public String getName() {
279
		public FeatureSet getFeatureSet(FeatureQuery featureQuery)
280
				throws DataException {
276 281
			// TODO Auto-generated method stub
277 282
			return null;
278 283
		}
279 284

  
280
		public void init(DataStoreParameters parameters) throws InitializeException {
285
		public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
286
				throws DataException {
281 287
			// TODO Auto-generated method stub
282 288

  
283 289
		}
284 290

  
285
		public void open() throws OpenException {
291
		public void getFeatureSet(Observer observer) throws DataException {
286 292
			// TODO Auto-generated method stub
287 293

  
288 294
		}
289 295

  
290
		public void refresh() throws OpenException, InitializeException {
296
		public List getFeatureTypes() throws DataException {
291 297
			// TODO Auto-generated method stub
292

  
298
			return null;
293 299
		}
294 300

  
295
		public void close() throws CloseException {
301
		public FeatureIndexes getIndexes() {
296 302
			// TODO Auto-generated method stub
297

  
303
			return null;
298 304
		}
299 305

  
300
		public void dispose() throws CloseException {
306
		public FeatureSet getLocks() throws DataException {
301 307
			// TODO Auto-generated method stub
308
			return null;
309
		}
302 310

  
311
		public DataStoreParameters getParameters() {
312
			// TODO Auto-generated method stub
313
			return null;
303 314
		}
304 315

  
305
		public DataSet getDataSet() throws ReadException {
316
		public String getSRSDefaultGeometry() throws DataException {
306 317
			// TODO Auto-generated method stub
307 318
			return null;
308 319
		}
309 320

  
310
		public DataSet getSelection() {
321
		public FeatureStoreTransforms getTransforms() {
311 322
			// TODO Auto-generated method stub
312 323
			return null;
313 324
		}
314 325

  
315
		public void setSelection(DataSet selection) {
326
		public void insert(EditableFeature feature) throws DataException {
316 327
			// TODO Auto-generated method stub
317 328

  
318 329
		}
319 330

  
320
		public DataSet createSelection() {
331
		public boolean isAppendModeSupported() {
321 332
			// TODO Auto-generated method stub
322
			return null;
333
			return false;
323 334
		}
324 335

  
325
		public Iterator getChilds() {
336
		public boolean isAppending() {
326 337
			// TODO Auto-generated method stub
327
			return null;
338
			return false;
328 339
		}
329 340

  
330
		public boolean isEditable() {
341
		public boolean isEditing() {
331 342
			// TODO Auto-generated method stub
332 343
			return false;
333 344
		}
334 345

  
335
		public void edit() throws ReadException {
346
		public boolean isLocksSupported() {
336 347
			// TODO Auto-generated method stub
337

  
348
			return false;
338 349
		}
339 350

  
340
		public void cancelEditing() {
351
		public void redo() throws DataException {
341 352
			// TODO Auto-generated method stub
342 353

  
343 354
		}
344 355

  
345
		public void finishEditing() throws WriteException, ReadException {
356
		public void setSelection(FeatureSet selection) throws DataException {
346 357
			// TODO Auto-generated method stub
347 358

  
348 359
		}
349 360

  
350
		public boolean isEditing() {
361
		public void undo() throws DataException {
351 362
			// TODO Auto-generated method stub
352
			return false;
363

  
353 364
		}
354 365

  
355
		public void undo() {
366
		public void update(EditableFeatureType featureType)
367
				throws DataException {
356 368
			// TODO Auto-generated method stub
357 369

  
358 370
		}
359 371

  
360
		public void redo() {
372
		public void update(EditableFeature feature) throws DataException {
361 373
			// TODO Auto-generated method stub
362 374

  
363 375
		}
364 376

  
365
		public CommandsRecord getCommandsRecord() {
377
		public void validateFeatures(int mode) throws DataException {
366 378
			// TODO Auto-generated method stub
367
			return null;
379

  
368 380
		}
369 381

  
370
		public void beginComplexNotification() {
382
		public DataSet createSelection() throws DataException {
371 383
			// TODO Auto-generated method stub
372

  
384
			return null;
373 385
		}
374 386

  
375
		public void endComplexNotification() {
387
		public void dispose() throws DataException {
376 388
			// TODO Auto-generated method stub
377 389

  
378 390
		}
379 391

  
380
		public DataSet getLocked() {
392
		public Iterator getChildren() {
381 393
			// TODO Auto-generated method stub
382 394
			return null;
383 395
		}
384 396

  
385
		public void setLocked(DataSet locked) {
397
		public DataSet getDataSet() throws DataException {
386 398
			// TODO Auto-generated method stub
387

  
388
		}
389

  
390
		public DataSet createLocked() {
391
			// TODO Auto-generated method stub
392 399
			return null;
393 400
		}
394 401

  
395
		public DataExplorer getExplorer() throws ReadException {
402
		public DataSet getDataSet(DataQuery dataQuery) throws DataException {
396 403
			// TODO Auto-generated method stub
397 404
			return null;
398 405
		}
399 406

  
400
		public void addObserver(Observer o) {
407
		public void getDataSet(Observer observer) throws DataException {
401 408
			// TODO Auto-generated method stub
402 409

  
403 410
		}
404 411

  
405
		public void deleteObserver(Observer o) {
412
		public void getDataSet(DataQuery dataQuery, Observer observer)
413
				throws DataException {
406 414
			// TODO Auto-generated method stub
407 415

  
408 416
		}
409 417

  
410
		public void deleteObservers() {
418
		public DataExplorer getExplorer() throws DataException {
411 419
			// TODO Auto-generated method stub
412

  
420
			return null;
413 421
		}
414 422

  
415
		public Metadata getMetadata() throws BaseException {
423
		public String getName() {
416 424
			// TODO Auto-generated method stub
417 425
			return null;
418 426
		}
419
//		public void start() throws ReadDriverException 								{ }
420
//		public void stop() throws ReadDriverException 								{ }
421
//		public long[] getWhereFilter() throws IOException 							{return null;}
422
//		public DataSourceFactory getDataSourceFactory() 							{return null;}
423
//		public Memento getMemento() throws MementoException 						{return null;}
424
//		public void setDataSourceFactory(DataSourceFactory dsf) 					{ }
425
//		public void setSourceInfo(SourceInfo sourceInfo)  							{ }
426
//		public SourceInfo getSourceInfo() 											{return null;}
427
//		public String getAsString() throws ReadDriverException 						{return null;}
428
//		public void remove() throws WriteDriverException 							{ }
429
//		public int[] getPrimaryKeys() throws ReadDriverException 					{return null;}
430
//		public ValueCollection getPKValue(long rowIndex)throws ReadDriverException 	{return null;}
431
//		public String getPKName(int fieldId) throws ReadDriverException 			{return null;}
432
//		public String[] getPKNames() throws ReadDriverException 					{return null;}
433
//		public int getPKType(int i) throws ReadDriverException 						{return 0;}
434
//		public int getPKCardinality() throws ReadDriverException 					{return 0;}
435
//		public Value[] getRow(long rowIndex) throws ReadDriverException 			{return null;}
436
//		public DataWare getDataWare(int mode) throws ReadDriverException 			{return null;}
437
//		public boolean isVirtualField(int fieldId) throws ReadDriverException 		{return false;}
438
//		public Driver getDriver() 													{return null;}
439
//		public void reload() throws ReloadDriverException 							{ }
440
//		public void addDataSourceListener(IDataSourceListener listener) 			{ }
441
//		public void removeDataSourceListener(IDataSourceListener listener) 			{ }
442
//		public Value getFieldValue(long rowIndex, int fieldId)throws ReadDriverException {return null;}
443
//		public int getFieldCount() throws ReadDriverException 						{return 0;}
444
//		public long getRowCount() throws ReadDriverException 						{return 0;}
445
//		public int getFieldWidth(int i) throws ReadDriverException 					{return 0;}
446
//
447
//		public String getFieldName(int fieldId) throws ReadDriverException {
448
//			return fieldNames[fieldId];
449
//		}
450
//
451
//		public String getName(){
452
//			return "Mock datasource used for testing only";
453
//		}
454
//
455
//		public String[] getFieldNames() throws ReadDriverException {
456
//			return fieldNames;
457
//		}
458
//
459
//		public int getFieldIndexByName(String fieldName)throws ReadDriverException {
460
//			for (int i = 0; i < fieldNames.length; i++) {
461
//				if (fieldNames[i].equals(fieldName))
462
//					return i;
463
//			}
464
//			return -1;
465
//		}
466
//
467
//		public int getFieldType(int i) throws ReadDriverException {
468
//			return Types.INTEGER;
469
//		}
470 427

  
471
		public boolean implementsOperation(int code) {
428
		public DataSet getSelection() throws DataException {
472 429
			// TODO Auto-generated method stub
473
			return false;
430
			return null;
474 431
		}
475 432

  
476
		public boolean implementsOperation(String name) {
433
		public void refresh() throws DataException {
477 434
			// TODO Auto-generated method stub
478
			return false;
435

  
479 436
		}
480 437

  
481
		public Object invokeOperation(int code,
482
				DataStoreOperationContext context)
483
				throws DataStoreOperationException,
484
				DataStoreOperationNotSupportedException {
438
		public void setSelection(DataSet selection) throws DataException {
485 439
			// TODO Auto-generated method stub
486
			return null;
440

  
487 441
		}
488 442

  
489
		public Object invokeOperation(String name,
490
				DataStoreOperationContext context)
491
				throws DataStoreOperationException,
492
				DataStoreOperationNotSupportedException {
443
		public void beginComplexNotification() {
493 444
			// TODO Auto-generated method stub
494
			return null;
445

  
495 446
		}
496 447

  
497
		public boolean canWriteGeometry(int gvSIGgeometryType) {
448
		public void disableNotifications() {
498 449
			// TODO Auto-generated method stub
499
			return false;
450

  
500 451
		}
501 452

  
502
		public Feature getByIndex(long index) throws ReadException {
453
		public void enableNotifications() {
503 454
			// TODO Auto-generated method stub
504
			return null;
455

  
505 456
		}
506 457

  
507
		public void createIndex(FeatureType fType, String colName) throws IndexException {
458
		public void endComplexNotification() {
508 459
			// TODO Auto-generated method stub
509 460

  
510 461
		}
511 462

  
512
		public boolean hasIndex(FeatureType fType, String colName) {
463
		public void addObserver(Observer o) {
513 464
			// TODO Auto-generated method stub
514
			return false;
465

  
515 466
		}
516 467

  
517
		public XMLEntity getXMLEntity() {
468
		public void deleteObserver(Observer o) {
518 469
			// TODO Auto-generated method stub
519
			return null;
470

  
520 471
		}
521 472

  
522
		public void setXMLEntity(XMLEntity xmlEntity) throws XMLException {
473
		public void deleteObservers() {
523 474
			// TODO Auto-generated method stub
524 475

  
525 476
		}
526 477

  
527
		public String getClassName() {
478
		public Metadata getMetadata() throws BaseException {
528 479
			// TODO Auto-generated method stub
529 480
			return null;
530 481
		}
531 482

  
532
		public FeatureAttributeDescriptor addEvaluatedAttribute(
533
				FeatureType featureType, String attributeName,
534
				String attributeType, String expression,
535
				AttributeValueEvaluator evaluator) throws ReadException {
483
		public PersistentState getState() throws PersistenceException {
536 484
			// TODO Auto-generated method stub
537 485
			return null;
538 486
		}
539 487

  
540
		public void removeEvaluatedAttribute(FeatureAttributeDescriptor attibute)
541
				throws DataException {
488
		public void loadState(PersistentState state)
489
				throws PersistenceException {
542 490
			// TODO Auto-generated method stub
543 491

  
544 492
		}
545 493

  
546
		public DataSet getDataCollection(FeatureQuery featureQuery)
547
				throws ReadException {
494
		public void setState(PersistentState state) throws PersistenceException {
548 495
			// TODO Auto-generated method stub
549
			return null;
550
		}
551 496

  
552
		public void getDataCollection(FeatureQuery featureQuery,
553
				Observer observer) throws DataException {
554
			// TODO Auto-generated method stub
555

  
556 497
		}
557 498

  
558
		public FeatureSet getFeatureSet() throws ReadException {
499
		public Object getOperation(int code) throws OperationException,
500
				OperationNotSupportedException {
559 501
			// TODO Auto-generated method stub
560 502
			return null;
561 503
		}
562 504

  
563
		public FeatureSet getFeatureSet(FeatureQuery featureQuery)
564
				throws ReadException {
505
		public Object getOperation(String name) throws OperationException,
506
				OperationNotSupportedException {
565 507
			// TODO Auto-generated method stub
566 508
			return null;
567 509
		}
568 510

  
569
		public void getFeatureSet(FeatureQuery featureQuery,
570
				Observer observer) throws DataException {
511
		public boolean hasOperation(int code) {
571 512
			// TODO Auto-generated method stub
572

  
513
			return false;
573 514
		}
574 515

  
575
		public void getFeatureSet(Observer observer)
576
				throws DataException {
516
		public boolean hasOperation(String name) {
577 517
			// TODO Auto-generated method stub
578

  
518
			return false;
579 519
		}
580 520

  
581
		public DataSet getDataSet(DataQuery dataQuery)
582
				throws ReadException {
521
		public Object invokeOperation(int code, OperationContext context)
522
				throws OperationException, OperationNotSupportedException {
583 523
			// TODO Auto-generated method stub
584 524
			return null;
585 525
		}
586 526

  
587
		public void getDataSet(DataQuery dataQuery, Observer observer)
588
				throws DataException {
527
		public Object invokeOperation(String name, OperationContext context)
528
				throws OperationException, OperationNotSupportedException {
589 529
			// TODO Auto-generated method stub
590

  
591
		}
592

  
593
		public final DefaultFeatureSelection getFeatureSelection() {
594 530
			return null;
595 531
		}
596 532

  
597
		public DefaultFeatureSelection createFeatureSelection() {
533
		public FeatureQuery createFeatureQuery() {
534
			// TODO Auto-generated method stub
598 535
			return null;
599 536
		}
600 537

  
601
		public final void setSelection(DefaultFeatureSelection selection) throws DataException {
602
		}
603

  
604 538
	}
605 539

  
606 540
	//private static final FInterval interval0=new FInterval(0,2);

Also available in: Unified diff