Revision 36475 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/ViewProperties.java

View differences:

ViewProperties.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
7 8
 * as published by the Free Software Foundation; either version 2
8 9
 * of the License, or (at your option) any later version.
9
 *
10
 * 
10 11
 * This program is distributed in the hope that it will be useful,
11 12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 14
 * GNU General Public License for more details.
14
 *
15
 * 
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
40 21
 */
41 22
package org.gvsig.app.project.documents.view.gui;
42 23

  
43

  
44 24
import java.awt.Color;
45 25
import java.awt.Component;
46 26
import java.awt.Dimension;
......
48 28
import java.awt.event.ActionListener;
49 29
import java.util.List;
50 30

  
31
import javax.swing.JButton;
51 32
import javax.swing.JColorChooser;
52 33
import javax.swing.JComboBox;
53 34
import javax.swing.JLabel;
......
55 36
import javax.swing.JPanel;
56 37

  
57 38
import org.cresques.cts.IProjection;
39

  
58 40
import org.gvsig.andami.PluginServices;
59 41
import org.gvsig.andami.ui.mdiManager.SingletonWindow;
60 42
import org.gvsig.andami.ui.mdiManager.WindowInfo;
61
import org.gvsig.app.extension.ProjectExtension;
62 43
import org.gvsig.app.gui.JComboBoxUnits;
63 44
import org.gvsig.app.gui.panels.CRSSelectPanel;
64 45
import org.gvsig.app.project.Project;
65 46
import org.gvsig.app.project.ProjectManager;
66 47
import org.gvsig.app.project.documents.Document;
67
import org.gvsig.app.project.documents.AbstractDocument;
68 48
import org.gvsig.app.project.documents.layout.Attributes;
69 49
import org.gvsig.app.project.documents.view.DefaultViewDocument;
70 50
import org.gvsig.app.project.documents.view.ViewManager;
71 51
import org.gvsig.fmap.mapcontext.MapContext;
72 52
import org.gvsig.gui.beans.AcceptCancelPanel;
73
import org.gvsig.gui.beans.swing.JButton;
53
import org.gvsig.tools.swing.api.ToolsSwingLocator;
74 54

  
75 55
/**
76 56
 * Dialogo donde se muestran las propiedades de una vista
77
 *
57
 * 
78 58
 * @author Fernando Gonz?lez Cort?s
79 59
 */
80
public class ViewProperties extends JPanel implements SingletonWindow{
81
	/**
60
public class ViewProperties extends JPanel implements SingletonWindow {
61

  
62
    /**
82 63
	 * 
83 64
	 */
84
	private static final long serialVersionUID = 5328865370833315385L;
85
	/*private String[] units = new String[] {
86
	 PluginServices.getText(this, "metros"),
87
	 PluginServices.getText(this, "kilometros"),
88
	 };
89
	 */
90
	//private static String[] unitsNames = null;
91
	private javax.swing.JLabel jLabel = null;
92
	private javax.swing.JTextField txtName = null;
93
	private javax.swing.JLabel jLabel1 = null;
94
	private javax.swing.JTextField txtDate = null;
95
	private javax.swing.JLabel jLabel2 = null;
96
	private javax.swing.JTextField txtOwner = null;
97
	private javax.swing.JLabel jLabel4 = null;
98
	private javax.swing.JComboBox cmbMapUnits = null;
99
	private javax.swing.JLabel jLabel5 = null;
100
	private javax.swing.JComboBox cmbDistanceUnits = null;
101
	private javax.swing.JLabel jLabel6 = null;
102
	private javax.swing.JTextArea txtComments = null;
103
	private javax.swing.JLabel jLabel7 = null;
104
	private javax.swing.JLabel lblColor = null;
65
    private static final long serialVersionUID = 5328865370833315385L;
66
    private javax.swing.JLabel jLabel = null;
67
    private javax.swing.JTextField txtName = null;
68
    private javax.swing.JLabel jLabel1 = null;
69
    private javax.swing.JTextField txtDate = null;
70
    private javax.swing.JLabel jLabel2 = null;
71
    private javax.swing.JTextField txtOwner = null;
72
    private javax.swing.JLabel jLabel4 = null;
73
    private javax.swing.JComboBox cmbMapUnits = null;
74
    private javax.swing.JLabel jLabel5 = null;
75
    private javax.swing.JComboBox cmbDistanceUnits = null;
76
    private javax.swing.JLabel jLabel6 = null;
77
    private javax.swing.JTextArea txtComments = null;
78
    private javax.swing.JLabel jLabel7 = null;
79
    private javax.swing.JLabel lblColor = null;
105 80

  
106
	private Color backColor = null;
81
    private Color backColor = null;
107 82

  
108
	private JButton btnColor = null;
109
	private DefaultViewDocument view=null;
110
	private javax.swing.JScrollPane jScrollPane = null;
111
	private javax.swing.JPanel jPanel = null;
112
	private javax.swing.JPanel jPanel1 = null;
113
	private javax.swing.JPanel jPanel2 = null;
114
	private javax.swing.JPanel jPanel3 = null;
83
    private JButton btnColor = null;
84
    private DefaultViewDocument view = null;
85
    private javax.swing.JScrollPane jScrollPane = null;
86
    private javax.swing.JPanel jPanel = null;
87
    private javax.swing.JPanel jPanel1 = null;
88
    private javax.swing.JPanel jPanel2 = null;
89
    private javax.swing.JPanel jPanel3 = null;
115 90

  
116
	private javax.swing.JLabel jLabel3 = null;
117
	private javax.swing.JLabel jLabelSep1 = null;
118
	//private WindowInfo m_viewinfo = null;
119
	//private JLabel jLblProj = null;
120
	//private JLabel jLblProjName = null;
121
	//private JButton jBtnChangeProj = null;
122
	protected CRSSelectPanel jPanelProj = null;
123
	private AcceptCancelPanel okCancelPanel = null;
124
	private boolean isAcceppted=false;
125
	private JLabel jLabel8 = null;
126
	private JComboBox cmbDistanceArea = null;
127
	/**
128
	 * This is the default constructor
129
	 *
130
	 * @param f Frame padre del dialogo
131
	 * @param v Vista que se representa
132
	 */
133
	public ViewProperties(DefaultViewDocument v) {
134
		view = v;
135
		initialize();
136
	}
91
    private javax.swing.JLabel jLabel3 = null;
92
    private javax.swing.JLabel jLabelSep1 = null;
93
    protected CRSSelectPanel jPanelProj = null;
94
    private AcceptCancelPanel okCancelPanel = null;
95
    private boolean isAcceppted = false;
96
    private JLabel jLabel8 = null;
97
    private JComboBox cmbDistanceArea = null;
137 98

  
138
	/**
139
	 * This method initializes this
140
	 */
141
	private void initialize() {
142
		this.setSize(386, 436);
143
		java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
144
		layFlowLayout3.setHgap(0);
145
		setLayout(layFlowLayout3);
146
		/*      jLblProjName = new JLabel();
147
		 jLblProj = new JLabel();
148
		 jLblProj.setText(view.getProjection().getAbrev());
149
		 jLblProj.setPreferredSize(new java.awt.Dimension(180,20));
150
		 jLblProjName.setText("Proyecci?n actual:");
151
		 jLblProjName.setPreferredSize(new java.awt.Dimension(95,15));*/
152
		this.setPreferredSize(new java.awt.Dimension(365,463));
153
		add(getJPanel(), null);
154
		add(getJPanel1(), null);
155
		add(getJPanel2(), null);
156
		add(getJPanel3(), null);
157
		add(getJLabelSep1(), null);
158
		this.add(getJPanelProj(), null);
159
		this.add(getJLabel6(), null);
160
		add(getJScrollPane(), null);
99
    /**
100
     * This is the default constructor
101
     * 
102
     * @param f
103
     *            Frame padre del dialogo
104
     * @param v
105
     *            Vista que se representa
106
     */
107
    public ViewProperties(DefaultViewDocument v) {
108
        view = v;
109
        initialize();
110
    }
161 111

  
112
    /**
113
     * This method initializes this
114
     */
115
    private void initialize() {
116
        this.setSize(386, 436);
117
        java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
118
        layFlowLayout3.setHgap(0);
119
        setLayout(layFlowLayout3);
120
        this.setPreferredSize(new java.awt.Dimension(365, 463));
121
        add(getJPanel(), null);
122
        add(getJPanel1(), null);
123
        add(getJPanel2(), null);
124
        add(getJPanel3(), null);
125
        add(getJLabelSep1(), null);
126
        this.add(getJPanelProj(), null);
127
        this.add(getJLabel6(), null);
128
        add(getJScrollPane(), null);
162 129

  
163
		this.add(getJLabel7(), null);
164
		this.add(getLblColor(), null);
165
		this.add(getBtnColor(), null);
130
        this.add(getJLabel7(), null);
131
        this.add(getLblColor(), null);
132
        this.add(getBtnColor(), null);
166 133

  
134
        add(getJLabel3(), null);
135
        this.add(getOkCancelPanel(), null);
136
        txtName.setText(view.getName());
137
        txtDate.setText(view.getCreationDate());
138
        txtOwner.setText(view.getOwner());
167 139

  
168
		add(getJLabel3(), null);
169
		this.add(getOkCancelPanel(), null);
170
		txtName.setText(view.getName());
171
		txtDate.setText(view.getCreationDate());
172
		txtOwner.setText(view.getOwner());
140
        cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort()
141
            .getMapUnits());
142
        cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort()
143
            .getDistanceUnits());
144
        cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort()
145
            .getDistanceArea());
