Revision 20840 trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/createlayer/CreateLayerPanel.java

View differences:

CreateLayerPanel.java
50 50
 * @version 10/03/2008
51 51
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
52 52
 */
53
public class CreateLayerPanel extends JPanel implements PropertyListener {
53
public class CreateLayerPanel implements PropertyListener {
54 54
	private static final long serialVersionUID = 3921564127360827156L;
55
	private JPanel       panel             = null;
55 56
	private JRadioButton jRBOnlyView       = null;
56 57
	private JRadioButton jRBNewLayer       = null;
57 58
	private JRadioButton jRBFileGenerate   = null;
58 59
	private JRadioButton jRBOpenMemory     = null;
59

  
60 60
	private JPanel       jPNameFile        = null;
61 61
	private JLabel       labelFilename     = null;
62 62
	private JTextField   filenameTextField = null;
......
69 69
		initialize();
70 70
		translate();
71 71
	}
72
	
73
	/**
74
	 * Devuelve el panel principal
75
	 * @return
76
	 */
77
	public JPanel getJPanel() {
78
		if (panel == null) {
79
			panel = new JPanel();
80
		}
81
		return panel;
82
	}
72 83

  
73 84
	/**
74 85
	 * Seccion donde ir?n todas las traducciones invariables del componente
......
86 97
		ButtonGroup buttonGroup2;
87 98
		GridBagConstraints gridBagConstraints;
88 99

  
89
		setLayout(new GridBagLayout());
100
		getJPanel().setLayout(new GridBagLayout());
90 101
		
91 102
		buttonGroup1 = new ButtonGroup();
92 103
		buttonGroup1.add(getRadioOnlyView());
......
96 107
		gridBagConstraints.gridy = 0;
97 108
		gridBagConstraints.anchor = GridBagConstraints.WEST;
98 109
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
99
		add(getRadioOnlyView(), gridBagConstraints);
110
		getJPanel().add(getRadioOnlyView(), gridBagConstraints);
100 111

  
101 112
		buttonGroup1.add(getRadioNewLayer());
102 113

  
......
105 116
		gridBagConstraints.gridy = 1;
106 117
		gridBagConstraints.anchor = GridBagConstraints.WEST;
107 118
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
108
		add(getRadioNewLayer(), gridBagConstraints);
119
		getJPanel().add(getRadioNewLayer(), gridBagConstraints);
109 120
		
110 121
		JPanel jPanel2 = new JPanel();
111 122
		jPanel2.setLayout(new GridBagLayout());
......
132 143
		gridBagConstraints.gridy = 2;
133 144
		gridBagConstraints.anchor = GridBagConstraints.WEST;
134 145
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
135
		add(jPanel2, gridBagConstraints);
146
		getJPanel().add(jPanel2, gridBagConstraints);
136 147
	}
137 148
	
138 149
	/**
......
178 189
	 * Devuelve el JRadioButton de Abrir en memoria
179 190
	 * @return
180 191
	 */
181
	public JRadioButton getRadioOpenMemory() {
192
	private JRadioButton getRadioOpenMemory() {
182 193
		if (jRBOpenMemory == null) {
183 194
			jRBOpenMemory = new JRadioButton();
184 195
			jRBOpenMemory.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
......
198 209
	 * Devuelve el JRadioButton de generar fichero
199 210
	 * @return
200 211
	 */
201
	public JRadioButton getRadioFileGenerate() {
212
	private JRadioButton getRadioFileGenerate() {
202 213
		if (jRBFileGenerate == null) {
203 214
			jRBFileGenerate = new JRadioButton();
204 215
			jRBFileGenerate.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
......
211 222
	 * Devuelve el JRadioButton de Solo vista
212 223
	 * @return
213 224
	 */
214
	public JRadioButton getRadioOnlyView() {
225
	private JRadioButton getRadioOnlyView() {
215 226
		if (jRBOnlyView == null) {
216 227
			jRBOnlyView = new JRadioButton();
217 228
			jRBOnlyView.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
......
224 235
	 * Devuelve el JRadioButton de nueva capa
225 236
	 * @return
226 237
	 */
227
	public JRadioButton getRadioNewLayer() {
238
	private JRadioButton getRadioNewLayer() {
228 239
		if (jRBNewLayer == null) {
229 240
			jRBNewLayer = new JRadioButton();
230 241
			jRBNewLayer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
......
244 255
	 *
245 256
	 * @return javax.swing.JTextField
246 257
	 */
247
	public JTextField getFilenameTextField() {
258
	private JTextField getFilenameTextField() {
248 259
		if (filenameTextField == null) {
249 260
			filenameTextField = new JTextField();
250 261
			filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height));
......
253 264
		return filenameTextField;
254 265
	}
255 266

  
256
	public JLabel getLabelFilename() {
267
	private JLabel getLabelFilename() {
257 268
		if (labelFilename == null) {
258 269
			labelFilename = new JLabel();
259 270
		}
......
293 304
		getFilenameTextField().setEnabled(value);
294 305
		getLabelFilename().setEnabled(value);
295 306
	}
307
	
308
	/**
309
	 * Establece el texto de la etiqueta del nombre de fichero
310
	 * @param text
311
	 */
312
	public void setLabelFilename(String text) {
313
		getLabelFilename().setText(text);
314
	}
315
	
316
	public boolean isNewLayerSelected() {
317
		return getRadioNewLayer().isSelected();
318
	}
296 319

  
320
	public boolean isOnlyViewSelected() {
321
		return getRadioOnlyView().isSelected();
322
	}
323

  
297 324
	/**
298 325
	 * Cuando alguien ha cambiado la propiedad del nombre de la 
299 326
	 * capa se actualiza autom?ticamente
......
328 355
			for (int i = 0; i < extList.length; i++)
329 356
				chooser.addChoosableFileFilter(new ExtendedFileFilter(extList[i]));
330 357

  
331
			if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
358
			if (chooser.showOpenDialog(getJPanel()) != JFileChooser.APPROVE_OPTION)
332 359
				return null;
333 360

  
334 361
			FileOpenWizard.setLastPath(chooser.getSelectedFile().getPath().substring(0, chooser.getSelectedFile().getPath().lastIndexOf(File.separator)));

Also available in: Unified diff