Revision 38869
branches/v2_0_0_prep/extensions/extEditing/config/text_en.properties | ||
---|---|---|
317 | 317 |
_Toggle_show_grid=Toggle display grid |
318 | 318 |
_Toggle_snapping=Toggle snapping |
319 | 319 |
_Toggle_snap_to_grid=Toggle snapping to grid |
320 |
_Guardar=Save |
|
321 |
_Save_changes_performed=Save edits performed in layer. |
|
322 |
_Descartar=Discard |
|
323 |
_Discard_and_lose_changes=Discard and lose edits performed. |
|
324 |
_Continuar=Continue |
|
325 |
_Do_not_save_yet_Stay_in_editing_mode=Do not save yet. Continue editing. |
branches/v2_0_0_prep/extensions/extEditing/config/text.properties | ||
---|---|---|
320 | 320 |
_Toggle_show_grid=Mostrar-ocultar rejilla |
321 | 321 |
_Toggle_snapping=Activar-desactivar snapping |
322 | 322 |
_Toggle_snap_to_grid=Activar-desactivar snapping a la rejilla |
323 |
_Guardar=Guardar |
|
324 |
_Save_changes_performed=Guardar los cambios realizados. |
|
325 |
_Descartar=Descartar |
|
326 |
_Discard_and_lose_changes=Descartar y perder los cambios realizados. |
|
327 |
_Continuar=Continuar |
|
328 |
_Do_not_save_yet_Stay_in_editing_mode=No guardar a?n. Continuar en edici?n. |
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StopEditing.java | ||
---|---|---|
1 | 1 |
package org.gvsig.editing; |
2 | 2 |
|
3 |
import java.awt.BorderLayout; |
|
3 | 4 |
import java.awt.Component; |
5 |
import java.awt.Font; |
|
6 |
import java.awt.GridBagConstraints; |
|
7 |
import java.awt.GridBagLayout; |
|
8 |
import java.awt.Insets; |
|
4 | 9 |
import java.util.ArrayList; |
5 | 10 |
|
11 |
import javax.swing.JLabel; |
|
6 | 12 |
import javax.swing.JOptionPane; |
13 |
import javax.swing.JPanel; |
|
7 | 14 |
|
8 | 15 |
import org.cresques.cts.IProjection; |
9 | 16 |
import org.gvsig.andami.PluginServices; |
... | ... | |
35 | 42 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
36 | 43 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
37 | 44 |
import org.gvsig.fmap.mapcontrol.MapControl; |
45 |
import org.gvsig.i18n.Messages; |
|
38 | 46 |
import org.gvsig.utils.swing.threads.IMonitorableTask; |
39 | 47 |
|
40 | 48 |
/** |
... | ... | |
130 | 138 |
try { |
131 | 139 |
if (layer.isWritable()) { |
132 | 140 |
Object[] options = { |
133 |
PluginServices.getText(this, "guardar"), |
|
134 |
PluginServices.getText(this, |
|
135 |
"finish_editing_without_saving_changes"), |
|
136 |
PluginServices.getText(this, "continue_editing") }; |
|
141 |
PluginServices.getText(this, "_Guardar"), |
|
142 |
" " + PluginServices.getText(this, "_Descartar") + " ", |
|
143 |
PluginServices.getText(this, "_Continuar") }; |
|
144 |
|
|
145 |
JPanel explanation_panel = getExplanationPanel(layer.getName()); |
|
137 | 146 |
|
138 | 147 |
resp = JOptionPane |
139 | 148 |
.showOptionDialog( |
140 | 149 |
(Component) PluginServices.getMainFrame(), |
141 |
PluginServices.getText(this, |
|
142 |
"realmente_desea_guardar_la_capa") |
|
143 |
+ " : " + layer.getName(), |
|
150 |
explanation_panel, |
|
144 | 151 |
PluginServices.getText(this, "stop_edition"), |
145 | 152 |
JOptionPane.YES_NO_CANCEL_OPTION, |
146 | 153 |
JOptionPane.QUESTION_MESSAGE, null, options, |
... | ... | |
211 | 218 |
|
212 | 219 |
} |
213 | 220 |
|
214 |
private void saveLayer(FLyrVect layer) throws ReadException { |
|
221 |
|
|
222 |
private JPanel getExplanationPanel( |
|
223 |
String layer_name) { |
|
224 |
|
|
225 |
JPanel resp = new JPanel(new BorderLayout(10, 10)); |
|
226 |
|
|
227 |
String msg = Messages.getText("realmente_desea_guardar_la_capa"); |
|
228 |
msg = msg + " '" + layer_name + "'?"; |
|
229 |
JLabel topLabel = new JLabel(msg); |
|
230 |
|
|
231 |
JPanel mainPanel = new JPanel(new GridBagLayout()); |
|
232 |
GridBagConstraints cc = new GridBagConstraints(); |
|
233 |
|
|
234 |
cc.gridx = 0; |
|
235 |
cc.gridy = 0; |
|
236 |
cc.anchor = GridBagConstraints.WEST; |
|
237 |
|
|
238 |
cc.insets = new Insets(3, 6, 3, 6); |
|
239 |
|
|
240 |
Font boldf = mainPanel.getFont().deriveFont(Font.BOLD); |
|
241 |
|
|
242 |
JLabel lbl = new JLabel(Messages.getText("_Guardar")); |
|
243 |
lbl.setFont(boldf); |
|
244 |
mainPanel.add(lbl, cc); |
|
245 |
cc.gridx = 1; |
|
246 |
mainPanel.add(new JLabel(Messages.getText("_Save_changes_performed")), cc); |
|
247 |
|
|
248 |
cc.gridx = 0; |
|
249 |
cc.gridy = 1; |
|
250 |
lbl = new JLabel(Messages.getText("_Descartar")); |
|
251 |
lbl.setFont(boldf); |
|
252 |
mainPanel.add(lbl, cc); |
|
253 |
cc.gridx = 1; |
|
254 |
mainPanel.add(new JLabel(Messages.getText("_Discard_and_lose_changes")), cc); |
|
255 |
|
|
256 |
cc.gridx = 0; |
|
257 |
cc.gridy = 2; |
|
258 |
lbl = new JLabel(Messages.getText("_Continuar")); |
|
259 |
lbl.setFont(boldf); |
|
260 |
mainPanel.add(lbl, cc); |
|
261 |
cc.gridx = 1; |
|
262 |
mainPanel.add(new JLabel(Messages.getText("_Do_not_save_yet_Stay_in_editing_mode")), cc); |
|
263 |
|
|
264 |
resp.add(mainPanel, BorderLayout.CENTER); |
|
265 |
resp.add(topLabel, BorderLayout.NORTH); |
|
266 |
return resp; |
|
267 |
} |
|
268 |
|
|
269 |
|
|
270 |
private void saveLayer(FLyrVect layer) throws ReadException { |
|
215 | 271 |
FeatureStore featureStore = layer.getFeatureStore(); |
216 | 272 |
try { |
217 | 273 |
featureStore.finishEditing(); |
branches/v2_0_0_prep/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/TableEditStopExtension.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.app.extension; |
23 | 23 |
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.Component; |
|
26 |
import java.awt.Font; |
|
27 |
import java.awt.GridBagConstraints; |
|
28 |
import java.awt.GridBagLayout; |
|
29 |
import java.awt.Insets; |
|
24 | 30 |
import java.util.ArrayList; |
25 | 31 |
import java.util.List; |
26 | 32 |
|
33 |
import javax.swing.JLabel; |
|
27 | 34 |
import javax.swing.JOptionPane; |
35 |
import javax.swing.JPanel; |
|
28 | 36 |
|
29 | 37 |
import org.slf4j.Logger; |
30 | 38 |
import org.slf4j.LoggerFactory; |
... | ... | |
37 | 45 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
38 | 46 |
import org.gvsig.andami.plugins.status.UnsavedData; |
39 | 47 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
48 |
import org.gvsig.app.ApplicationLocator; |
|
40 | 49 |
import org.gvsig.app.project.Project; |
41 | 50 |
import org.gvsig.app.project.ProjectManager; |
42 | 51 |
import org.gvsig.app.project.documents.Document; |
... | ... | |
47 | 56 |
import org.gvsig.fmap.dal.exception.ReadException; |
48 | 57 |
import org.gvsig.fmap.dal.exception.WriteException; |
49 | 58 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
59 |
import org.gvsig.gui.beans.Messages; |
|
50 | 60 |
import org.gvsig.utils.swing.threads.IMonitorableTask; |
51 | 61 |
|
52 | 62 |
public class TableEditStopExtension extends AbstractTableEditExtension { |
... | ... | |
62 | 72 |
public void execute(String actionCommand) { |
63 | 73 |
if ("table-stop-editing".equals(actionCommand)) { |
64 | 74 |
stopEditing(table); |
75 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
65 | 76 |
} |
66 | 77 |
} |
67 | 78 |
|
68 | 79 |
private void stopEditing(FeatureTableDocumentPanel table) { |
69 | 80 |
|
70 |
int resp = |
|
71 |
JOptionPane.showConfirmDialog(null, |
|
72 |
PluginServices.getText(this, "realmente_desea_guardar") + " : " |
|
73 |
+ table.getModel().getName(), "Guardar", |
|
74 |
JOptionPane.YES_NO_OPTION); |
|
81 |
Object[] options = { |
|
82 |
PluginServices.getText(this, "_Guardar"), |
|
83 |
" " + PluginServices.getText(this, "_Descartar") + " ", |
|
84 |
PluginServices.getText(this, "_Continuar") }; |
|
85 |
|
|
86 |
JPanel explanation_panel = getExplanationPanel(table.getModel().getName()); |
|
87 |
|
|
88 |
int resp = JOptionPane |
|
89 |
.showOptionDialog( |
|
90 |
(Component) PluginServices.getMainFrame(), |
|
91 |
explanation_panel, |
|
92 |
PluginServices.getText(this, "stop_edition"), |
|
93 |
JOptionPane.YES_NO_CANCEL_OPTION, |
|
94 |
JOptionPane.QUESTION_MESSAGE, null, options, |
|
95 |
options[2]); |
|
96 |
|
|
75 | 97 |
try { |
76 | 98 |
if (resp == JOptionPane.NO_OPTION) { |
77 | 99 |
// CANCEL EDITING |
... | ... | |
284 | 306 |
public IExtensionStatus getStatus() { |
285 | 307 |
return new StopEditingStatus(); |
286 | 308 |
} |
309 |
|
|
310 |
|
|
311 |
private JPanel getExplanationPanel(String name) { |
|
312 |
|
|
313 |
BorderLayout bl = new BorderLayout(10, 10); |
|
314 |
JPanel resp = new JPanel(bl); |
|
315 |
|
|
316 |
String msg = Messages.getText("realmente_desea_guardar"); |
|
317 |
JLabel topLabel = new JLabel(msg); |
|
318 |
|
|
319 |
JPanel mainPanel = new JPanel(new GridBagLayout()); |
|
320 |
GridBagConstraints cc = new GridBagConstraints(); |
|
321 |
|
|
322 |
cc.gridx = 0; |
|
323 |
cc.gridy = 0; |
|
324 |
cc.anchor = GridBagConstraints.WEST; |
|
325 |
|
|
326 |
cc.insets = new Insets(3, 6, 3, 6); |
|
327 |
|
|
328 |
Font boldf = mainPanel.getFont().deriveFont(Font.BOLD); |
|
329 |
|
|
330 |
JLabel lbl = new JLabel(Messages.getText("_Guardar")); |
|
331 |
lbl.setFont(boldf); |
|
332 |
mainPanel.add(lbl, cc); |
|
333 |
cc.gridx = 1; |
|
334 |
mainPanel.add(new JLabel(Messages.getText("_Save_changes_performed")), cc); |
|
335 |
|
|
336 |
cc.gridx = 0; |
|
337 |
cc.gridy = 1; |
|
338 |
lbl = new JLabel(Messages.getText("_Descartar")); |
|
339 |
lbl.setFont(boldf); |
|
340 |
mainPanel.add(lbl, cc); |
|
341 |
cc.gridx = 1; |
|
342 |
mainPanel.add(new JLabel(Messages.getText("_Discard_and_lose_changes")), cc); |
|
343 |
|
|
344 |
cc.gridx = 0; |
|
345 |
cc.gridy = 2; |
|
346 |
lbl = new JLabel(Messages.getText("_Continuar")); |
|
347 |
lbl.setFont(boldf); |
|
348 |
mainPanel.add(lbl, cc); |
|
349 |
cc.gridx = 1; |
|
350 |
mainPanel.add(new JLabel(Messages.getText("_Do_not_save_yet_Stay_in_editing_mode")), cc); |
|
351 |
|
|
352 |
resp.add(mainPanel, BorderLayout.CENTER); |
|
353 |
resp.add(topLabel, BorderLayout.NORTH); |
|
354 |
return resp; |
|
355 |
} |
|
287 | 356 |
} |
Also available in: Unified diff