146
        txtComments.setText(view.getComment());
173 147

  
174
		cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
175
		cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits());
176
		cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea());
177
		txtComments.setText(view.getComment());
148
        lblColor.setBackground(view.getMapContext().getViewPort()
149
            .getBackColor());
150
    }
178 151

  
179
		lblColor.setBackground(view.getMapContext().getViewPort().getBackColor());
180
	}
152
    /**
153
     * This method initializes jLabel
154
     * 
155
     * @return javax.swing.JLabel
156
     */
157
    private javax.swing.JLabel getJLabel() {
158
        if (jLabel == null) {
159
            jLabel = new javax.swing.JLabel();
160
            jLabel.setText(PluginServices.getText(this, "nombre") + ":");
161
        }
181 162

  
182
	/**
183
	 * This method initializes jLabel
184
	 *
185
	 * @return javax.swing.JLabel
186
	 */
187
	private javax.swing.JLabel getJLabel() {
188
		if (jLabel == null) {
189
			jLabel = new javax.swing.JLabel();
190
			jLabel.setText(PluginServices.getText(this, "nombre") + ":");
191
		}
163
        return jLabel;
164
    }
192 165

  
193
		return jLabel;
194
	}
166
    private javax.swing.JLabel getJLabelSep1() {
167
        if (jLabelSep1 == null) {
168
            jLabelSep1 = new javax.swing.JLabel();
169
            jLabelSep1.setPreferredSize(new java.awt.Dimension(200, 10));
170
        }
171
        return jLabelSep1;
172
    }
195 173

  
196
	private javax.swing.JLabel getJLabelSep1() {
197
		if (jLabelSep1 == null) {
198
			jLabelSep1 = new javax.swing.JLabel();
199
			jLabelSep1.setPreferredSize(new java.awt.Dimension(200, 10));
200
		}
201
		return jLabelSep1;
202
	}
174
    /**
175
     * This method initializes txtName
176
     * 
177
     * @return javax.swing.JTextField
178
     */
179
    private javax.swing.JTextField getTxtName() {
180
        if (txtName == null) {
181
            txtName = new javax.swing.JTextField();
182
            txtName.setPreferredSize(new java.awt.Dimension(200, 20));
183
        }
203 184

  
204
	/**
205
	 * This method initializes txtName
206
	 *
207
	 * @return javax.swing.JTextField
208
	 */
209
	private javax.swing.JTextField getTxtName() {
210
		if (txtName == null) {
211
			txtName = new javax.swing.JTextField();
212
			txtName.setPreferredSize(new java.awt.Dimension(200, 20));
213
		}
185
        return txtName;
186
    }
214 187

  
215
		return txtName;
216
	}
188
    /**
189
     * This method initializes jLabel1
190
     * 
191
     * @return javax.swing.JLabel
192
     */
