Revision 42966 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/TableEditStartExtension.java
TableEditStartExtension.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 3
|
|
9 |
* of the License, or (at your option) any later version.
|
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
|
9 |
* version. |
|
10 | 10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14 |
* details. |
|
15 | 15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.app.extension; |
25 | 24 |
|
26 |
|
|
27 | 25 |
import org.gvsig.andami.IconThemeHelper; |
28 | 26 |
import org.gvsig.andami.PluginServices; |
29 | 27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
... | ... | |
38 | 36 |
import org.slf4j.Logger; |
39 | 37 |
import org.slf4j.LoggerFactory; |
40 | 38 |
|
41 |
/** |
|
42 |
* DOCUMENT ME! |
|
43 |
* |
|
44 |
* @author Vicente Caballero Navarro |
|
45 |
*/ |
|
46 | 39 |
public class TableEditStartExtension extends AbstractTableEditExtension { |
47 |
private static final Logger logger = LoggerFactory.getLogger(TableEditStartExtension.class); |
|
48 | 40 |
|
49 |
public void initialize() {
|
|
50 |
super.initialize(); |
|
51 |
IconThemeHelper.registerIcon("action", "table-start-editing", this);
|
|
52 |
}
|
|
53 |
/**
|
|
54 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
|
55 |
*/ |
|
41 |
private static final Logger logger = LoggerFactory.getLogger(TableEditStartExtension.class);
|
|
42 |
|
|
43 |
public void initialize() {
|
|
44 |
super.initialize();
|
|
45 |
IconThemeHelper.registerIcon("action", "table-start-editing", this);
|
|
46 |
}
|
|
47 |
|
|
56 | 48 |
public void execute(String actionCommand) { |
57 | 49 |
if ("table-start-editing".equals(actionCommand)) { |
58 | 50 |
try { |
... | ... | |
63 | 55 |
EditingNotification.BEFORE_ENTER_EDITING_STORE, |
64 | 56 |
doc, |
65 | 57 |
doc.getStore()); |
66 |
if( notification.isCanceled() ) {
|
|
58 |
if (notification.isCanceled()) {
|
|
67 | 59 |
return; |
68 | 60 |
} |
69 | 61 |
doc.getStore().edit(FeatureStore.MODE_FULLEDIT); |
... | ... | |
74 | 66 |
doc, |
75 | 67 |
doc.getStore()); |
76 | 68 |
} catch (DataException e) { |
77 |
logger.warn("Problems starting table editing.",e); |
|
69 |
logger.warn("Problems starting table editing.", e);
|
|
78 | 70 |
} |
79 | 71 |
} |
80 | 72 |
} |
81 | 73 |
|
82 |
/** |
|
83 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled() |
|
84 |
*/ |
|
85 | 74 |
public boolean isEnabled() { |
86 | 75 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
87 | 76 |
|
... | ... | |
96 | 85 |
return false; |
97 | 86 |
} |
98 | 87 |
|
99 |
/** |
|
100 |
* @see org.gvsig.andami.plugins.IExtension#isVisible() |
|
101 |
*/ |
|
102 | 88 |
public boolean isVisible() { |
103 | 89 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
104 | 90 |
|
... | ... | |
107 | 93 |
} |
108 | 94 |
|
109 | 95 |
if (v instanceof FeatureTableDocumentPanel |
110 |
&& !((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) { |
|
96 |
&& !((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
111 | 97 |
table = (FeatureTableDocumentPanel) v; |
112 | 98 |
return true; |
113 | 99 |
} |
Also available in: Unified diff