svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / IEditableSource.java @ 28367
History | View | Annotate | Download (9.58 KB)
1 |
package com.iver.cit.gvsig.fmap.edition; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import com.hardcode.driverManager.Driver; |
6 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
7 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
8 |
import com.iver.cit.gvsig.exceptions.commands.EditionCommandException; |
9 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
10 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException; |
11 |
import com.iver.cit.gvsig.exceptions.layers.CancelEditingLayerException; |
12 |
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException; |
13 |
import com.iver.cit.gvsig.exceptions.layers.StopEditionLayerException; |
14 |
import com.iver.cit.gvsig.exceptions.validate.ValidateRowException; |
15 |
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException; |
16 |
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException; |
17 |
import com.iver.cit.gvsig.fmap.core.IRow; |
18 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
19 |
import com.iver.cit.gvsig.fmap.drivers.FieldDescription; |
20 |
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition; |
21 |
import com.iver.cit.gvsig.fmap.edition.commands.CommandRecord; |
22 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
23 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
24 |
|
25 |
|
26 |
/**
|
27 |
* DOCUMENT ME!
|
28 |
*
|
29 |
* @author $author$
|
30 |
*/
|
31 |
public interface IEditableSource { |
32 |
/**
|
33 |
* M?todo invocado cuando se comienza la edici?n, para poner en marcha las
|
34 |
* estructuras de datos necesarias para la misma, notificar al servidor en
|
35 |
* protocolos en los que sea necesario, ...
|
36 |
* @throws StartEditionLayerException
|
37 |
* @throws StartWriterVisitorException
|
38 |
*
|
39 |
* @throws EditionException Si no se logra poner la fuente de datos en
|
40 |
* edici?n
|
41 |
*/
|
42 |
void startEdition(int sourceType) throws StartWriterVisitorException ; |
43 |
|
44 |
/**
|
45 |
* Invocado cuando termina la edici?n. En funci?n de la clase concreta que
|
46 |
* implemente este m?todo se generar? el fichero con los resultados de la
|
47 |
* edici?n, se realizar? una transacci?n a la base de datos, etc.
|
48 |
* @throws StopEditionLayerException
|
49 |
* @throws StopWriterVisitorException
|
50 |
*
|
51 |
* @throws EditionException Si no se consiguen llevar a cabo las
|
52 |
* modificaciones
|
53 |
*/
|
54 |
void stopEdition(IWriter writer, int sourceType) throws StopWriterVisitorException; |
55 |
|
56 |
/**
|
57 |
* Cancela la edici?n sin escribir los cambios
|
58 |
* @throws CancelEditingLayerException
|
59 |
*
|
60 |
* @throws IOException Si se produce un error
|
61 |
*/
|
62 |
void cancelEdition(int sourceType) throws CancelEditingLayerException; |
63 |
|
64 |
/**
|
65 |
* Si el ?ndice se corresponde a una geometria de las originales de la capa
|
66 |
* en edici?n y no ha sido modificada ni eliminada devuelve la geometria
|
67 |
* original. Si ha sido modificada debera de buscar en el fichero de
|
68 |
* expansi?n y si ha sido eliminada debera devolver null
|
69 |
*
|
70 |
* @param index ?ndice de la geometr?a.
|
71 |
*
|
72 |
* @return Geometr?a.
|
73 |
* @throws ReadDriverException
|
74 |
* @throws ExpansionFileReadException
|
75 |
*
|
76 |
* @throws IOException Si se produce un error con el fichero de expansi?n
|
77 |
* @throws DriverIOException Si se produce un error accediendo a las
|
78 |
* geometr?as originales
|
79 |
*/
|
80 |
IRowEdited getRow(int index) throws ReadDriverException, ExpansionFileReadException; |
81 |
|
82 |
/**
|
83 |
* Devuelve el n?mero de geometrias que hay actualmente en edici?n.
|
84 |
*
|
85 |
* @return N?mero de geometr?as.
|
86 |
* @throws ReadDriverException
|
87 |
*
|
88 |
* @throws DriverIOException Si se produce un error accediendo a la capa
|
89 |
* @throws DriverException
|
90 |
*/
|
91 |
int getRowCount() throws ReadDriverException; |
92 |
|
93 |
/**
|
94 |
* A?ade una geometria al fichero de expansi?n y guarda la correspondencia
|
95 |
* en una tabla asociada.
|
96 |
*
|
97 |
* @param g geometr?a a guardar.
|
98 |
* @throws ValidateRowException
|
99 |
* @throws ExpansionFileWriteException
|
100 |
* @throws ReadDriverException
|
101 |
*
|
102 |
* @throws DriverIOException Si se produce un error accediendo a las
|
103 |
* geometr?as originales
|
104 |
* @throws IOException Si se produce un error con el fichero de expansi?n
|
105 |
*/
|
106 |
int addRow(IRow row,String descrip, int sourceType) throws ValidateRowException, ReadDriverException, ExpansionFileWriteException; |
107 |
|
108 |
/**
|
109 |
* Deshace la ?ltima acci?n realizada. Si no hay m?s acciones no realiza
|
110 |
* ninguna acci?n
|
111 |
* @throws EditionCommandException
|
112 |
*
|
113 |
* @throws DriverIOException Si se produce un error accediendo a las
|
114 |
* geometr?as originales
|
115 |
* @throws IOException Si se produce un error con el fichero de expansi?n
|
116 |
*/
|
117 |
void undo() throws EditionCommandException; |
118 |
|
119 |
/**
|
120 |
* Rehace la ?ltima acci?n deshecha. Si no hay m?s acciones no hace nada
|
121 |
* @throws EditionCommandException
|
122 |
*
|
123 |
* @throws DriverIOException Si se produce un error accediendo a las
|
124 |
* filas originales
|
125 |
*/
|
126 |
void redo() throws EditionCommandException; |
127 |
|
128 |
/**
|
129 |
* Elimina una geometria. Si es una geometr?a original de la capa en
|
130 |
* edici?n se marca como eliminada (haya sido modificada o no). Si es una
|
131 |
* geometr?a a?adida posteriormente se invalida en el fichero de
|
132 |
* expansi?n, para que una futura compactaci?n termine con ella.
|
133 |
*
|
134 |
* @param index ?ndice de la geometr?a que se quiere eliminar
|
135 |
* @throws ExpansionFileReadException
|
136 |
* @throws ReadDriverException
|
137 |
*
|
138 |
* @throws DriverIOException Si se produce un error accediendo a las
|
139 |
* geometr?as originales
|
140 |
* @throws IOException Si se produce un error con el fichero de expansi?n
|
141 |
*/
|
142 |
void removeRow(int index,String descrip, int sourceType) throws ReadDriverException, ExpansionFileReadException; |
143 |
|
144 |
/**
|
145 |
* Si se intenta modificar una geometr?a original de la capa en edici?n se
|
146 |
* a?ade al fichero de expansi?n y se registra la posici?n en la que se
|
147 |
* a?adi?. Si se intenta modificar una geometria que se encuentra en el
|
148 |
* fichero de expansi?n (por ser nueva o original pero modificada) se
|
149 |
* invoca el m?todo modifyGeometry y se actualiza el ?ndice de la
|
150 |
* geometria en el fichero.
|
151 |
*
|
152 |
* @param index ?ndice de la geometr?a que se quiere eliminar
|
153 |
* @param type TODO
|
154 |
* @param g Geometr?a nueva
|
155 |
* @throws ExpansionFileWriteException
|
156 |
* @throws ValidateRowException
|
157 |
* @throws ReadDriverException
|
158 |
* @throws ExpansionFileReadException
|
159 |
* @throws IOException Si se produce un error con el fichero de expansi?n
|
160 |
* @throws DriverIOException Si se produce un error accediendo a las
|
161 |
* geometr?as originales
|
162 |
*/
|
163 |
int modifyRow(int index, IRow row,String descrip, int sourceType) throws ValidateRowException, ExpansionFileWriteException, ReadDriverException, ExpansionFileReadException; |
164 |
|
165 |
|
166 |
|
167 |
/**
|
168 |
* Compacta el almacenamiento de las geometr?as que est?n en edici?n. Tras
|
169 |
* esta operaci?n, el orden de las geometr?as seguramente cambiar? y toda
|
170 |
* llamada a getGeometry devolver? una geometr?a distinta de null, ya que
|
171 |
* las eliminadas son borradas definitivamente. Hay que tener especial
|
172 |
* cuidado al invocar este m?todo ya que cualquier tipo de asociaci?n
|
173 |
* entre geometr?as y otro tipo de objetos (comandos de edici?n, snapping,
|
174 |
* ...) que use el ?ndice de la geometr?a se ver? afectado por ?ste m?todo
|
175 |
*/
|
176 |
void compact();
|
177 |
|
178 |
/**
|
179 |
* Establece la imagen de las geometr?as seleccionadas con el fin de que en
|
180 |
* una edici?n interactiva se pueda obtener dicha imagen para simular el
|
181 |
* copiado, rotado, etc
|
182 |
*
|
183 |
* @param i imagen
|
184 |
*/
|
185 |
// void setSelectionImage(Image i);
|
186 |
|
187 |
/**
|
188 |
* Obtiene una imagen con las geometr?as seleccionadas
|
189 |
*
|
190 |
* @return imagen
|
191 |
*/
|
192 |
// Image getSelectionImage();
|
193 |
|
194 |
/**
|
195 |
* DOCUMENT ME!
|
196 |
*/
|
197 |
void startComplexRow();
|
198 |
|
199 |
void endComplexRow(String description); |
200 |
public int undoModifyRow(int geometryIndex,int previousExpansionFileIndex, int sourceType) throws EditionCommandException; |
201 |
public IRow doRemoveRow(int index, int sourceType) throws ReadDriverException, ExpansionFileReadException; |
202 |
public int doModifyRow(int index, IRow feat, int sourceType) throws ExpansionFileWriteException, ReadDriverException, ExpansionFileReadException; |
203 |
public int doAddRow(IRow feat, int sourceType) throws ReadDriverException, ExpansionFileWriteException; |
204 |
public void undoRemoveRow(int index, int sourceType) throws EditionCommandException; |
205 |
public void undoAddRow(int index, int sourceType) throws EditionCommandException; |
206 |
public SelectableDataSource getRecordset() throws ReadDriverException; |
207 |
public boolean isEditing(); |
208 |
public FBitSet getSelection() throws ReadDriverException; |
209 |
public CommandRecord getCommandRecord();
|
210 |
|
211 |
public void addEditionListener(IEditionListener listener); |
212 |
|
213 |
public void removeEditionListener(IEditionListener listener); |
214 |
|
215 |
public ITableDefinition getTableDefinition() throws ReadDriverException; |
216 |
|
217 |
public void validateRow(IRow row, int sourceType) throws ValidateRowException; |
218 |
|
219 |
/**
|
220 |
* Use it to add, remove or rename fields. If null, you cannot modifiy the table structure
|
221 |
* (for example, with dxf files, dgn files, etc).
|
222 |
* The changes will be applied when stopEditing() is called.
|
223 |
*/
|
224 |
public IFieldManager getFieldManager();
|
225 |
|
226 |
public void saveEdits(IWriter writer, int sourceType) throws StopWriterVisitorException; |
227 |
|
228 |
/**
|
229 |
* @return
|
230 |
*/
|
231 |
public Driver getOriginalDriver(); |
232 |
|
233 |
/**
|
234 |
* Please, use this if you need support for defaultValues.
|
235 |
* Don't user getRecordset().getFieldsDescription()!!.
|
236 |
* The reason is ResultSetMetadata has no information about
|
237 |
* defaultValues in fields.
|
238 |
* @return
|
239 |
*/
|
240 |
public FieldDescription[] getFieldsDescription(); |
241 |
|
242 |
|
243 |
} |