193
    private javax.swing.JLabel getJLabel1() {
194
        if (jLabel1 == null) {
195
            jLabel1 = new javax.swing.JLabel();
196
            jLabel1
197
                .setText(PluginServices.getText(this, "creation_date") + ":");
198
        }
217 199

  
218
	/**
219
	 * This method initializes jLabel1
220
	 *
221
	 * @return javax.swing.JLabel
222
	 */
223
	private javax.swing.JLabel getJLabel1() {
224
		if (jLabel1 == null) {
225
			jLabel1 = new javax.swing.JLabel();
226
			jLabel1.setText(PluginServices.getText(this, "creation_date") + ":");
227
		}
200
        return jLabel1;
201
    }
228 202

  
229
		return jLabel1;
230
	}
203
    /**
204
     * This method initializes txtDate
205
     * 
206
     * @return javax.swing.JTextField
207
     */
208
    private javax.swing.JTextField getTxtDate() {
209
        if (txtDate == null) {
210
            txtDate = new javax.swing.JTextField();
211
            txtDate.setPreferredSize(new java.awt.Dimension(200, 20));
212
            txtDate.setEditable(false);
213
            txtDate.setBackground(java.awt.Color.white);
214
        }
231 215

  
232
	/**
233
	 * This method initializes txtDate
234
	 *
235
	 * @return javax.swing.JTextField
236
	 */
237
	private javax.swing.JTextField getTxtDate() {
238
		if (txtDate == null) {
239
			txtDate = new javax.swing.JTextField();
240
			txtDate.setPreferredSize(new java.awt.Dimension(200, 20));
241
			txtDate.setEditable(false);
242
			txtDate.setBackground(java.awt.Color.white);
243
		}
216
        return txtDate;
217
    }
244 218

  
245
		return txtDate;
246
	}
219
    /**
220
     * This method initializes jLabel2
221
     * 
222
     * @return javax.swing.JLabel
223
     */
224
    private javax.swing.JLabel getJLabel2() {
225
        if (jLabel2 == null) {
226
            jLabel2 = new javax.swing.JLabel();
227
            jLabel2.setText(PluginServices.getText(this, "owner") + ":");
228
        }
247 229

  
248
	/**
249
	 * This method initializes jLabel2
250
	 *
251
	 * @return javax.swing.JLabel
252
	 */
253
	private javax.swing.JLabel getJLabel2() {
254
		if (jLabel2 == null) {
255
			jLabel2 = new javax.swing.JLabel();
256
			jLabel2.setText(PluginServices.getText(this, "owner") + ":");
257
		}
230
        return jLabel2;
231
    }
258 232

  
259
		return jLabel2;
260
	}
233
    /**
234
     * This method initializes txtOwner
235
     * 
236
     * @return javax.swing.JTextField
237
     */
238
    private javax.swing.JTextField getTxtOwner() {
239
        if (txtOwner == null) {
240
            txtOwner = new javax.swing.JTextField();
241
            txtOwner.setPreferredSize(new java.awt.Dimension(200, 20));
242
        }
261 243

  
262
	/**
263
	 * This method initializes txtOwner
264
	 *
265
	 * @return javax.swing.JTextField
266
	 */
267
	private javax.swing.JTextField getTxtOwner() {
268
		if (txtOwner == null) {
269
			txtOwner = new javax.swing.JTextField();
270
			txtOwner.setPreferredSize(new java.awt.Dimension(200, 20));
271
		}
244
        return txtOwner;
245
    }
272 246

  
273
		return txtOwner;
274
	}
247
    /**
248
     * This method initializes jLabel4
249
     * 
250
     * @return javax.swing.JLabel
251
     */
252
    private javax.swing.JLabel getJLabel4() {
253
        if (jLabel4 == null) {
254
            jLabel4 = new javax.swing.JLabel();
255
            jLabel4.setText(PluginServices.getText(this, "map_units") + ":");
256
            jLabel4.setName("jLabel4");
257
        }
275 258

  
276
	/**
277
	 * This method initializes jLabel4
278
	 *
279
	 * @return javax.swing.JLabel
280
	 */
281
	private javax.swing.JLabel getJLabel4() {
282
		if (jLabel4 == null) {
283
			jLabel4 = new javax.swing.JLabel();
284
			jLabel4.setText(PluginServices.getText(this, "map_units") + ":");
285
			jLabel4.setName("jLabel4");
286
		}
259
        return jLabel4;
260
    }
287 261

  
288
		return jLabel4;
289
	}
262
    /**
263
     * This method initializes cmbMapUnits
264
     * 
265
     * @return javax.swing.JComboBox
266
     */
267
    private javax.swing.JComboBox getCmbMapUnits() {
268
        if (cmbMapUnits == null
269
            || MapContext.getDistanceNames().length > cmbMapUnits
270
                .getItemCount()) {
271
            cmbMapUnits = new JComboBoxUnits(false);
290 272

  
291
	/**
292
	 * This method initializes cmbMapUnits
293
	 *
294
	 * @return javax.swing.JComboBox
295
	 */
296
	private javax.swing.JComboBox getCmbMapUnits() {
297
		if (cmbMapUnits == null|| MapContext.getDistanceNames().length>cmbMapUnits.getItemCount()) {
298
			//boolean includePixels;
299
			cmbMapUnits = new JComboBoxUnits(false);
273
            cmbMapUnits.setPreferredSize(new java.awt.Dimension(200, 20));
274
            IProjection proj = view.getProjection();
275
            if (!proj.isProjected()) {
276
                cmbMapUnits.setSelectedItem(PluginServices.getText(this,
277
                    "Grados")); // deegree
278
                cmbMapUnits.setEnabled(false);
279
            } else {
280
                if (!(cmbMapUnits.getItemCount() == MapContext
281
                    .getDistanceNames().length)) {
282
                    cmbMapUnits.removeItem(PluginServices.getText(this,
283
                        "Grados")); // deegree
284
                    view.getMapContext().getViewPort().setMapUnits(1);
285
                }
286
                cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort()
287
                    .getMapUnits());
288
                cmbMapUnits.setEnabled(true);
289
            }
290
            cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort()
291
                .getMapUnits());
292
        }
300 293

  
301
//			cmbMapUnits = new javax.swing.JComboBox(getUnitsNames());
302
			cmbMapUnits.setPreferredSize(new java.awt.Dimension(200, 20));
303
			IProjection proj=view.getProjection();
304
			if (!proj.isProjected()) {
305
//				if (cmbMapUnits.getItemCount()==MapContext.NAMES.length) {
306
//					cmbMapUnits.addItem(PluginServices.getText(this, Attributes.DEGREES));
307
//				}
308
				cmbMapUnits.setSelectedItem(PluginServices.getText(this,"Grados")); // deegree
309
				cmbMapUnits.setEnabled(false);
310
			}else {
311
				if (!(cmbMapUnits.getItemCount()==MapContext.getDistanceNames().length)) {
312
					cmbMapUnits.removeItem(PluginServices.getText(this,"Grados")); // deegree
313
					view.getMapContext().getViewPort().setMapUnits(1);
314
				}
315
				cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
316
				cmbMapUnits.setEnabled(true);
317
			}
318
			cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits());
