Revision 7272 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java
EditableAdapter.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
/** |
42 | 42 |
* DOCUMENT ME! |
43 |
*
|
|
43 |
* |
|
44 | 44 |
* @author Vicente Caballero Navarro |
45 | 45 |
*/ |
46 | 46 |
public class EditableAdapter implements IEditableSource, IWriteable { |
... | ... | |
65 | 65 |
protected ArrayList listFields = new ArrayList(); |
66 | 66 |
|
67 | 67 |
protected ArrayList listInternalFields = new ArrayList(); |
68 |
|
|
68 |
|
|
69 | 69 |
protected boolean bFieldsHasBeenChanged = false; |
70 | 70 |
|
71 | 71 |
/** |
... | ... | |
77 | 77 |
* borran campos. Solo se van a?adiendo nuevos actualFields. |
78 | 78 |
*/ |
79 | 79 |
protected TreeMap actualFields; // la clave ser? el fieldId. |
80 |
|
|
80 |
|
|
81 | 81 |
protected ArrayList fastAccessFields = new ArrayList(); |
82 | 82 |
|
83 | 83 |
protected class MyFieldManager extends AbstractFieldManager { |
... | ... | |
135 | 135 |
|
136 | 136 |
protected int actualIndexFields; |
137 | 137 |
|
138 |
protected boolean isFullExtentDirty = false; |
|
139 |
|
|
138 | 140 |
/** |
139 | 141 |
* Crea un nuevo EditableAdapter. |
140 | 142 |
*/ |
... | ... | |
145 | 147 |
|
146 | 148 |
/** |
147 | 149 |
* DOCUMENT ME! |
148 |
*
|
|
150 |
* |
|
149 | 151 |
* @param ds |
150 | 152 |
* DOCUMENT ME! |
151 |
* @throws DriverException
|
|
153 |
* @throws DriverException |
|
152 | 154 |
*/ |
153 | 155 |
public void setOriginalDataSource(SelectableDataSource ds) throws DriverException { |
154 | 156 |
this.ods = ds; |
... | ... | |
158 | 160 |
setWriter(((IWriteable) drv).getWriter()); |
159 | 161 |
} |
160 | 162 |
|
161 |
|
|
163 |
|
|
162 | 164 |
} |
163 | 165 |
|
164 | 166 |
/** |
... | ... | |
197 | 199 |
InternalField clonedField = fld.cloneInternalField(); |
198 | 200 |
clonedFields.put(clonedField.getFieldId(), clonedField); |
199 | 201 |
} |
200 |
|
|
202 |
|
|
201 | 203 |
return clonedFields; |
202 | 204 |
} |
203 | 205 |
private void fieldsChanged() throws EditionException { |
... | ... | |
226 | 228 |
|
227 | 229 |
/** |
228 | 230 |
* DOCUMENT ME! |
229 |
*
|
|
231 |
* |
|
230 | 232 |
* @throws EditionException |
231 | 233 |
* DOCUMENT ME! |
232 | 234 |
*/ |
... | ... | |
242 | 244 |
* escribimos sobre la misma tabla) y luego se itera por los nuevos |
243 | 245 |
* registros llamando a process con el registro correcto. (A?adidos, |
244 | 246 |
* modificados). Para finalizar, se ejecuta PostProcess |
245 |
*
|
|
247 |
* |
|
246 | 248 |
* @param writer |
247 | 249 |
* IWriter que recibir? las llamadas. |
248 |
*
|
|
250 |
* |
|
249 | 251 |
* @throws EditionException |
250 | 252 |
* DOCUMENT ME! |
251 |
*
|
|
253 |
* |
|
252 | 254 |
*/ |
253 | 255 |
public void stopEdition(IWriter writer, int sourceType) |
254 | 256 |
throws EditionException { |
... | ... | |
260 | 262 |
|
261 | 263 |
public void saveEdits(IWriter writer, int sourceType) |
262 | 264 |
throws EditionException { |
263 |
|
|
265 |
|
|
264 | 266 |
// TODO: ARREGLAR ESTO PARA QUE CUANDO HA HABIDO CAMBIOS |
265 | 267 |
// EN LOS CAMPOS, PODAMOS CAMBIAR LO QUE TOQUE (A SER POSIBLE |
266 | 268 |
// SIN TENER QUE REESCRIBIR TODA LA TABLA CON POSTGIS) |
267 | 269 |
if (bFieldsHasBeenChanged) |
268 | 270 |
{ |
269 |
// Para cada campo de los originales, miramos si no est? en
|
|
271 |
// Para cada campo de los originales, miramos si no est? en |
|
270 | 272 |
// los actuales. Si no est?, le decimos al fieldManager |
271 | 273 |
// que lo borre. Si est?, pero le hemos cambiado el nombre |
272 | 274 |
// le pedimos al fieldManager que le cambie el nombre. |
273 | 275 |
// Luego recorremos los campos actuales para ver cuales |
274 | 276 |
// son nuevos, y los a?adimos. |
275 |
|
|
277 |
|
|
276 | 278 |
TreeMap ancientFields = (TreeMap) listInternalFields |
277 | 279 |
.get(0); |
278 | 280 |
Collection aux = ancientFields.values(); |
... | ... | |
287 | 289 |
if (f1.compareTo(f2) != 0) |
288 | 290 |
{ |
289 | 291 |
getFieldManager().renameField(f1, f2); |
290 |
}
|
|
292 |
} |
|
291 | 293 |
} |
292 | 294 |
else |
293 | 295 |
{ // No est?, hay que borrarlo |
... | ... | |
306 | 308 |
} |
307 | 309 |
// getFieldManager().alterTable(); // Se llama dentro del preprocess() |
308 | 310 |
} |
309 |
|
|
311 |
|
|
310 | 312 |
writer.preProcess(); |
311 | 313 |
|
312 | 314 |
try { |
... | ... | |
362 | 364 |
ods.reload(); |
363 | 365 |
ds = null; |
364 | 366 |
clean(); |
365 |
|
|
367 |
|
|
366 | 368 |
} catch (DriverIOException e) { |
367 | 369 |
e.printStackTrace(); |
368 | 370 |
throw new EditionException(e); |
... | ... | |
378 | 380 |
|
379 | 381 |
/** |
380 | 382 |
* DOCUMENT ME! |
381 |
*
|
|
383 |
* |
|
382 | 384 |
* @throws IOException |
383 | 385 |
* DOCUMENT ME! |
384 | 386 |
*/ |
... | ... | |
397 | 399 |
|
398 | 400 |
/* |
399 | 401 |
* (non-Javadoc) |
400 |
*
|
|
402 |
* |
|
401 | 403 |
* @see com.iver.cit.gvsig.fmap.edition.IEditableSource#getRow(int) |
402 | 404 |
*/ |
403 | 405 |
public IRowEdited getRow(int index) throws DriverIOException, IOException { |
... | ... | |
433 | 435 |
.cloneRow(), rowFromExpansion.getStatus(), index); |
434 | 436 |
return edRow; |
435 | 437 |
} |
436 |
|
|
437 |
|
|
438 | 438 |
|
439 |
|
|
440 |
|
|
439 | 441 |
} |
440 | 442 |
|
441 | 443 |
/** |
442 | 444 |
* DOCUMENT ME! |
443 |
*
|
|
445 |
* |
|
444 | 446 |
* @return DOCUMENT ME! |
445 |
*
|
|
447 |
* |
|
446 | 448 |
* @throws DriverIOException |
447 | 449 |
* DOCUMENT ME! |
448 | 450 |
* @throws IOException |
... | ... | |
460 | 462 |
|
461 | 463 |
/* |
462 | 464 |
* (non-Javadoc) |
463 |
*
|
|
465 |
* |
|
464 | 466 |
* @see com.iver.cit.gvsig.fmap.edition.IEditableSource#addRow(com.iver.cit.gvsig.fmap.core.IRow, |
465 | 467 |
* java.lang.String) |
466 | 468 |
*/ |
... | ... | |
489 | 491 |
|
490 | 492 |
/** |
491 | 493 |
* DOCUMENT ME! |
492 |
*
|
|
494 |
* |
|
493 | 495 |
* @throws DriverIOException |
494 | 496 |
* DOCUMENT ME! |
495 | 497 |
* @throws IOException |
... | ... | |
504 | 506 |
|
505 | 507 |
/** |
506 | 508 |
* DOCUMENT ME! |
507 |
*
|
|
509 |
* |
|
508 | 510 |
* @throws DriverIOException |
509 | 511 |
* DOCUMENT ME! |
510 | 512 |
* @throws IOException |
... | ... | |
519 | 521 |
|
520 | 522 |
/* |
521 | 523 |
* (non-Javadoc) |
522 |
*
|
|
524 |
* |
|
523 | 525 |
* @see com.iver.cit.gvsig.fmap.edition.IEditableSource#removeRow(int) |
524 | 526 |
*/ |
525 | 527 |
public void removeRow(int index, String descrip, int sourceType) |
... | ... | |
540 | 542 |
|
541 | 543 |
/* |
542 | 544 |
* (non-Javadoc) |
543 |
*
|
|
545 |
* |
|
544 | 546 |
* @see com.iver.cit.gvsig.fmap.edition.IEditableSource#modifyRow(int, |
545 | 547 |
* com.iver.cit.gvsig.fmap.core.IRow) |
546 | 548 |
*/ |
... | ... | |
585 | 587 |
|
586 | 588 |
/** |
587 | 589 |
* DOCUMENT ME! |
588 |
*
|
|
590 |
* |
|
589 | 591 |
* @throws IOException |
590 | 592 |
* DOCUMENT ME! |
591 | 593 |
* @throws DriverIOException |
... | ... | |
604 | 606 |
* fuera una modificaci?n de una geometr?a que estuviese en el fichero de |
605 | 607 |
* expansi?n antes de ser modificada y se pone el puntero de escritura del |
606 | 608 |
* expansion file a justo despues de la penultima geometr?a |
607 |
*
|
|
609 |
* |
|
608 | 610 |
* @param geometryIndex |
609 | 611 |
* ?ndice de la geometr?a que se quiere deshacer su modificaci?n |
610 | 612 |
* @param previousExpansionFileIndex |
... | ... | |
612 | 614 |
* vale -1 quiere decir que es una modificaci?n de una geometr?a |
613 | 615 |
* original y por tanto no hay que actualizar el mapa de indices |
614 | 616 |
* sino eliminar su entrada. |
615 |
*
|
|
617 |
* |
|
616 | 618 |
* @throws IOException |
617 | 619 |
* @throws DriverIOException |
618 | 620 |
*/ |
... | ... | |
654 | 656 |
* se marca como eliminada (haya sido modificada o no). Si es una geometr?a |
655 | 657 |
* a?adida posteriormente se invalida en el fichero de expansi?n, para que |
656 | 658 |
* una futura compactaci?n termine con ella. |
657 |
*
|
|
659 |
* |
|
658 | 660 |
* @param index |
659 | 661 |
* ?ndice de la geometr?a. |
660 |
*
|
|
662 |
* |
|
661 | 663 |
* @throws DriverIOException |
662 | 664 |
* @throws IOException |
663 | 665 |
*/ |
... | ... | |
671 | 673 |
System.err.println("Elimina una Row en la posici?n: " + index); |
672 | 674 |
// TODO: Con tablas no es necesario devolver la anterior feature. Por |
673 | 675 |
// ahora. |
676 |
isFullExtentDirty = true; |
|
674 | 677 |
fireAfterRemoveRow(index, sourceType); |
675 | 678 |
return null; |
676 | 679 |
} |
... | ... | |
682 | 685 |
* fichero de expansi?n (por ser nueva o original pero modificada) se invoca |
683 | 686 |
* el m?todo modifyGeometry y se actualiza el ?ndice de la geometria en el |
684 | 687 |
* fichero. |
685 |
*
|
|
688 |
* |
|
686 | 689 |
* @param index |
687 | 690 |
* DOCUMENT ME! |
688 | 691 |
* @param feat |
689 | 692 |
* DOCUMENT ME! |
690 |
*
|
|
693 |
* |
|
691 | 694 |
* @return DOCUMENT ME! |
692 |
*
|
|
695 |
* |
|
693 | 696 |
* @throws IOException |
694 | 697 |
* @throws DriverIOException |
695 | 698 |
*/ |
... | ... | |
725 | 728 |
*/ |
726 | 729 |
relations.put(integer, new Integer(num)); |
727 | 730 |
} |
731 |
isFullExtentDirty = true; |
|
728 | 732 |
fireAfterModifyRow(index, sourceType); |
729 | 733 |
return pos; |
730 | 734 |
} |
... | ... | |
732 | 736 |
/** |
733 | 737 |
* A?ade una geometria al fichero de expansi?n y guarda la correspondencia |
734 | 738 |
* en la tabla relations. |
735 |
*
|
|
739 |
* |
|
736 | 740 |
* @param feat |
737 | 741 |
* geometr?a a guardar. |
738 |
*
|
|
742 |
* |
|
739 | 743 |
* @return calculatedIndex |
740 |
*
|
|
744 |
* |
|
741 | 745 |
* @throws DriverIOException |
742 | 746 |
* @throws IOException |
743 | 747 |
*/ |
... | ... | |
762 | 766 |
relations.put(new Integer(calculatedIndex), new Integer(pos)); |
763 | 767 |
numAdd++; |
764 | 768 |
System.err.println("A?ade una Row en la posici?n: " + calculatedIndex); |
769 |
isFullExtentDirty = true; |
|
765 | 770 |
fireAfterRowAdded(calculatedIndex, sourceType); |
766 | 771 |
return calculatedIndex; |
767 | 772 |
} |
... | ... | |
769 | 774 |
/** |
770 | 775 |
* Se desmarca como invalidada en el fichero de expansion o como eliminada |
771 | 776 |
* en el fichero original |
772 |
*
|
|
777 |
* |
|
773 | 778 |
* @param index |
774 | 779 |
* DOCUMENT ME! |
775 |
*
|
|
780 |
* |
|
776 | 781 |
* @throws IOException |
777 | 782 |
* @throws DriverIOException |
778 | 783 |
*/ |
... | ... | |
789 | 794 |
* Se elimina del final del fichero de expansi?n poniendo el puntero de |
790 | 795 |
* escritura apuntando al final de la pen?ltima geometr?a. Deber? quitar la |
791 | 796 |
* relaci?n del mapa de relaciones |
792 |
*
|
|
797 |
* |
|
793 | 798 |
* @param index |
794 | 799 |
* ?ndice de la geometr?a que se a?adi? |
795 |
*
|
|
800 |
* |
|
796 | 801 |
* @throws DriverIOException |
797 | 802 |
* @throws IOException |
798 | 803 |
*/ |
... | ... | |
809 | 814 |
|
810 | 815 |
/* |
811 | 816 |
* (non-Javadoc) |
812 |
*
|
|
817 |
* |
|
813 | 818 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset() |
814 | 819 |
*/ |
815 | 820 |
public SelectableDataSource getRecordset() throws DriverLoadException { |
... | ... | |
819 | 824 |
.addDataSource((ObjectDriver) editingDriver); |
820 | 825 |
|
821 | 826 |
try { |
822 |
|
|
827 |
|
|
823 | 828 |
ds = new SelectableDataSource(LayerFactory |
824 | 829 |
.getDataSourceFactory().createRandomDataSource( |
825 | 830 |
name, DataSourceFactory.MANUAL_OPENING)); |
... | ... | |
842 | 847 |
|
843 | 848 |
/** |
844 | 849 |
* DOCUMENT ME! |
845 |
*
|
|
850 |
* |
|
846 | 851 |
* @return |
847 | 852 |
*/ |
848 | 853 |
public FBitSet getSelection() { |
... | ... | |
865 | 870 |
|
866 | 871 |
/** |
867 | 872 |
* DOCUMENT ME! |
868 |
*
|
|
873 |
* |
|
869 | 874 |
* @return DOCUMENT ME! |
870 | 875 |
*/ |
871 | 876 |
public boolean isEditing() { |
... | ... | |
898 | 903 |
|
899 | 904 |
/** |
900 | 905 |
* DOCUMENT ME! |
901 |
*
|
|
906 |
* |
|
902 | 907 |
* @param rowIndex |
903 | 908 |
* DOCUMENT ME! |
904 |
*
|
|
909 |
* |
|
905 | 910 |
* @return DOCUMENT ME! |
906 | 911 |
*/ |
907 | 912 |
public int getCalculatedIndex(long rowIndex) { |
... | ... | |
930 | 935 |
|
931 | 936 |
/** |
932 | 937 |
* DOCUMENT ME! |
933 |
*
|
|
938 |
* |
|
934 | 939 |
* @author Vicente Caballero Navarro |
935 | 940 |
*/ |
936 | 941 |
private class myObjectDriver implements ObjectDriver { |
937 | 942 |
/* |
938 | 943 |
* (non-Javadoc) |
939 |
*
|
|
944 |
* |
|
940 | 945 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys() |
941 | 946 |
*/ |
942 | 947 |
public int[] getPrimaryKeys() throws DriverException { |
... | ... | |
951 | 956 |
|
952 | 957 |
/* |
953 | 958 |
* (non-Javadoc) |
954 |
*
|
|
959 |
* |
|
955 | 960 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare) |
956 | 961 |
*/ |
957 | 962 |
public void write(DataWare dataWare) throws DriverException { |
... | ... | |
962 | 967 |
|
963 | 968 |
/* |
964 | 969 |
* (non-Javadoc) |
965 |
*
|
|
970 |
* |
|
966 | 971 |
* @see com.hardcode.gdbms.engine.data.driver.GDBMSDriver#setDataSourceFactory(com.hardcode.gdbms.engine.data.DataSourceFactory) |
967 | 972 |
*/ |
968 | 973 |
public void setDataSourceFactory(DataSourceFactory dsf) { |
... | ... | |
971 | 976 |
|
972 | 977 |
/* |
973 | 978 |
* (non-Javadoc) |
974 |
*
|
|
979 |
* |
|
975 | 980 |
* @see com.hardcode.driverManager.Driver#getName() |
976 | 981 |
*/ |
977 | 982 |
public String getName() { |
... | ... | |
980 | 985 |
|
981 | 986 |
/* |
982 | 987 |
* (non-Javadoc) |
983 |
*
|
|
988 |
* |
|
984 | 989 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldValue(long, |
985 | 990 |
* int) |
986 | 991 |
*/ |
... | ... | |
1033 | 1038 |
|
1034 | 1039 |
/* |
1035 | 1040 |
* (non-Javadoc) |
1036 |
*
|
|
1041 |
* |
|
1037 | 1042 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldCount() |
1038 | 1043 |
*/ |
1039 | 1044 |
public int getFieldCount() throws DriverException { |
... | ... | |
1042 | 1047 |
|
1043 | 1048 |
/* |
1044 | 1049 |
* (non-Javadoc) |
1045 |
*
|
|
1050 |
* |
|
1046 | 1051 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldName(int) |
1047 | 1052 |
*/ |
1048 | 1053 |
public String getFieldName(int fieldId) throws DriverException { |
... | ... | |
1052 | 1057 |
// if (i == fieldId) |
1053 | 1058 |
// return fld.getFieldDesc().getFieldAlias(); |
1054 | 1059 |
// i++; |
1055 |
//
|
|
1060 |
// |
|
1056 | 1061 |
// } |
1057 | 1062 |
// throw new DriverException("FieldId " + fieldId + " not found "); |
1058 | 1063 |
FieldDescription aux = (FieldDescription) fastAccessFields.get(fieldId); |
... | ... | |
1063 | 1068 |
|
1064 | 1069 |
/* |
1065 | 1070 |
* (non-Javadoc) |
1066 |
*
|
|
1071 |
* |
|
1067 | 1072 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getRowCount() |
1068 | 1073 |
*/ |
1069 | 1074 |
public long getRowCount() { |
... | ... | |
1081 | 1086 |
|
1082 | 1087 |
/* |
1083 | 1088 |
* (non-Javadoc) |
1084 |
*
|
|
1089 |
* |
|
1085 | 1090 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldType(int) |
1086 | 1091 |
*/ |
1087 | 1092 |
public int getFieldType(int fieldId) throws DriverException { |
... | ... | |
1091 | 1096 |
// if (i == fieldId) |
1092 | 1097 |
// return fld.getFieldDesc().getFieldType(); |
1093 | 1098 |
// i++; |
1094 |
//
|
|
1099 |
// |
|
1095 | 1100 |
// } |
1096 | 1101 |
FieldDescription aux = (FieldDescription) fastAccessFields.get(fieldId); |
1097 | 1102 |
return aux.getFieldType(); |
1098 |
|
|
1103 |
|
|
1099 | 1104 |
// return ods.getFieldType(i); |
1100 | 1105 |
} |
1101 | 1106 |
|
1102 | 1107 |
public int getFieldWidth(int fieldId) throws DriverException { |
1103 | 1108 |
// int i=0; |
1104 |
// for (Iterator iter = actualFields.values().iterator(); iter.hasNext();) {
|
|
1109 |
// for (Iterator iter = actualFields.values().iterator(); iter.hasNext();) { |
|
1105 | 1110 |
// InternalField fld = (InternalField) iter.next(); |
1106 | 1111 |
//// if (fld.getFieldIndex() == i) |
1107 | 1112 |
//// return fld.getFieldDesc().getFieldLength(); |
1108 | 1113 |
// if (i == fieldId) |
1109 | 1114 |
// return fld.getFieldDesc().getFieldLength(); |
1110 | 1115 |
// i++; |
1111 |
//
|
|
1116 |
// |
|
1112 | 1117 |
// } |
1113 | 1118 |
// |
1114 | 1119 |
// return ods.getFieldWidth(i); |
... | ... | |
1119 | 1124 |
|
1120 | 1125 |
public void reload() throws IOException, DriverException { |
1121 | 1126 |
ods.reload(); |
1122 |
|
|
1127 |
|
|
1123 | 1128 |
} |
1124 | 1129 |
} |
1125 | 1130 |
|
... | ... | |
1191 | 1196 |
listener.afterFieldEditEvent(event); |
1192 | 1197 |
} |
1193 | 1198 |
} |
1194 |
|
|
1195 |
|
|
1199 |
|
|
1200 |
|
|
1196 | 1201 |
protected boolean fireBeforeRowAdded(int sourceType) |
1197 | 1202 |
throws DriverIOException, IOException { |
1198 | 1203 |
Cancel cancel = new Cancel(); |
... | ... | |
1238 | 1243 |
return false; |
1239 | 1244 |
} |
1240 | 1245 |
|
1241 |
|
|
1246 |
|
|
1242 | 1247 |
protected boolean fireBeforeModifyRow(IRow feat, int index, int sourceType) { |
1243 | 1248 |
Cancel cancel = new Cancel(); |
1244 | 1249 |
BeforeRowEditEvent event = new BeforeRowEditEvent(this, index, |
... | ... | |
1355 | 1360 |
// listInternalFields, pero casi seguro que lo correcto ser?a hacer un |
1356 | 1361 |
// reload completo. |
1357 | 1362 |
initalizeFields(ods); |
1358 |
|
|
1363 |
|
|
1359 | 1364 |
// listInternalFields.clear(); |
1360 | 1365 |
// listInternalFields.add(actualFields); |
1361 | 1366 |
} |
1362 | 1367 |
|
1363 | 1368 |
/* |
1364 | 1369 |
* (non-Javadoc) |
1365 |
*
|
|
1370 |
* |
|
1366 | 1371 |
* @see com.iver.cit.gvsig.fmap.edition.IEditableSource#getFieldManager() |
1367 | 1372 |
*/ |
1368 | 1373 |
public IFieldManager getFieldManager() { |
... | ... | |
1381 | 1386 |
/** |
1382 | 1387 |
* Tiene en cuenta los campos actuales para formatear una row con ellos. Le |
1383 | 1388 |
* pasamos los campos que hab?a en el momento en que se cre? esa row. |
1384 |
*
|
|
1389 |
* |
|
1385 | 1390 |
* @param edRow |
1386 | 1391 |
* @param indexInternalFields |
1387 | 1392 |
* @return |
1388 | 1393 |
*/ |
1389 | 1394 |
public IRowEdited createExternalRow(IRowEdited edRow, |
1390 | 1395 |
int indexInternalFields) { |
1391 |
|
|
1396 |
|
|
1392 | 1397 |
// para acelerar |
1393 | 1398 |
if (bFieldsHasBeenChanged == false) |
1394 | 1399 |
return edRow; |
1395 |
|
|
1400 |
|
|
1396 | 1401 |
Value[] att = edRow.getAttributes(); |
1397 | 1402 |
TreeMap ancientFields = (TreeMap) listInternalFields |
1398 | 1403 |
.get(indexInternalFields); |
... | ... | |
1403 | 1408 |
Value val = null; |
1404 | 1409 |
while (it.hasNext()) { |
1405 | 1410 |
// Para cada campo de los actuales, miramos si ya estaba cuando |
1406 |
// el registro estaba guardado.
|
|
1411 |
// el registro estaba guardado. |
|
1407 | 1412 |
// Si estaba, cogemos el valor de ese campo en el registro |
1408 | 1413 |
// guardado. Si no estaba, ha sido a?adido despu?s y ponemos |
1409 | 1414 |
// su valor por defecto. |
... | ... | |
1452 | 1457 |
if (fld.getFieldDesc().getFieldAlias().compareToIgnoreCase(fieldName) == 0) |
1453 | 1458 |
return fld; |
1454 | 1459 |
} |
1455 |
|
|
1460 |
|
|
1456 | 1461 |
return null; |
1457 | 1462 |
} |
1458 | 1463 |
|
... | ... | |
1484 | 1489 |
doRenameField(fld, newName); |
1485 | 1490 |
|
1486 | 1491 |
} |
1487 |
|
|
1492 |
|
|
1488 | 1493 |
public void undoRenameField(InternalField field, String antName) throws EditionException { |
1489 | 1494 |
field.getFieldDesc().setFieldAlias(antName); |
1490 | 1495 |
fieldsChanged(); |
... | ... | |
1523 | 1528 |
actualFields.remove(field.getFieldId()); |
1524 | 1529 |
fieldsChanged(); |
1525 | 1530 |
fireAfterFieldRemoved(field.getFieldDesc()); |
1526 |
|
|
1531 |
|
|
1527 | 1532 |
} |
1528 | 1533 |
|
1529 | 1534 |
public int doAddField(InternalField field) throws EditionException { |
... | ... | |
1540 | 1545 |
// return field.getFieldIndex(); |
1541 | 1546 |
return field.getFieldId().intValue(); |
1542 | 1547 |
} |
1543 |
|
|
1548 |
|
|
1544 | 1549 |
public Driver getOriginalDriver() |
1545 | 1550 |
{ |
1546 | 1551 |
return ods.getDriver(); |
1547 | 1552 |
} |
1548 |
|
|
1553 |
|
|
1549 | 1554 |
/** |
1550 | 1555 |
* Use it to be sure the recordset will have the right fields. It forces a new SelectableDataSource |
1551 | 1556 |
* to be created next time it is needed |
... | ... | |
1558 | 1563 |
return (FieldDescription[]) fastAccessFields.toArray(new FieldDescription[0]); |
1559 | 1564 |
} |
1560 | 1565 |
|
1561 |
|
|
1566 |
|
|
1562 | 1567 |
// private InternalField getInternalFieldByIndex(int fieldId) |
1563 | 1568 |
// { |
1564 | 1569 |
// for (Iterator iter = actualFields.values().iterator(); iter.hasNext();) { |
... | ... | |
1568 | 1573 |
// } |
1569 | 1574 |
// return null; |
1570 | 1575 |
// } |
1571 |
|
|
1576 |
|
|
1572 | 1577 |
} |
Also available in: Unified diff