Revision 38869 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StopEditing.java

View differences:

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();

Also available in: Unified diff