294
        return cmbMapUnits;
295
    }
319 296

  
320
//
321
//			cmbMapUnits.addActionListener(new java.awt.event.ActionListener() {
322
//				public void actionPerformed(java.awt.event.ActionEvent e) {
323
//					//view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
324
//				}
325
//			});
326
		}
297
    /**
298
     * This method initializes jLabel5
299
     * 
300
     * @return javax.swing.JLabel
301
     */
302
    private javax.swing.JLabel getJLabel5() {
303
        if (jLabel5 == null) {
304
            jLabel5 = new javax.swing.JLabel();
305
            jLabel5.setText(PluginServices.getText(this, "distance_units")
306
                + ":");
307
            jLabel5.setName("jLabel5");
308
        }
327 309

  
328
		return cmbMapUnits;
329
	}
310
        return jLabel5;
311
    }
330 312

  
331
	/**
332
	 * This method initializes jLabel5
333
	 *
334
	 * @return javax.swing.JLabel
335
	 */
336
	private javax.swing.JLabel getJLabel5() {
337
		if (jLabel5 == null) {
338
			jLabel5 = new javax.swing.JLabel();
339
			jLabel5.setText(PluginServices.getText(this, "distance_units") + ":");
340
			jLabel5.setName("jLabel5");
341
		}
313
    /**
314
     * This method initializes cmbDistanceUnits
315
     * 
316
     * @return javax.swing.JComboBox
317
     */
318
    private javax.swing.JComboBox getCmbDistanceUnits() {
319
        if (cmbDistanceUnits == null
320
            || MapContext.getDistanceNames().length > cmbDistanceUnits
321
                .getItemCount()) {
322
            cmbDistanceUnits = new JComboBoxUnits(false);
323
            cmbDistanceUnits.setPreferredSize(new java.awt.Dimension(200, 20));
324
        }
342 325

  
343
		return jLabel5;
344
	}
326
        return cmbDistanceUnits;
327
    }
345 328

  
346
	/**
347
	 * This method initializes cmbDistanceUnits
348
	 *
349
	 * @return javax.swing.JComboBox
350
	 */
351
	private javax.swing.JComboBox getCmbDistanceUnits() {
352
		if (cmbDistanceUnits == null|| MapContext.getDistanceNames().length>cmbDistanceUnits.getItemCount()){
353
			//boolean includePixels;
354
			cmbDistanceUnits = new JComboBoxUnits(false);
355
//			cmbDistanceUnits = new javax.swing.JComboBox(getUnitsNames());
356
			cmbDistanceUnits.setPreferredSize(new java.awt.Dimension(200, 20));
357
//			cmbDistanceUnits.setEditable(false);
358
//			cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits());
359
//			cmbDistanceUnits.addActionListener(new java.awt.event.ActionListener() {
360
//				public void actionPerformed(java.awt.event.ActionEvent e) {
361
//					//view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
362
//				}
363
//			});
364
		}
329
    /**
330
     * This method initializes jLabel6
331
     * 
332
     * @return javax.swing.JLabel
333
     */
334
    private javax.swing.JLabel getJLabel6() {
335
        if (jLabel6 == null) {
336
            jLabel6 = new javax.swing.JLabel();
337
            jLabel6.setText(PluginServices.getText(this, "comentarios") + ":");
338
            jLabel6.setPreferredSize(new java.awt.Dimension(340, 35));
339
            jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
340
            jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
341
        }
365 342

  
366
		return cmbDistanceUnits;
367
	}
343
        return jLabel6;
344
    }
368 345

  
369
	/**
370
	 * This method initializes jLabel6
371
	 *
372
	 * @return javax.swing.JLabel
373
	 */
374
	private javax.swing.JLabel getJLabel6() {
375
		if (jLabel6 == null) {
376
			jLabel6 = new javax.swing.JLabel();
377
			jLabel6.setText(PluginServices.getText(this, "comentarios") + ":");
378
			jLabel6.setPreferredSize(new java.awt.Dimension(340,35));
379
			jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
380
			jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
381
		}
346
    /**
347
     * This method initializes txtComments
348
     * 
349
     * @return javax.swing.JTextArea
350
     */
351
    private javax.swing.JTextArea getTxtComments() {
352
        if (txtComments == null) {
353
            txtComments = new javax.swing.JTextArea();
354
            txtComments.setRows(1);
355
            txtComments.setColumns(28);
356
        }
382 357

  
383
		return jLabel6;
384
	}
358
        return txtComments;
359
    }
385 360

  
386
	/**
387
	 * This method initializes txtComments
388
	 *
389
	 * @return javax.swing.JTextArea
390
	 */
391
	private javax.swing.JTextArea getTxtComments() {
392
		if (txtComments == null) {
393
			txtComments = new javax.swing.JTextArea();
394
			txtComments.setRows(1);
395
			txtComments.setColumns(28);
396
		}
361
    /**
362
     * This method initializes jLabel7
363
     * 
364
     * @return javax.swing.JLabel
365
     */
366
    private javax.swing.JLabel getJLabel7() {
367
        if (jLabel7 == null) {
368
            jLabel7 = new javax.swing.JLabel();
369
            jLabel7.setText(PluginServices.getText(this, "background_color")
370
                + ":");
371
            jLabel7.setPreferredSize(new java.awt.Dimension(190, 16));
372
        }
397 373

  
398
		return txtComments;
399
	}
374
        return jLabel7;
375
    }
