Revision 26053 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditStopExtension.java
TableEditStopExtension.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
import com.iver.andami.PluginServices; |
16 | 16 |
import com.iver.andami.messages.NotificationManager; |
17 |
import com.iver.andami.plugins.Extension; |
|
18 | 17 |
import com.iver.andami.plugins.IExtension; |
19 | 18 |
import com.iver.andami.plugins.status.IExtensionStatus; |
20 | 19 |
import com.iver.andami.plugins.status.IUnsavedData; |
21 | 20 |
import com.iver.andami.plugins.status.UnsavedData; |
22 | 21 |
import com.iver.andami.ui.mdiManager.IWindow; |
23 |
import com.iver.cit.gvsig.project.documents.table.exceptions.CancelEditingTableException; |
|
24 | 22 |
import com.iver.utiles.swing.threads.IMonitorableTask; |
25 | 23 |
|
26 | 24 |
|
... | ... | |
29 | 27 |
* |
30 | 28 |
* @author Vicente Caballero Navarro |
31 | 29 |
*/ |
32 |
public class TableEditStopExtension extends Extension { |
|
33 |
/** |
|
34 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
35 |
*/ |
|
36 |
public void initialize() { |
|
37 |
} |
|
30 |
public class TableEditStopExtension extends AbstractTableEditExtension { |
|
38 | 31 |
|
39 | 32 |
/** |
40 | 33 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
41 | 34 |
*/ |
42 | 35 |
public void execute(String actionCommand) { |
43 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
44 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v; |
|
45 |
if ("STOPEDITING".equals(actionCommand)) { |
|
36 |
if ("STOPEDITING".equals(actionCommand)) { |
|
46 | 37 |
stopEditing(table); |
47 | 38 |
} |
48 |
/* IEditableSource edTable = (IEditableSource) table.getModel().getAssociatedTable(); |
|
49 |
edTable.getCommandRecord().removeCommandListener(table); */ |
|
50 |
|
|
51 | 39 |
} |
52 | 40 |
|
53 | 41 |
/** |
... | ... | |
55 | 43 |
*/ |
56 | 44 |
public void stopEditing(FeatureTableDocumentPanel table) { |
57 | 45 |
// FIXME |
58 |
// int resp = JOptionPane |
|
59 |
// .showConfirmDialog(null, PluginServices.getText(this, |
|
60 |
// "realmente_desea_guardar") +" : "+ table.getModel().getName(), "Guardar", |
|
61 |
// JOptionPane.YES_NO_OPTION); |
|
62 |
// if (resp == JOptionPane.NO_OPTION) { // CANCEL EDITING |
|
63 |
// try { |
|
64 |
// table.cancelEditing(); |
|
65 |
// } catch (CancelEditingTableException e) { |
|
66 |
// e.printStackTrace(); |
|
67 |
// } |
|
68 |
// } else { // GUARDAMOS LA TABLA |
|
69 |
// table.stopEditing(); |
|
70 |
// } |
|
46 |
int resp = JOptionPane |
|
47 |
.showConfirmDialog(null, PluginServices.getText(this, |
|
48 |
"realmente_desea_guardar") +" : "+ table.getModel().getName(), "Guardar", |
|
49 |
JOptionPane.YES_NO_OPTION); |
|
50 |
try { |
|
51 |
if (resp == JOptionPane.NO_OPTION) { // CANCEL EDITING |
|
52 |
table.getModel().getStore().cancelEditing(); |
|
53 |
} else { // GUARDAMOS LA TABLA |
|
54 |
table.getModel().getStore().finishEditing(); |
|
55 |
} |
|
56 |
} catch (DataException e) { |
|
57 |
// TODO Auto-generated catch block |
|
58 |
e.printStackTrace(); |
|
59 |
} |
|
71 | 60 |
} |
72 | 61 |
|
73 | 62 |
|
... | ... | |
87 | 76 |
if (v == null) { |
88 | 77 |
return false; |
89 | 78 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing() && ((FeatureTableDocumentPanel)v).getModel().getAssociatedLayer()==null) { |
90 |
return true; |
|
79 |
table=(FeatureTableDocumentPanel)v; |
|
80 |
return true; |
|
91 | 81 |
} else { |
92 | 82 |
return false; |
93 | 83 |
} |
Also available in: Unified diff