Revision 2936
trunk/applications/appgvSIG/config/config.xml | ||
---|---|---|
226 | 226 |
active="true"> |
227 | 227 |
<menu text="Tabla/join" icon="images/tablejoin.png" action-command="JOIN"/> |
228 | 228 |
<menu text="Tabla/link" icon="images/tablelink.png" action-command="LINK"/> |
229 |
<menu text="Tabla/edit" action-command="EDIT"/> |
|
230 | 229 |
<tool-bar name="Herramientas"> |
231 | 230 |
<action-tool icon="images/tablejoin.png" action-command="JOIN" tooltip="join"/> |
232 | 231 |
<action-tool icon="images/tablelink.png" action-command="LINK" tooltip="link"/> |
233 | 232 |
</tool-bar> |
234 | 233 |
</extension> |
235 |
<extension class-name="com.iver.cit.gvsig.TableEditionCommands" |
|
234 |
|
|
235 |
<extension class-name="com.iver.cit.gvsig.TableEditStopExtension" |
|
236 | 236 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
237 | 237 |
active="true"> |
238 | 238 |
<menu text="Tabla/cancel" action-command="ROLLBACK"/> |
239 | 239 |
<menu text="Tabla/stop" action-command="COMMIT"/> |
240 |
<menu text="Tabla/addemptyrow" action-command="ADDEMPTYROW"/> |
|
241 |
<menu text="Tabla/copyrow" action-command="COPYROW"/> |
|
242 |
<menu text="Tabla/pasterow" action-command="PASTEROW"/> |
|
243 | 240 |
</extension> |
241 |
<extension class-name="com.iver.cit.gvsig.TableEditStartExtension" |
|
242 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
243 |
active="true"> |
|
244 |
<menu text="Tabla/edit" action-command="STARTEDIT"/> |
|
245 |
</extension> |
|
246 |
<extension class-name="com.iver.cit.gvsig.TableEditInsertExtension" |
|
247 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
248 |
active="true"> |
|
249 |
<menu text="Tabla/insertrow" action-command="INSERTROW"/> |
|
250 |
<menu text="Tabla/insertcolumn" action-command="INSERTCOLUMN"/> |
|
251 |
</extension> |
|
252 |
<extension class-name="com.iver.cit.gvsig.TableEditRemoveRowExtension" |
|
253 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
254 |
active="true"> |
|
255 |
<menu text="Tabla/removerow" action-command="REMOVEROW"/> |
|
256 |
</extension> |
|
257 |
<extension class-name="com.iver.cit.gvsig.TableEditRemoveColumnExtension" |
|
258 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
259 |
active="true"> |
|
260 |
<menu text="Tabla/removecolumn" action-command="REMOVECOLUMN"/> |
|
261 |
</extension> |
|
262 |
<extension class-name="com.iver.cit.gvsig.TableEditCopyExtension" |
|
263 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
264 |
active="true"> |
|
265 |
<menu text="Tabla/copy" icon="images/editcopy.png" action-command="COPY"/> |
|
266 |
</extension> |
|
267 |
<extension class-name="com.iver.cit.gvsig.TableEditCutExtension" |
|
268 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
269 |
active="true"> |
|
270 |
<menu text="Tabla/cut" icon="images/editcut.png" action-command="CUT"/> |
|
271 |
</extension> |
|
272 |
<extension class-name="com.iver.cit.gvsig.TableEditPasteExtension" |
|
273 |
description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas." |
|
274 |
active="true"> |
|
275 |
<menu text="Tabla/paste" icon="images/editpaste.png" action-command="PASTE"/> |
|
276 |
</extension> |
|
277 |
|
|
244 | 278 |
<extension active="true" class-name="com.iver.cit.gvsig.TableFieldOperations" |
245 | 279 |
description="Operaciones sobre los campos de las tablas"> |
246 | 280 |
<menu text="Tabla/ascending_order" icon="images/orderasc.png" action-command="ORDERASC"/> |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditionCommands.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig; |
|
2 |
|
|
3 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
4 |
import com.iver.andami.PluginServices; |
|
5 |
import com.iver.andami.messages.NotificationManager; |
|
6 |
import com.iver.andami.plugins.Extension; |
|
7 |
import com.iver.andami.ui.mdiManager.View; |
|
8 |
import com.iver.cit.gvsig.gui.Table; |
|
9 |
|
|
10 |
/** |
|
11 |
* @author Fernando Gonz?lez Cort?s |
|
12 |
*/ |
|
13 |
public class TableEditionCommands implements Extension { |
|
14 |
|
|
15 |
/** |
|
16 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
17 |
*/ |
|
18 |
public void inicializar() { |
|
19 |
|
|
20 |
} |
|
21 |
|
|
22 |
/** |
|
23 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
24 |
*/ |
|
25 |
public void execute(String actionCommand) { |
|
26 |
if ("ROLLBACK".equals(actionCommand)){ |
|
27 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
28 |
try { |
|
29 |
((Table) v).cancelEditing(); |
|
30 |
} catch (DriverException e) { |
|
31 |
NotificationManager.addError("No se pudo cancelar la edici?n", e); |
|
32 |
} |
|
33 |
}else if ("COMMIT".equals(actionCommand)){ |
|
34 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
35 |
try { |
|
36 |
((Table) v).stopEditing(); |
|
37 |
} catch (DriverException e) { |
|
38 |
NotificationManager.addError("No se pudo guardar la edici?n", e); |
|
39 |
} |
|
40 |
}else if ("ADDEMPTYROW".equals(actionCommand)){ |
|
41 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
42 |
try { |
|
43 |
((Table) v).addEmptyRow(); |
|
44 |
} catch (DriverException e) { |
|
45 |
NotificationManager.addError("No se pudo a?adir la fila", e); |
|
46 |
} |
|
47 |
} else if ("PASTEROW".equals(actionCommand)){ |
|
48 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
49 |
try { |
|
50 |
((Table) v).addSelectionToRow(); |
|
51 |
} catch (DriverException e) { |
|
52 |
NotificationManager.addError("No se pudo a?adir la fila", e); |
|
53 |
} |
|
54 |
} else if ("COPYROW".equals(actionCommand)){ |
|
55 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
56 |
try { |
|
57 |
((Table) v).copyRow(); |
|
58 |
} catch (DriverException e) { |
|
59 |
NotificationManager.addError("No se pudo copiar la fila", e); |
|
60 |
} |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
66 |
*/ |
|
67 |
public boolean isEnabled() { |
|
68 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
69 |
|
|
70 |
if (v == null) { |
|
71 |
return false; |
|
72 |
}else if (v.getClass() == Table.class) { |
|
73 |
return ((Table) v).isEditing(); |
|
74 |
}else{ |
|
75 |
return false; |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
81 |
*/ |
|
82 |
public boolean isVisible() { |
|
83 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
84 |
|
|
85 |
if (v == null) { |
|
86 |
return false; |
|
87 |
}else if (v.getClass() == Table.class) { |
|
88 |
return ((Table) v).isEditing(); |
|
89 |
}else{ |
|
90 |
return false; |
|
91 |
} |
|
92 |
} |
|
93 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditCutExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditCutExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("CUT".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).copySelectedRows(); |
|
74 |
((Table) v).delSelectionRow(); |
|
75 |
} catch (DriverException e) { |
|
76 |
NotificationManager.addError("No se pudo copiar la fila", e); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
83 |
*/ |
|
84 |
public boolean isEnabled() { |
|
85 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
86 |
|
|
87 |
if (v == null) { |
|
88 |
return false; |
|
89 |
} |
|
90 |
|
|
91 |
if (v.getClass() == Table.class) { |
|
92 |
return (((Table) v).isEditing()) && (((Table) v).getSelectedRowIndices().length>0); |
|
93 |
} |
|
94 |
|
|
95 |
return false; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
100 |
*/ |
|
101 |
public boolean isVisible() { |
|
102 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
103 |
|
|
104 |
if (v == null) { |
|
105 |
return false; |
|
106 |
} else if (v.getClass() == Table.class) { |
|
107 |
return true; |
|
108 |
} else { |
|
109 |
return false; |
|
110 |
} |
|
111 |
} |
|
112 |
} |
|
0 | 113 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditStartExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditStartExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("STARTEDIT".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).startEditing(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo poner la capa en edici?n", |
|
76 |
e); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
83 |
*/ |
|
84 |
public boolean isEnabled() { |
|
85 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
86 |
|
|
87 |
if (v == null) { |
|
88 |
return false; |
|
89 |
} |
|
90 |
|
|
91 |
if (v.getClass() == Table.class) { |
|
92 |
return (!((Table) v).isEditing()); |
|
93 |
} |
|
94 |
|
|
95 |
return false; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
100 |
*/ |
|
101 |
public boolean isVisible() { |
|
102 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
103 |
|
|
104 |
if (v == null) { |
|
105 |
return false; |
|
106 |
} |
|
107 |
|
|
108 |
if (v.getClass() == Table.class) { |
|
109 |
return true; |
|
110 |
} |
|
111 |
|
|
112 |
return false; |
|
113 |
} |
|
114 |
} |
|
0 | 115 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditInsertExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditInsertExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("INSERTROW".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).addEmptyRow(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo insertar la fila", e); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
if ("INSERTCOLUMN".equals(actionCommand)) { |
|
80 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
81 |
|
|
82 |
try { |
|
83 |
((Table) v).addEmptyRow(); |
|
84 |
} catch (DriverException e) { |
|
85 |
NotificationManager.addError("No se pudo insertar la fila", e); |
|
86 |
} |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
92 |
*/ |
|
93 |
public boolean isEnabled() { |
|
94 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
95 |
|
|
96 |
if (v == null) { |
|
97 |
return false; |
|
98 |
} else if (v.getClass() == Table.class) { |
|
99 |
return ((Table) v).isEditing(); |
|
100 |
} else { |
|
101 |
return false; |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
107 |
*/ |
|
108 |
public boolean isVisible() { |
|
109 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
110 |
|
|
111 |
if (v == null) { |
|
112 |
return false; |
|
113 |
} else if (v.getClass() == Table.class) { |
|
114 |
return true; |
|
115 |
} else { |
|
116 |
return false; |
|
117 |
} |
|
118 |
} |
|
119 |
} |
|
0 | 120 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditCopyExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditCopyExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("COPY".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).copySelectedRows(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo copiar la fila", e); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
82 |
*/ |
|
83 |
public boolean isEnabled() { |
|
84 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
85 |
|
|
86 |
if (v == null) { |
|
87 |
return false; |
|
88 |
} else if (v.getClass() == Table.class) { |
|
89 |
return (((Table) v).getSelectedRowIndices().length>0); |
|
90 |
} else { |
|
91 |
return false; |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
97 |
*/ |
|
98 |
public boolean isVisible() { |
|
99 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
100 |
|
|
101 |
if (v == null) { |
|
102 |
return false; |
|
103 |
} else if (v.getClass() == Table.class) { |
|
104 |
return true; |
|
105 |
} else { |
|
106 |
return false; |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
0 | 110 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditRemoveColumnExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditRemoveColumnExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("REMOVECOLUMN".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).delSelectionRow(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo eliminar la fila", e); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
82 |
*/ |
|
83 |
public boolean isEnabled() { |
|
84 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
85 |
|
|
86 |
if (v == null) { |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
if (v.getClass() == Table.class) { |
|
91 |
return (((Table) v).isEditing()) && ((Table) v).getSelectedFieldIndices().cardinality()>0; |
|
92 |
} |
|
93 |
|
|
94 |
return false; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
99 |
*/ |
|
100 |
public boolean isVisible() { |
|
101 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
102 |
|
|
103 |
if (v == null) { |
|
104 |
return false; |
|
105 |
} else if (v.getClass() == Table.class) { |
|
106 |
return true; |
|
107 |
} else { |
|
108 |
return false; |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
0 | 112 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditPasteExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditPasteExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("PASTE".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).addSelectionToEnd(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo pegar la fila", e); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
82 |
*/ |
|
83 |
public boolean isEnabled() { |
|
84 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
85 |
|
|
86 |
if (v == null) { |
|
87 |
return false; |
|
88 |
} else if (v.getClass() == Table.class) { |
|
89 |
return ((Table) v).isEditing() && ((Table) v).isCopy(); |
|
90 |
} else { |
|
91 |
return false; |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
97 |
*/ |
|
98 |
public boolean isVisible() { |
|
99 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
100 |
|
|
101 |
if (v == null) { |
|
102 |
return false; |
|
103 |
} else if (v.getClass() == Table.class) { |
|
104 |
return true; |
|
105 |
} else { |
|
106 |
return false; |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
0 | 110 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableOperations.java | ||
---|---|---|
307 | 307 |
} catch (SelectionException e) { |
308 | 308 |
NotificationManager.addError("Error abriendo el asistente", e); |
309 | 309 |
} |
310 |
} else if ("EDIT".equals(actionCommand)){ |
|
311 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
312 |
try { |
|
313 |
((Table) v).startEditing(); |
|
314 |
} catch (DriverException e) { |
|
315 |
NotificationManager.addError("No se pudo poner la capa en edici?n", e); |
|
316 |
} |
|
317 |
} |
|
310 |
} |
|
318 | 311 |
} |
319 | 312 |
|
320 | 313 |
/** |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditRemoveRowExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.messages.NotificationManager; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.andami.ui.mdiManager.View; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.gui.Table; |
|
51 |
|
|
52 |
|
|
53 |
/** |
|
54 |
* DOCUMENT ME! |
|
55 |
* |
|
56 |
* @author Vicente Caballero Navarro |
|
57 |
*/ |
|
58 |
public class TableEditRemoveRowExtension implements Extension { |
|
59 |
/** |
|
60 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
61 |
*/ |
|
62 |
public void inicializar() { |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
67 |
*/ |
|
68 |
public void execute(String actionCommand) { |
|
69 |
if ("REMOVEROW".equals(actionCommand)) { |
|
70 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
71 |
|
|
72 |
try { |
|
73 |
((Table) v).delSelectionRow(); |
|
74 |
} catch (DriverException e) { |
|
75 |
NotificationManager.addError("No se pudo elimnar la fila", e); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
82 |
*/ |
|
83 |
public boolean isEnabled() { |
|
84 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
85 |
|
|
86 |
if (v == null) { |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
if (v.getClass() == Table.class) { |
|
91 |
return (((Table) v).isEditing()) && ((Table) v).getSelectedRowIndices().length>0; |
|
92 |
} |
|
93 |
|
|
94 |
return false; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
99 |
*/ |
|
100 |
public boolean isVisible() { |
|
101 |
View v = PluginServices.getMDIManager().getActiveView(); |
|
102 |
|
|
103 |
if (v == null) { |
|
104 |
return false; |
|
105 |
} else if (v.getClass() == Table.class) { |
|
106 |
return true; |
|
107 |
} else { |
|
108 |
return false; |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
0 | 112 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/Table.java | ||
---|---|---|
84 | 84 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
85 | 85 |
import com.iver.cit.gvsig.fmap.layers.SelectionEvent; |
86 | 86 |
import com.iver.cit.gvsig.fmap.layers.SelectionListener; |
87 |
import com.iver.cit.gvsig.gui.layout.Popupmenu; |
|
88 |
import com.iver.cit.gvsig.gui.tables.PopupMenu; |
|
87 | 89 |
import com.iver.cit.gvsig.project.ProjectTable; |
88 | 90 |
import com.iver.utiles.swing.jtable.FieldSelectionEvent; |
89 | 91 |
import com.iver.utiles.swing.jtable.FieldSelectionListener; |
... | ... | |
264 | 266 |
table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); |
265 | 267 |
table.setSelectionModel(new DefaultListSelectionModel()); |
266 | 268 |
table.getTableHeader().addMouseListener(new MouseHandler()); |
269 |
table.addMouseListener(new MouseRow()); |
|
267 | 270 |
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { |
268 | 271 |
public void valueChanged(ListSelectionEvent e) { |
269 | 272 |
if (updating) return; |
... | ... | |
362 | 365 |
} |
363 | 366 |
|
364 | 367 |
/** |
365 |
* DOCUMENT ME!
|
|
368 |
* Returns the name of the field.
|
|
366 | 369 |
* |
367 |
* @param col DOCUMENT ME!
|
|
370 |
* @param col index of field
|
|
368 | 371 |
* |
369 |
* @return DOCUMENT ME!
|
|
372 |
* @return Name of field
|
|
370 | 373 |
*/ |
371 | 374 |
public String getColumnName(int col) { |
372 | 375 |
return aliases[mapping[col]]; |
373 | 376 |
} |
374 | 377 |
|
375 | 378 |
/** |
376 |
* DOCUMENT ME!
|
|
379 |
* Returns the number of fields.
|
|
377 | 380 |
* |
378 |
* @return DOCUMENT ME!
|
|
381 |
* @return number of fields
|
|
379 | 382 |
*/ |
380 | 383 |
public int getColumnCount() { |
381 | 384 |
return mapping.length; |
382 | 385 |
} |
383 | 386 |
|
384 | 387 |
/** |
385 |
* DOCUMENT ME!
|
|
388 |
* Returns number of rows.
|
|
386 | 389 |
* |
387 |
* @return DOCUMENT ME!
|
|
390 |
* @return number of rows.
|
|
388 | 391 |
*/ |
389 | 392 |
public int getRowCount() { |
390 | 393 |
try { |
... | ... | |
504 | 507 |
} |
505 | 508 |
private class MouseHandler extends MouseAdapter { |
506 | 509 |
public void mouseClicked(MouseEvent e) { |
507 |
JTableHeader h = (JTableHeader) e.getSource();
|
|
510 |
/* JTableHeader h = (JTableHeader) e.getSource();
|
|
508 | 511 |
TableColumnModel columnModel = h.getColumnModel(); |
509 | 512 |
int viewColumn = columnModel.getColumnIndexAtX(e.getX()); |
510 | 513 |
int column = columnModel.getColumn(viewColumn).getModelIndex(); |
511 | 514 |
if (column != -1) { |
512 |
/* int status = getSortingStatus(column); |
|
513 |
if (!e.isControlDown()) { |
|
514 |
cancelSorting(); |
|
515 |
} |
|
516 |
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or |
|
517 |
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. |
|
518 |
status = status + (e.isShiftDown() ? -1 : 1); |
|
519 |
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} |
|
520 |
setSortingStatus(column, status); |
|
521 |
*/ |
|
522 |
} |
|
515 |
|
|
516 |
}*/ |
|
523 | 517 |
} |
524 | 518 |
} |
519 |
private class MouseRow extends MouseAdapter { |
|
520 |
public void mouseClicked(MouseEvent e) { |
|
521 |
PluginServices.getMainFrame().enableControls(); |
|
522 |
if (e.getButton()==MouseEvent.BUTTON3){ |
|
523 |
new PopupMenu(e.getPoint()); |
|
524 |
} |
|
525 |
} |
|
526 |
|
|
527 |
} |
|
525 | 528 |
public Value[] getValueRow(int index){ |
526 | 529 |
DataSourceDataModel dsdm=(DataSourceDataModel)getTable().getModel(); |
527 | 530 |
Value [] values=new Value[dsdm.getColumnCount()]; |
... | ... | |
530 | 533 |
} |
531 | 534 |
return values; |
532 | 535 |
} |
533 |
|
|
536 |
private void refresh() throws DriverException{ |
|
537 |
dw.commitTrans(); |
|
538 |
model.getModelo().stop(); |
|
539 |
dw.beginTrans(); |
|
540 |
DataSourceDataModel dsdm=(DataSourceDataModel)getTable().getModel(); |
|
541 |
dsdm.fireTableDataChanged(); |
|
542 |
} |
|
534 | 543 |
public void addEmptyRow() throws DriverException{ |
535 | 544 |
ValueCollection valuePK=new ValueCollection(); |
536 | 545 |
valuePK.setValues(new Value[]{ValueFactory.createValue(dw.getRowCount())}); |
537 | 546 |
dw.insertEmptyRow(valuePK); |
538 |
dw.commitTrans(); |
|
539 |
model.getModelo().stop(); |
|
540 |
dw.beginTrans(); |
|
541 |
DataSourceDataModel dsdm=(DataSourceDataModel)getTable().getModel(); |
|
542 |
dsdm.fireTableDataChanged(); |
|
547 |
refresh(); |
|
543 | 548 |
} |
544 | 549 |
|
545 |
public void copyRow() throws DriverException{
|
|
550 |
public void copySelectedRows() throws DriverException{
|
|
546 | 551 |
int[] sel=getSelectedRowIndices(); |
547 | 552 |
for(int i=0;i<sel.length;i++){ |
548 | 553 |
rowsCopied.add(getValueRow(sel[i])); |
549 | 554 |
} |
550 | 555 |
} |
551 | 556 |
|
552 |
public void addSelectionToRow() throws DriverException {
|
|
557 |
public void addSelectionToEnd() throws DriverException {
|
|
553 | 558 |
for (int i=0;i<rowsCopied.size();i++){ |
554 | 559 |
dw.insertFilledRow((Value[])rowsCopied.get(i)); |
555 | 560 |
} |
556 |
dw.commitTrans(); |
|
557 |
model.getModelo().stop(); |
|
558 |
dw.beginTrans(); |
|
559 |
DataSourceDataModel dsdm=(DataSourceDataModel)getTable().getModel(); |
|
560 |
dsdm.fireTableDataChanged(); |
|
561 |
refresh(); |
|
561 | 562 |
} |
563 |
public void delSelectionRow() throws DriverException{ |
|
564 |
int[] sel=getSelectedRowIndices(); |
|
565 |
for(int i=sel.length-1;i>=0;i--){ |
|
566 |
dw.deleteRow(sel[i]); |
|
567 |
} |
|
568 |
refresh(); |
|
569 |
|
|
570 |
} |
|
571 |
public boolean isCopy(){ |
|
572 |
return !rowsCopied.isEmpty(); |
|
573 |
} |
|
574 |
/* |
|
575 |
public void addSelectionToRow() throws DriverException { |
|
576 |
int[] sel=getSelectedRowIndices(); |
|
577 |
dw.insertFilledRow((Value[])rowsCopied.get(i),sel[0]); |
|
578 |
refresh(); |
|
579 |
} |
|
580 |
*/ |
|
562 | 581 |
|
563 | 582 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/tables/PopupMenu.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig.gui.tables; |
|
42 |
|
|
43 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
|
|
47 |
import com.iver.cit.gvsig.AddLayer; |
|
48 |
import com.iver.cit.gvsig.gui.Table; |
|
49 |
|
|
50 |
import java.awt.Point; |
|
51 |
import java.awt.event.ActionEvent; |
|
52 |
import java.awt.event.ActionListener; |
|
53 |
|
|
54 |
import javax.swing.ImageIcon; |
|
55 |
import javax.swing.JMenuItem; |
|
56 |
import javax.swing.JPopupMenu; |
|
57 |
|
|
58 |
|
|
59 |
/** |
|
60 |
* PopupMenu with options to operate on the table. |
|
61 |
* |
|
62 |
* @author Vicente Caballero Navarro |
|
63 |
*/ |
|
64 |
public class PopupMenu extends JPopupMenu { |
|
65 |
private static final ImageIcon editcopy = new ImageIcon(AddLayer.class.getClassLoader() |
|
66 |
.getResource("images/editcopy.png")); |
|
67 |
private static final ImageIcon editcut = new ImageIcon(AddLayer.class.getClassLoader() |
|
68 |
.getResource("images/editcut.png")); |
|
69 |
private static final ImageIcon editpaste = new ImageIcon(AddLayer.class.getClassLoader() |
|
70 |
.getResource("images/editpaste.png")); |
|
71 |
private static final ImageIcon editdelete = new ImageIcon(AddLayer.class.getClassLoader() |
|
72 |
.getResource("images/editdelete.png")); |
|
73 |
private JMenuItem copy = null; |
|
74 |
private JMenuItem cut = null; |
|
75 |
private JMenuItem paste = null; |
|
76 |
private JMenuItem insertRow = null; |
|
77 |
private JMenuItem insertColumn = null; |
|
78 |
private JMenuItem removeRow = null; |
|
79 |
private JMenuItem removeColumn = null; |
|
80 |
private JMenuItem startEdition = null; |
|
81 |
private JMenuItem stopEdition = null; |
|
82 |
private Table table = null; |
|
83 |
private Point point = null; |
|
84 |
|
|
85 |
/** |
|
86 |
* Create a new PopupMenu. |
|
87 |
* |
|
88 |
* @param p Point to location. |
|
89 |
*/ |
|
90 |
public PopupMenu(Point p) { |
|
91 |
point = p; |
|
92 |
initialize(); |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* Initialize the components of Popupmenu. |
|
97 |
*/ |
|
98 |
private void initialize() { |
|
99 |
copy = new JMenuItem(PluginServices.getText(this, "copiar"), editcopy); |
|
100 |
cut = new JMenuItem(PluginServices.getText(this, "cortar"), editcut); |
|
101 |
paste = new JMenuItem(PluginServices.getText(this, "pegar"), editpaste); |
|
102 |
insertRow = new JMenuItem(PluginServices.getText(this, "insertar_fila")); |
|
103 |
insertColumn = new JMenuItem(PluginServices.getText(this, |
|
104 |
"insertar_columna")); |
|
105 |
removeRow = new JMenuItem(PluginServices.getText(this, "eliminar_fila"), |
|
106 |
editdelete); |
|
107 |
removeColumn = new JMenuItem(PluginServices.getText(this, |
|
108 |
"eliminar_columna")); |
|
109 |
startEdition = new JMenuItem(PluginServices.getText(this, |
|
110 |
"comenzar_edicion")); |
|
111 |
stopEdition = new JMenuItem(PluginServices.getText(this, |
|
112 |
"terminar_edicion")); |
|
113 |
|
|
114 |
add(startEdition); |
|
115 |
add(stopEdition); |
|
116 |
addSeparator(); |
|
117 |
add(copy); |
|
118 |
add(cut); |
|
119 |
add(paste); |
|
120 |
addSeparator(); |
|
121 |
add(insertRow); |
|
122 |
add(removeRow); |
|
123 |
add(insertColumn); |
|
124 |
add(removeColumn); |
|
125 |
|
|
126 |
table = (Table) PluginServices.getMDIManager().getActiveView(); |
|
127 |
startEdition.addActionListener(new ActionListener() { |
|
128 |
public void actionPerformed(ActionEvent e) { |
|
129 |
try { |
|
130 |
table.startEditing(); |
|
131 |
PluginServices.getMainFrame().enableControls(); |
|
132 |
} catch (DriverException e1) { |
|
133 |
// TODO Auto-generated catch block |
|
134 |
e1.printStackTrace(); |
|
135 |
} |
|
136 |
} |
|
137 |
}); |
|
138 |
stopEdition.addActionListener(new ActionListener() { |
|
139 |
public void actionPerformed(ActionEvent e) { |
|
140 |
try { |
|
141 |
table.stopEditing(); |
|
142 |
PluginServices.getMainFrame().enableControls(); |
|
143 |
} catch (DriverException e1) { |
|
144 |
// TODO Auto-generated catch block |
|
145 |
e1.printStackTrace(); |
|
146 |
} |
|
147 |
} |
|
148 |
}); |
|
149 |
copy.addActionListener(new ActionListener() { |
|
150 |
public void actionPerformed(ActionEvent e) { |
|
151 |
try { |
|
152 |
table.copySelectedRows(); |
|
153 |
PluginServices.getMainFrame().enableControls(); |
|
154 |
} catch (DriverException e1) { |
|
155 |
// TODO Auto-generated catch block |
|
156 |
e1.printStackTrace(); |
|
157 |
} |
|
158 |
} |
|
159 |
}); |
|
160 |
cut.addActionListener(new ActionListener() { |
|
161 |
public void actionPerformed(ActionEvent e) { |
|
162 |
try { |
|
163 |
table.copySelectedRows(); |
|
164 |
table.delSelectionRow(); |
|
165 |
PluginServices.getMainFrame().enableControls(); |
|
166 |
} catch (DriverException e1) { |
|
167 |
// TODO Auto-generated catch block |
|
168 |
e1.printStackTrace(); |
|
169 |
} |
|
170 |
} |
|
171 |
}); |
|
172 |
paste.addActionListener(new ActionListener() { |
|
173 |
public void actionPerformed(ActionEvent e) { |
|
174 |
//TODO este m?todo a?ade las filas seleccionadas previamente al final de la tabla. |
|
175 |
//De momento no se puede a?adir filas en una posici?n en concreto. |
|
176 |
try { |
|
177 |
table.addSelectionToEnd(); |
|
178 |
PluginServices.getMainFrame().enableControls(); |
|
179 |
} catch (DriverException e1) { |
|
180 |
// TODO Auto-generated catch block |
|
181 |
e1.printStackTrace(); |
|
182 |
} |
|
183 |
} |
|
184 |
}); |
|
185 |
insertRow.addActionListener(new ActionListener() { |
|
186 |
public void actionPerformed(ActionEvent e) { |
|
187 |
//TODO Este m?todo a?ade filas al final de la tabla y deber?a a?adirlas justo antes de la fila que tengamos seleccionada. |
|
188 |
try { |
|
189 |
table.addEmptyRow(); |
|
190 |
PluginServices.getMainFrame().enableControls(); |
|
191 |
} catch (DriverException e1) { |
|
192 |
// TODO Auto-generated catch block |
|
193 |
e1.printStackTrace(); |
|
194 |
} |
|
195 |
} |
|
196 |
}); |
|
197 |
removeRow.addActionListener(new ActionListener() { |
|
198 |
public void actionPerformed(ActionEvent e) { |
|
199 |
try { |
|
200 |
table.delSelectionRow(); |
|
201 |
PluginServices.getMainFrame().enableControls(); |
|
202 |
} catch (DriverException e1) { |
|
203 |
// TODO Auto-generated catch block |
|
204 |
e1.printStackTrace(); |
|
205 |
} |
|
206 |
} |
|
207 |
}); |
|
208 |
insertColumn.addActionListener(new ActionListener() { |
|
209 |
public void actionPerformed(ActionEvent e) { |
|
210 |
//TODO Falta que implementar. |
|
211 |
|
|
212 |
} |
|
213 |
}); |
|
214 |
removeColumn.addActionListener(new ActionListener() { |
|
215 |
public void actionPerformed(ActionEvent e) { |
|
216 |
//TODO Falta que implementar. |
|
217 |
} |
|
218 |
}); |
|
219 |
editingMenu(table.isEditing()); |
|
220 |
setEnablePaste(table.isCopy()); |
|
221 |
this.show(table, point.x, point.y); |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* Set the menu enabled if it?s possible. |
|
226 |
* |
|
227 |
* @param b boolean |
|
228 |
*/ |
|
229 |
private void editingMenu(boolean b) { |
|
230 |
copy.setEnabled(false); |
|
231 |
cut.setEnabled(false); |
|
232 |
startEdition.setEnabled(!b); |
|
233 |
stopEdition.setEnabled(b); |
|
234 |
insertRow.setEnabled(b); |
|
235 |
insertColumn.setEnabled(b); |
|
236 |
removeRow.setEnabled(false); |
|
237 |
if (table.getSelectedRowIndices().length > 0){ |
|
238 |
copy.setEnabled(true); |
Also available in: Unified diff