400 376

  
401
	/**
402
	 * This method initializes jLabel7
403
	 *
404
	 * @return javax.swing.JLabel
405
	 */
406
	private javax.swing.JLabel getJLabel7() {
407
		if (jLabel7 == null) {
408
			jLabel7 = new javax.swing.JLabel();
409
			jLabel7.setText(PluginServices.getText(this, "background_color") +
410
			":");
411
			jLabel7.setPreferredSize(new java.awt.Dimension(190,16));
412
		}
377
    /**
378
     * This method initializes lblColor
379
     * 
380
     * @return javax.swing.JLabel
381
     */
382
    private javax.swing.JLabel getLblColor() {
383
        if (lblColor == null) {
384
            lblColor = new javax.swing.JLabel();
385
            lblColor.setText("");
386
            lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
387
            Color theColor = view.getMapContext().getViewPort().getBackColor();
388
            backColor = theColor;
389
            if (theColor == null) {
390
                theColor = Color.WHITE;
391
            }
392
            lblColor.setBackground(theColor);
393
            lblColor.setOpaque(true);
394
        }
413 395

  
414
		return jLabel7;
415
	}
396
        return lblColor;
397
    }
416 398

  
417
	/**
418
	 * This method initializes lblColor
419
	 *
420
	 * @return javax.swing.JLabel
421
	 */
422
	private javax.swing.JLabel getLblColor() {
423
		if (lblColor == null) {
424
			lblColor = new javax.swing.JLabel();
425
			lblColor.setText("");
426
			lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
427
			Color theColor = view.getMapContext().getViewPort().getBackColor();
428
			backColor=theColor;
429
			if (theColor == null) {
430
				theColor = Color.WHITE;
431
			}
432
			lblColor.setBackground(theColor);
433
			lblColor.setOpaque(true);
434
		}
399
    /**
400
     * This method initializes btnColor
401
     * 
402
     * @return javax.swing.JButton
403
     */
404
    private JButton getBtnColor() {
405
        if (btnColor == null) {
406
            btnColor =
407
                ToolsSwingLocator.getUsabilitySwingManager().createJButton();
435 408

  
436
		return lblColor;
437
	}
409
            btnColor.setText("...");
438 410

  
439
	/**
440
	 * This method initializes btnColor
441
	 *
442
	 * @return javax.swing.JButton
443
	 */
444
	private JButton getBtnColor() {
445
		if (btnColor == null) {
446
			btnColor = new JButton();
411
            btnColor.addActionListener(new java.awt.event.ActionListener() {
447 412

  
448
			btnColor.setText("...");
413
                public void actionPerformed(java.awt.event.ActionEvent e) {
414
                    Color ret =
415
                        JColorChooser.showDialog(ViewProperties.this,
416
                            PluginServices.getText(this, "background_color"),
417
                            lblColor.getBackground());
449 418

  
450
			btnColor.addActionListener(new java.awt.event.ActionListener() {
451
				public void actionPerformed(java.awt.event.ActionEvent e) {
452
					Color ret = JColorChooser.showDialog(ViewProperties.this,
453
							PluginServices.getText(this, "background_color"),
454
							lblColor.getBackground());
419
                    if (ret != null) {
420
                        lblColor.setBackground(ret);
421
                        backColor = ret;
422
                    } else {
423
                        lblColor.setBackground(Color.WHITE);
424
                    }
425
                }
426
            });
427
        }
455 428

  
456
					if (ret != null) {
457
						lblColor.setBackground(ret);
458
						backColor = ret;
459
					} else {
460
						lblColor.setBackground(Color.WHITE);
461
					}
462
				}
463
			});
464
		}
429
        return btnColor;
430
    }
465 431

  
466
		return btnColor;
467
	}
432
    /**
433
     * This method initializes jScrollPane
434
     * 
435
     * @return javax.swing.JScrollPane
436
     */
437
    private javax.swing.JScrollPane getJScrollPane() {
438
        if (jScrollPane == null) {
439
            jScrollPane = new javax.swing.JScrollPane();
440
            jScrollPane.setViewportView(getTxtComments());
441
            jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
442
        }
468 443

  
469
	/**
470
	 * This method initializes jScrollPane
471
	 *
472
	 * @return javax.swing.JScrollPane
473
	 */
474
	private javax.swing.JScrollPane getJScrollPane() {
475
		if (jScrollPane == null) {
476
			jScrollPane = new javax.swing.JScrollPane();
477
			jScrollPane.setViewportView(getTxtComments());
478
			jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70));
479
		}
444
        return jScrollPane;
445
    }
480 446

  
481
		return jScrollPane;
482
	}
447
    /**
448
     * This method initializes jPanel
449
     * 
450
     * @return javax.swing.JPanel
451
     */
452
    private javax.swing.JPanel getJPanel() {
453
        if (jPanel == null) {
454
            jPanel = new javax.swing.JPanel();
483 455

  
484
	/**
485
	 * This method initializes jPanel
486
	 *
487
	 * @return javax.swing.JPanel
488
	 */
489
	private javax.swing.JPanel getJPanel() {
490
		if (jPanel == null) {
491
			jPanel = new javax.swing.JPanel();
492

  
493
			/*
494
			java.awt.FlowLayout layFlowLayout4 = new java.awt.FlowLayout();
495
			layFlowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
496
			layFlowLayout4.setVgap(9);
497
			jPanel.setLayout(layFlowLayout4);
498
			*/
499

  
500
            GridLayout layout = new GridLayout(3,1);
456
            GridLayout layout = new GridLayout(3, 1);
501 457
            layout.setVgap(5);
502 458
            jPanel.setLayout(layout);
503 459

  
460
            jPanel.add(getJLabel(), null);
461
            jPanel.add(getJLabel1(), null);
462
            jPanel.add(getJLabel2(), null);
463
            jPanel.setPreferredSize(new java.awt.Dimension(140, 80));
464
        }
504 465

  
505
			jPanel.add(getJLabel(), null);
506
			jPanel.add(getJLabel1(), null);
507
			jPanel.add(getJLabel2(), null);
508
			jPanel.setPreferredSize(new java.awt.Dimension(140, 80));
509
		}
466
        return jPanel;
467
    }
510 468

  
511
		return jPanel;
512
	}
469
    /**
470
     * This method initializes jPanel1
471
     * 
472
     * @return javax.swing.JPanel
473
     */
