svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / TableEditionCommands.java @ 2513
History | View | Annotate | Download (1.91 KB)
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 |
} |
41 |
} |
42 |
|
43 |
/**
|
44 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
45 |
*/
|
46 |
public boolean isEnabled() { |
47 |
View v = PluginServices.getMDIManager().getActiveView();
|
48 |
|
49 |
if (v == null) { |
50 |
return false; |
51 |
}else if (v.getClass() == Table.class) { |
52 |
return ((Table) v).isEditing();
|
53 |
}else{
|
54 |
return false; |
55 |
} |
56 |
} |
57 |
|
58 |
/**
|
59 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
60 |
*/
|
61 |
public boolean isVisible() { |
62 |
View v = PluginServices.getMDIManager().getActiveView();
|
63 |
|
64 |
if (v == null) { |
65 |
return false; |
66 |
}else if (v.getClass() == Table.class) { |
67 |
return ((Table) v).isEditing();
|
68 |
}else{
|
69 |
return false; |
70 |
} |
71 |
} |
72 |
} |