Revision 12148 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java

View differences:

AnnotationEditableAdapter.java
167 167

  
168 168

  
169 169
	public int doAddRow(IRow feat, int sourceType) throws ReadDriverException, ExpansionFileWriteException {
170
		boolean cancel = fireBeforeRowAdded(sourceType);
170
		boolean cancel = fireBeforeRowAdded(sourceType,feat.getID());
171 171
		if (cancel)
172 172
			return -1;
173 173
		Value[] values=feat.getAttributes();
......
185 185
		///lyrAnnotation.deleteSpatialIndex();
186 186

  
187 187
		int calculatedIndex = -1;
188
		calculatedIndex = getNewIndex() ;
188
		calculatedIndex = (int) getOriginalRecordset().getRowCount() + numAdd;
189 189

  
190 190
		int pos = expansionFile.addRow(feat, IRowEdited.STATUS_ADDED, actualIndexFields);
191 191
		labelExpansion.addLabel(label);
......
200 200
	}
201 201

  
202 202
	public int doModifyRow(int calculatedIndex, IRow feat,int sourceType) throws ExpansionFileWriteException {
203
		boolean cancel = fireBeforeModifyRow(feat,calculatedIndex, sourceType);
203
		boolean cancel;
204
		try {
205
			cancel = fireBeforeModifyRow(feat,calculatedIndex, sourceType);
206
		} catch (ReadDriverException e) {
207
			throw new ExpansionFileWriteException(writer.getName(),e);
208
		}
204 209
		if (cancel)
205 210
			return -1;
206 211
		int posAnteriorInExpansionFile = -1;
......
317 322
	}
318 323

  
319 324
	public void undoAddRow(int calculatedIndex, int sourceType) throws EditionCommandException {
320
		boolean cancel = fireBeforeRemoveRow(calculatedIndex, sourceType);
325
		boolean cancel=true;
326
		try {
327
			cancel = fireBeforeRemoveRow(calculatedIndex, sourceType);
328
		} catch (ReadDriverException e1) {
329
			throw new EditionCommandException(writer.getName(),e1);
330
		}
321 331
		if (cancel)
322 332
			return;
323 333
		Rectangle2D r = getLabel(calculatedIndex,true).getBoundBox();
......
405 415
	}
406 416

  
407 417
	public void undoRemoveRow(int index, int sourceType) throws EditionCommandException {
408
		boolean cancel;
418
		delRows.set(index, false);
419
		String fid;
409 420
		try {
410
			cancel = fireBeforeRowAdded(sourceType);
421
			fid = getRow(index).getID();
422

  
423
		boolean cancel = fireBeforeRowAdded(sourceType,fid);
424
		if (cancel){
425
			delRows.set(index,true);
426
			return;
427
		}
428
		} catch (ExpansionFileReadException e) {
429
			throw new EditionCommandException(lyrAnnotation.getName(),e);
411 430
		} catch (ReadDriverException e) {
412
			throw new EditionCommandException(writer.getName(),e);
431
			throw new EditionCommandException(lyrAnnotation.getName(),e);
413 432
		}
414
		if (cancel)
415
			return;
416
		delRows.set(index, false);
417 433
	    Rectangle2D r = getLabel(index,true).getBoundBox();
418 434
	    this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
419 435
	                r.getY(), r.getY() + r.getHeight()), new Integer(index));

Also available in: Unified diff