474
    private javax.swing.JPanel getJPanel1() {
475
        if (jPanel1 == null) {
476
            jPanel1 = new javax.swing.JPanel();
513 477

  
514
	/**
515
	 * This method initializes jPanel1
516
	 *
517
	 * @return javax.swing.JPanel
518
	 */
519
	private javax.swing.JPanel getJPanel1() {
520
		if (jPanel1 == null) {
521
			jPanel1 = new javax.swing.JPanel();
478
            java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
479
            layFlowLayout2.setHgap(5);
480
            layFlowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
481
            jPanel1.setLayout(layFlowLayout2);
482
            jPanel1.add(getTxtName(), null);
483
            jPanel1.add(getTxtDate(), null);
484
            jPanel1.add(getTxtOwner(), null);
485
            jPanel1.setPreferredSize(new java.awt.Dimension(210, 80));
486
        }
522 487

  
523
			java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
524
			layFlowLayout2.setHgap(5);
525
			layFlowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
526
			jPanel1.setLayout(layFlowLayout2);
527
			jPanel1.add(getTxtName(), null);
528
			jPanel1.add(getTxtDate(), null);
529
			jPanel1.add(getTxtOwner(), null);
530
			jPanel1.setPreferredSize(new java.awt.Dimension(210, 80));
531
		}
488
        return jPanel1;
489
    }
532 490

  
533
		return jPanel1;
534
	}
491
    /**
492
     * This method initializes jPanel2
493
     * 
494
     * @return javax.swing.JPanel
495
     */
496
    private javax.swing.JPanel getJPanel2() {
497
        if (jPanel2 == null) {
498
            jLabel8 = new JLabel();
499
            jLabel8.setText("unidades_area");
500
            GridLayout gridLayout = new GridLayout();
501
            gridLayout.setRows(3);
502
            jPanel2 = new javax.swing.JPanel();
535 503

  
536
	/**
537
	 * This method initializes jPanel2
538
	 *
539
	 * @return javax.swing.JPanel
540
	 */
541
	private javax.swing.JPanel getJPanel2() {
542
		if (jPanel2 == null) {
543
			jLabel8 = new JLabel();
544
			jLabel8.setText("unidades_area");
545
			GridLayout gridLayout = new GridLayout();
546
			gridLayout.setRows(3);
547
			jPanel2 = new javax.swing.JPanel();
504
            jPanel2.setLayout(gridLayout);
505
            jPanel2.setPreferredSize(new java.awt.Dimension(140, 80));
506
            jPanel2.add(getJLabel4(), null);
507
            jPanel2.add(getJLabel5(), null);
508
            jPanel2.add(jLabel8, null);
509
        }
548 510

  
549
			jPanel2.setLayout(gridLayout);
550
			jPanel2.setPreferredSize(new java.awt.Dimension(140,80));
551
			jPanel2.add(getJLabel4(), null);
552
			jPanel2.add(getJLabel5(), null);
553
			jPanel2.add(jLabel8, null);
554
		}
511
        return jPanel2;
512
    }
555 513

  
556
		return jPanel2;
557
	}
514
    /**
515
     * This method initializes jPanel3
516
     * 
517
     * @return javax.swing.JPanel
518
     */
519
    private javax.swing.JPanel getJPanel3() {
520
        if (jPanel3 == null) {
521
            jPanel3 = new javax.swing.JPanel();
558 522

  
559
	/**
560
	 * This method initializes jPanel3
561
	 *
562
	 * @return javax.swing.JPanel
563
	 */
564
	private javax.swing.JPanel getJPanel3() {
565
		if (jPanel3 == null) {
566
			jPanel3 = new javax.swing.JPanel();
523
            java.awt.FlowLayout layFlowLayout6 = new java.awt.FlowLayout();
524
            layFlowLayout6.setAlignment(java.awt.FlowLayout.LEFT);
525
            jPanel3.setLayout(layFlowLayout6);
526
            jPanel3.add(getCmbMapUnits(), null);
527
            jPanel3.add(getCmbDistanceUnits(), null);
528
            jPanel3.setPreferredSize(new java.awt.Dimension(210, 80));
529
            jPanel3.add(getCmbDistanceArea(), null);
530
        }
567 531

  
568
			java.awt.FlowLayout layFlowLayout6 = new java.awt.FlowLayout();
569
			layFlowLayout6.setAlignment(java.awt.FlowLayout.LEFT);
570
			jPanel3.setLayout(layFlowLayout6);
571
			jPanel3.add(getCmbMapUnits(), null);
572
			jPanel3.add(getCmbDistanceUnits(), null);
573
			jPanel3.setPreferredSize(new java.awt.Dimension(210,80));
574
			jPanel3.add(getCmbDistanceArea(), null);
575
		}
532
        return jPanel3;
533
    }
576 534

  
577
		return jPanel3;
578
	}
535
    /**
536
     * This method initializes jLabel3
537
     * 
538
     * @return javax.swing.JLabel
539
     */
540
    private javax.swing.JLabel getJLabel3() {
541
        if (jLabel3 == null) {
542
            jLabel3 = new javax.swing.JLabel();
543
            jLabel3.setText("");
544
            jLabel3.setPreferredSize(new java.awt.Dimension(30, 0));
545
        }
579 546

  
547
        return jLabel3;
548
    }
580 549

  
581
	/**
582
	 * This method initializes jLabel3
583
	 *
584
	 * @return javax.swing.JLabel
585
	 */
586
	private javax.swing.JLabel getJLabel3() {
587
		if (jLabel3 == null) {
588
			jLabel3 = new javax.swing.JLabel();
589
			jLabel3.setText("");
590
			jLabel3.setPreferredSize(new java.awt.Dimension(30, 0));
591
		}
550
    /**
551
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
552
     */
553
    public WindowInfo getWindowInfo() {
554
        WindowInfo m_viewinfo = new WindowInfo();
555
        m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_vista"));
556
        m_viewinfo.setHeight(410);
557
        return m_viewinfo;
558
    }
592 559

  
593
		return jLabel3;
594
	}
560
    /**
561
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
562
     */
563
    public void viewActivated() {
564
        // FIXME: jjdc este metodo sobra ? esta vacio.
565
    }
595 566

  
596
	/**
597
	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
598
	 */
599
	public WindowInfo getWindowInfo() {
600
		WindowInfo m_viewinfo=new WindowInfo();
601
		m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_vista"));
602
		m_viewinfo.setHeight(410);
603
		return m_viewinfo;
604
	}
567
    /**
568
     * This method initializes jPanel4
569
     * 
570
     * @return javax.swing.JPanel
571
     */
572
    private CRSSelectPanel getJPanelProj() {
573
        if (jPanelProj == null) {
574
            IProjection proj = view.getProjection();
575
            jPanelProj = CRSSelectPanel.getPanel(proj);
576
            jPanelProj.setPreferredSize(new java.awt.Dimension(330, 35));
577
            jPanelProj.addActionListener(new java.awt.event.ActionListener() {
605 578

  
606
	/**
607
	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
608
	 */
609
	public void viewActivated() {
610
		// FIXME: jjdc este metodo sobra ? esta vacio.
611
	}
612
	/**
613
	 * This method initializes jButton
614
	 *
615
	 * @return javax.swing.JButton
616
	 * /
617
	 private JButton getJBtnChangeProj() {
618
	 if (jBtnChangeProj == null) {
619
	 jBtnChangeProj = new JButton();
620
	 jBtnChangeProj.setText("...");
621
	 jBtnChangeProj.setPreferredSize(new java.awt.Dimension(34,16));
622
	 jBtnChangeProj.addActionListener(new java.awt.event.ActionListener() {
623
	 public void actionPerformed(java.awt.event.ActionEvent e) {
624
	 CSSelectionDialog csSelect = new CSSelectionDialog();
625
	 csSelect.setProjection(view.getProjection());
579
                public void actionPerformed(java.awt.event.ActionEvent e) {
580
                    if (jPanelProj.isOkPressed()) {
581
                        if (!jPanelProj.getCurProj().isProjected()) {
582
                            getCmbMapUnits().setSelectedItem(
583
                                PluginServices
584
                                    .getText(this, Attributes.DEGREES));
585
                            getCmbMapUnits().setEnabled(false);
586
                        } else {
587
                            if (getCmbMapUnits().getSelectedItem().equals(
588
                                PluginServices
589
                                    .getText(this, Attributes.DEGREES))) {
590
                                getCmbMapUnits().setSelectedIndex(1);
591
                            }
592
                            getCmbMapUnits().setEnabled(true);
593
                        }
594
                        view.setProjection(jPanelProj.getCurProj());
595
                    }
596
                }
597
            });
598
        }
599
        return jPanelProj;
600
    }
626 601

  
627
	 PluginServices.getMDIManager().addView(csSelect);
602
    /**
603
     * @see org.gvsig.andami.ui.mdiManager.SingletonWindow#getWindowModel()
604
     */
605
    public Object getWindowModel() {
606
        return view;
607
    }
628 608

  
629
	 if (csSelect.isOkPressed()) {
630
	 view.getMapContext().setProjection(csSelect.getProjection());
631
	 jLblProj.setText(view.getProjection().getAbrev());
632
	 }
633
	 }
634
	 });
635
	 }
636
	 return jBtnChangeProj;
637
	 } */
638
	/**
639
	 * This method initializes jPanel4
640
	 *
641
	 * @return javax.swing.JPanel
642
	 */
643
	private CRSSelectPanel getJPanelProj() {
644
		if (jPanelProj == null) {
645
			IProjection proj=view.getProjection();
646
			jPanelProj = CRSSelectPanel.getPanel(proj);
647
			jPanelProj.setPreferredSize(new java.awt.Dimension(330,35));
648
			jPanelProj.addActionListener(new java.awt.event.ActionListener() {
649
				public void actionPerformed(java.awt.event.ActionEvent e) {
650
					if (jPanelProj.isOkPressed()) {
651
						if (!jPanelProj.getCurProj().isProjected()) {
652
//							if (getCmbMapUnits().getItemCount()==MapContext.NAMES.length) {
653
//								getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
654
//							}
655
							getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES));
656
							getCmbMapUnits().setEnabled(false);
657
						}else {
658
							if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) {
659
								getCmbMapUnits().setSelectedIndex(1);
660
							}
661
							getCmbMapUnits().setEnabled(true);
662
//							if (!(getCmbMapUnits().getItemCount()==MapContext.NAMES.length)) {
663
//								getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
664
//							}
665
						}
666
						view.setProjection(jPanelProj.getCurProj());
667
					}
668
				}
669
			});
609
    /**
610
     * This method initializes okCancelPanel
611
     * 
612
     * @return javax.swing.JPanel
613
     */
614
    private AcceptCancelPanel getOkCancelPanel() {
615
        if (okCancelPanel == null) {
616
            ActionListener okAction, cancelAction;
617
            okAction = new java.awt.event.ActionListener() {
670 618

  
671
//			jPanelProj.add(jLblProjName, null);
672
//			jPanelProj.add(jLblProj, null);
673
//			jPanelProj.add(getJBtnChangeProj(), null);
674
		}
675
		return jPanelProj;
676
	}
619
                public void actionPerformed(java.awt.event.ActionEvent e) {
620
                    String name = txtName.getText();
621
                    if (name == null || name.length() == 0) {
622
                        return;
623
                    }
624
                    Project project =
625
                        ProjectManager.getInstance().getCurrentProject();
626
                    List<Document> views =
627
                        project.getDocuments(ViewManager.TYPENAME);
628
                    for (Document theView : views) {
629
                        if (view.equals(theView)) {
630
                            continue;
631
                        }
632
                        if (theView.getName().equals(name)) {
633
                            JOptionPane.showMessageDialog(
634
                                (Component) PluginServices.getMainFrame(),
635
                                PluginServices.getText(this,
636
                                    "elemento_ya_existe"));
637
                            return;
638
                        }
639
                    }
677 640

  
678
	/**
679
	 * @see org.gvsig.andami.ui.mdiManager.SingletonWindow#getWindowModel()
680
	 */
681
	public Object getWindowModel() {
682
		return view;
683
	}
641
                    view.setName(name);
642
                    view.setCreationDate(txtDate.getText());
643
                    view.setOwner(txtOwner.getText());
644
                    view.setComment(txtComments.getText());
645
                    view.getMapContext().getViewPort()
646
                        .setMapUnits(cmbMapUnits.getSelectedIndex());
647
                    view.getMapContext().getViewPort()
648
                        .setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
649
                    view.getMapContext().getViewPort()
650
                        .setDistanceArea(cmbDistanceArea.getSelectedIndex());
651
                    view.setBackColor(backColor);
652
                    isAcceppted = true;
653
                    PluginServices.getMDIManager().closeWindow(
654
                        ViewProperties.this);
655
                }
656
            };
657
            cancelAction = new java.awt.event.ActionListener() {
684 658

  
685
	/**
686
	 * This method initializes okCancelPanel
687
	 *
688
	 * @return javax.swing.JPanel
689
	 */
690
	private AcceptCancelPanel getOkCancelPanel() {
691
		if (okCancelPanel == null) {
692
			ActionListener okAction, cancelAction;
693
			okAction = new java.awt.event.ActionListener() {
694
				public void actionPerformed(java.awt.event.ActionEvent e) {
695
					String name=txtName.getText();
696
					if (name == null || name.length() == 0) {
697
						return;
698
					}
699
					Project project= ProjectManager.getInstance().getCurrentProject();
700
					List<Document> views=project.getDocuments(ViewManager.TYPENAME);
701
					for (Document theView : views) {
702
						if( view.equals(theView) ) {
703
							continue;
704
						}
705
						if( theView.getName().equals(name)) {
706
							JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "elemento_ya_existe"));
707
							return;							
708
						}
709
					}
659
                public void actionPerformed(java.awt.event.ActionEvent e) {
660
                    isAcceppted = false;
661
                    PluginServices.getMDIManager().closeWindow(
662
                        ViewProperties.this);
663
                }
664
            };
665
            okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
666
            Dimension sz = this.getSize();
667
            sz.setSize((int) sz.getWidth() - 20, (int) sz.getHeight());
668
            okCancelPanel.setPreferredSize(sz);
669
        }
670
        return okCancelPanel;
671
    }
710 672

  
711
					view.setName(name);
712
					view.setCreationDate(txtDate.getText());
713
					view.setOwner(txtOwner.getText());
714
					view.setComment(txtComments.getText());
715
					view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
716
					view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
717
					view.getMapContext().getViewPort().setDistanceArea(cmbDistanceArea.getSelectedIndex());
718
					view.setBackColor(backColor);
719
					isAcceppted=true;
720
					PluginServices.getMDIManager().closeWindow(ViewProperties.this);
721
				}
722
			};
723
			cancelAction = new java.awt.event.ActionListener() {
673
    public boolean isAcceppted() {
674
        return isAcceppted;
675
    }
724 676

  
725
				public void actionPerformed(java.awt.event.ActionEvent e) {
726
					isAcceppted=false;
727
					PluginServices.getMDIManager().closeWindow(ViewProperties.this);
728
				}
729
			};
730
			okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
731
			Dimension sz = this.getSize();
732
			sz.setSize((int)sz.getWidth()-20, (int) sz.getHeight());
733
			okCancelPanel.setPreferredSize(sz);
734
		}
735
		return okCancelPanel;
736
	}
677
    /**
678
     * This method initializes jComboBox
679
     * 
680
     * @return javax.swing.JComboBox
681
     */
682
    private JComboBox getCmbDistanceArea() {
683
        String[] names = MapContext.getAreaNames();
684
        if (cmbDistanceArea == null
685
            || names.length > cmbDistanceArea.getItemCount()) {
686
            for (int i = 0; i < names.length; i++) {
687
                names[i] =
688
                    PluginServices.getText(this, names[i])
689
                        + MapContext.getOfLinear(i);
690
            }
691
            cmbDistanceArea = new javax.swing.JComboBox(names);
692
            cmbDistanceArea.setPreferredSize(new java.awt.Dimension(200, 20));
693
            cmbDistanceArea.setEditable(false);
694
            cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort()
695
                .getDistanceArea());
696
            cmbDistanceArea
697
                .addActionListener(new java.awt.event.ActionListener() {
737 698

  
738
//	private String[] getUnitsNames() {
739
//		if (unitsNames == null) {
740
//			unitsNames = new String[MapContext.NAMES.length];
741
//			int i=0;
742
//			for (i=0;i<MapContext.NAMES.length;i++) {
743
//				unitsNames[i]=PluginServices.getText(this, MapContext.NAMES[i]);
744
//			}
745
//			//unitsNames[i]=PluginServices.getText(this, Attributes.DEGREES);
746
//		}
747
//		return unitsNames;
748
//	}
699
                    public void actionPerformed(java.awt.event.ActionEvent e) {
700
                        // view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
701
                    }
702
                });
703
        }
749 704

  
750
	public boolean isAcceppted() {
751
		return isAcceppted;
752
	}
753
	/**
754
	 * This method initializes jComboBox
755
	 *
756
	 * @return javax.swing.JComboBox
757
	 */
758
	private JComboBox getCmbDistanceArea() {
759
		String[] names= MapContext.getAreaNames();
760
		if (cmbDistanceArea == null || names.length>cmbDistanceArea.getItemCount()) {
761
			for (int i = 0; i < names.length; i++) {
762
				names[i]=PluginServices.getText(this,names[i])+ MapContext.getOfLinear(i);
763
			}
764
			cmbDistanceArea = new javax.swing.JComboBox(names);
765
			cmbDistanceArea.setPreferredSize(new java.awt.Dimension(200, 20));
766
			cmbDistanceArea.setEditable(false);
767
			cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea());
768
			cmbDistanceArea.addActionListener(new java.awt.event.ActionListener() {
769
				public void actionPerformed(java.awt.event.ActionEvent e) {
770
					//view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
771
				}
772
			});
773
		}
705
        return cmbDistanceArea;
774 706

  
775
		return cmbDistanceArea;
707
    }
776 708

  
777
	}
778
	public Object getWindowProfile() {
779
		return WindowInfo.PROPERTIES_PROFILE;
780
	}
709
    public Object getWindowProfile() {
710
        return WindowInfo.PROPERTIES_PROFILE;
711
    }
781 712

  
782
}  //  @jve:decl-index=0:visual-constraint="10,10"
713
} // @jve:decl-index=0:visual-constraint="10,10"

Also available in: Unified diff