Revision 6122 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/selectionByTheme/SelectionByTheme.java

View differences:

SelectionByTheme.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.selectionByTheme;
42 42

  
43
import java.awt.BorderLayout;
44
import java.awt.GridLayout;
43 45
import java.util.ArrayList;
44 46

  
45 47
import javax.swing.DefaultComboBoxModel;
48
import javax.swing.JLabel;
46 49
import javax.swing.JPanel;
47 50

  
51
import org.gvsig.gui.beans.swing.JButton;
52

  
48 53
import com.iver.andami.PluginServices;
49 54
import com.iver.andami.ui.mdiManager.View;
50 55
import com.iver.andami.ui.mdiManager.ViewInfo;
51
import com.iver.cit.gvsig.fmap.layers.FLayer;
56
import com.iver.utiles.swing.JComboBox;
52 57

  
53 58

  
54 59
public class SelectionByTheme extends JPanel implements View {
......
75 80

  
76 81
	private ArrayList listeners = new ArrayList();
77 82

  
78
	private javax.swing.JPanel jPanel = null;
79
	private javax.swing.JPanel jPanel1 = null;
80
	private javax.swing.JLabel jLabel = null;
81
	private javax.swing.JComboBox cmbAction = null;
82
	private javax.swing.JLabel jLabel1 = null;
83
	private javax.swing.JComboBox cmbCapas = null;
84
	private javax.swing.JButton btnNew = null;
85
	private javax.swing.JButton btnAdd = null;
86
	private javax.swing.JButton btnFrom = null;
87
	private javax.swing.JButton btnCancel = null;
83
	private JPanel jPanel = null;
84
	private JPanel jPanel1 = null;
85
	private JLabel jLabel = null;
86
	private JComboBox cmbAction = null;
87
	private JLabel jLabel1 = null;
88
	private JComboBox cmbCapas = null;
89
	private JButton btnNew = null;
90
	private JButton btnAdd = null;
91
	private JButton btnFrom = null;
92
	private JButton btnCancel = null;
88 93
	/**
89 94
	 * This is the default constructor
90 95
	 */
......
94 99
	}
95 100
	/**
96 101
	 * This method initializes this
97
	 * 
102
	 *
98 103
	 * @return void
99 104
	 */
100 105
	private void initialize() {
101
		java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
102
		layFlowLayout2.setHgap(0);
103
		layFlowLayout2.setVgap(0);
104
		this.setLayout(layFlowLayout2);
105
		this.add(getJPanel(), null);
106
		this.add(getJPanel1(), null);
107
		this.setSize(440, 220);
106
		this.setLayout(new BorderLayout(10, 10));
107
		this.add(new JLabel(), BorderLayout.NORTH);
108
		this.add(new JLabel(), BorderLayout.WEST);
109
		this.add(getJPanel(), BorderLayout.CENTER);
110
		this.add(getJPanel1(), BorderLayout.EAST);
111
		this.add(new JLabel(), BorderLayout.SOUTH);
112
		this.setSize(480, 95);
108 113
	}
109 114
	/**
110 115
	 * This method initializes jPanel
111
	 * 
112
	 * @return javax.swing.JPanel
116
	 *
117
	 * @return JPanel
113 118
	 */
114
	private javax.swing.JPanel getJPanel() {
119
	private JPanel getJPanel() {
115 120
		if(jPanel == null) {
116
			jPanel = new javax.swing.JPanel();
121
			jPanel = new JPanel();
117 122
			java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
118 123
			layFlowLayout1.setVgap(30);
119
			jPanel.setLayout(layFlowLayout1);
124
			jPanel.setLayout(new GridLayout(4, 2, 5, 5));
120 125
			jPanel.add(getJLabel(), null);
121 126
			jPanel.add(getCmbAction(), null);
122 127
			jPanel.add(getJLabel1(), null);
123 128
			jPanel.add(getCmbCapas(), null);
124
			jPanel.setPreferredSize(new java.awt.Dimension(290,220));
129

  
125 130
		}
126 131
		return jPanel;
127 132
	}
128 133
	/**
129 134
	 * This method initializes jPanel1
130
	 * 
131
	 * @return javax.swing.JPanel
135
	 *
136
	 * @return JPanel
132 137
	 */
133
	private javax.swing.JPanel getJPanel1() {
138
	private JPanel getJPanel1() {
134 139
		if(jPanel1 == null) {
135
			jPanel1 = new javax.swing.JPanel();
136
			java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
137
			layFlowLayout3.setVgap(25);
138
			jPanel1.setLayout(layFlowLayout3);
140
			jPanel1 = new JPanel();
141
			jPanel1.setLayout(new GridLayout(4, 1, 5, 5));
139 142
			jPanel1.add(getBtnNew(), null);
140 143
			jPanel1.add(getBtnAdd(), null);
141 144
			jPanel1.add(getBtnFrom(), null);
......
146 149
	}
147 150
	/**
148 151
	 * This method initializes jLabel
149
	 * 
150
	 * @return javax.swing.JLabel
152
	 *
153
	 * @return JLabel
151 154
	 */
152
	private javax.swing.JLabel getJLabel() {
155
	private JLabel getJLabel() {
153 156
		if(jLabel == null) {
154
			jLabel = new javax.swing.JLabel();
157
			jLabel = new JLabel();
155 158
			jLabel.setText(PluginServices.getText(this, "Seleccionar_de_las_capas_activas_los_elementos_que") + "... ");
156
			jLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
157 159
		}
158 160
		return jLabel;
159 161
	}
160 162
	/**
161 163
	 * This method initializes cmbAction
162
	 * 
163
	 * @return javax.swing.JComboBox
164
	 *
165
	 * @return JComboBox
164 166
	 */
165
	private javax.swing.JComboBox getCmbAction() {
167
	private JComboBox getCmbAction() {
166 168
		if(cmbAction == null) {
167
			cmbAction = new javax.swing.JComboBox();
169
			cmbAction = new JComboBox();
168 170
			cmbAction.setPreferredSize(new java.awt.Dimension(200,20));
169 171
			DefaultComboBoxModel model = new DefaultComboBoxModel(textosAcciones);
170 172
			cmbAction.setModel(model);
171
			cmbAction.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
172 173
		}
173 174
		return cmbAction;
174 175
	}
175 176
	/**
176 177
	 * This method initializes jLabel1
177
	 * 
178
	 * @return javax.swing.JLabel
178
	 *
179
	 * @return JLabel
179 180
	 */
180
	private javax.swing.JLabel getJLabel1() {
181
	private JLabel getJLabel1() {
181 182
		if(jLabel1 == null) {
182
			jLabel1 = new javax.swing.JLabel();
183
			jLabel1 = new JLabel();
183 184
			jLabel1.setText(PluginServices.getText(this, "Elementos_seleccionados_de_la_capa"));
184
			jLabel1.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
185 185
		}
186 186
		return jLabel1;
187 187
	}
188 188
	/**
189 189
	 * This method initializes cmbCapas
190
	 * 
191
	 * @return javax.swing.JComboBox
190
	 *
191
	 * @return JComboBox
192 192
	 */
193
	private javax.swing.JComboBox getCmbCapas() {
193
	private JComboBox getCmbCapas() {
194 194
		if(cmbCapas == null) {
195
			cmbCapas = new javax.swing.JComboBox();
195
			cmbCapas = new JComboBox();
196 196
			cmbCapas.setPreferredSize(new java.awt.Dimension(200,20));
197
			cmbCapas.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
198 197
		}
199 198
		return cmbCapas;
200 199
	}
201 200
	/**
202 201
	 * This method initializes btnNew
203
	 * 
204
	 * @return javax.swing.JButton
202
	 *
203
	 * @return JButton
205 204
	 */
206
	private javax.swing.JButton getBtnNew() {
205
	private JButton getBtnNew() {
207 206
		if(btnNew == null) {
208
			btnNew = new javax.swing.JButton();
207
			btnNew = new JButton();
209 208
			btnNew.setText(PluginServices.getText(this, "Nuevo_conjunto"));
210 209
			btnNew.setMargin(new java.awt.Insets(2,2,2,2));
211
			btnNew.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
212
			btnNew.addActionListener(new java.awt.event.ActionListener() { 
210
			btnNew.addActionListener(new java.awt.event.ActionListener() {
213 211
				public void actionPerformed(java.awt.event.ActionEvent e) {
214 212
					callNewListeners(cmbCapas.getSelectedIndex(), cmbAction.getSelectedIndex());
215 213
				}
......
219 217
	}
220 218
	/**
221 219
	 * This method initializes btnAdd
222
	 * 
223
	 * @return javax.swing.JButton
220
	 *
221
	 * @return JButton
224 222
	 */
225
	private javax.swing.JButton getBtnAdd() {
223
	private JButton getBtnAdd() {
226 224
		if(btnAdd == null) {
227
			btnAdd = new javax.swing.JButton();
225
			btnAdd = new JButton();
228 226
			btnAdd.setText(PluginServices.getText(this, "Anadir_al_conjunto"));
229 227
			btnAdd.setMargin(new java.awt.Insets(2,2,2,2));
230
			btnAdd.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
231
			btnAdd.addActionListener(new java.awt.event.ActionListener() { 
232
				public void actionPerformed(java.awt.event.ActionEvent e) {    
228
			btnAdd.addActionListener(new java.awt.event.ActionListener() {
229
				public void actionPerformed(java.awt.event.ActionEvent e) {
233 230
					callAddToListeners(cmbCapas.getSelectedIndex(), cmbAction.getSelectedIndex());
234 231
				}
235 232
			});
......
238 235
	}
239 236
	/**
240 237
	 * This method initializes btnFrom
241
	 * 
242
	 * @return javax.swing.JButton
238
	 *
239
	 * @return JButton
243 240
	 */
244
	private javax.swing.JButton getBtnFrom() {
241
	private JButton getBtnFrom() {
245 242
		if(btnFrom == null) {
246
			btnFrom = new javax.swing.JButton();
243
			btnFrom = new JButton();
247 244
			btnFrom.setText(PluginServices.getText(this, "Seleccionar_del_conjunto"));
248 245
			btnFrom.setMargin(new java.awt.Insets(2,2,2,2));
249
			btnFrom.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
250
			btnFrom.addActionListener(new java.awt.event.ActionListener() { 
251
				public void actionPerformed(java.awt.event.ActionEvent e) {    
246
			btnFrom.addActionListener(new java.awt.event.ActionListener() {
247
				public void actionPerformed(java.awt.event.ActionEvent e) {
252 248
					callFromListeners(cmbCapas.getSelectedIndex(), cmbAction.getSelectedIndex());
253 249
				}
254 250
			});
......
257 253
	}
258 254
	/**
259 255
	 * This method initializes btnCancel
260
	 * 
261
	 * @return javax.swing.JButton
256
	 *
257
	 * @return JButton
262 258
	 */
263
	private javax.swing.JButton getBtnCancel() {
259
	private JButton getBtnCancel() {
264 260
		if(btnCancel == null) {
265
			btnCancel = new javax.swing.JButton();
261
			btnCancel = new JButton();
266 262
			btnCancel.setText(PluginServices.getText(this, "Cancel"));
267 263
			btnCancel.setMargin(new java.awt.Insets(2,2,2,2));
268
			btnCancel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
269
			btnCancel.addActionListener(new java.awt.event.ActionListener() { 
270
				public void actionPerformed(java.awt.event.ActionEvent e) {    
264
			btnCancel.addActionListener(new java.awt.event.ActionListener() {
265
				public void actionPerformed(java.awt.event.ActionEvent e) {
271 266
					PluginServices.getMDIManager().closeView(SelectionByTheme.this);
272 267
				}
273 268
			});
274 269
		}
275 270
		return btnCancel;
276 271
	}
277
	
272

  
278 273
	/**
279 274
	 * @return
280 275
	 */
......
290 285
		String[] nameLayers = new String[dataSource.getLayers().getLayersCount()];
291 286
		for (int i=0; i < nameLayers.length; i++)
292 287
			nameLayers[i] = dataSource.getLayers().getLayer(i).getName();
293
		DefaultComboBoxModel model = 
288
		DefaultComboBoxModel model =
294 289
			new DefaultComboBoxModel(nameLayers);
295 290
		cmbCapas.setModel(model);
296 291
	}
......
299 294
	 */
300 295
	public ViewInfo getViewInfo() {
301 296
		ViewInfo vi = new ViewInfo(ViewInfo.MODALDIALOG);
297
		vi.setWidth(this.getWidth()+8);
298
		vi.setHeight(this.getHeight());
299
		vi.setTitle(PluginServices.getText(this, "Seleccion_por_capa"));
302 300
		return vi;
303 301
	}
304
	
302

  
305 303
	private void callNewListeners(int selection, int actionCode){
306 304
		for (int i = 0; i < listeners.size();
307 305
				i++) {
308 306
			SelectionByThemeListener l = (SelectionByThemeListener) listeners.get(i);
309 307
			l.newSet(dataSource.getLayers().getActives(), dataSource.getLayers().getLayer(selection), actionCode);
310 308
		}
311
		
309

  
312 310
	}
313
	
311

  
314 312
	private void callAddToListeners(int selection, int actionCode){
315 313
		for (int i = 0; i < listeners.size();
316 314
				i++) {
317 315
			SelectionByThemeListener l = (SelectionByThemeListener) listeners.get(i);
318 316
			l.addToSet(dataSource.getLayers().getActives(), dataSource.getLayers().getLayer(selection), actionCode);
319 317
		}
320
		
318

  
321 319
	}
322
	
320

  
323 321
	private void callFromListeners(int selection, int actionCode){
324 322
		for (int i = 0; i < listeners.size();
325 323
				i++) {
326 324
			SelectionByThemeListener l = (SelectionByThemeListener) listeners.get(i);
327 325
			l.fromSet(dataSource.getLayers().getActives(), dataSource.getLayers().getLayer(selection), actionCode);
328 326
		}
329
		
327

  
330 328
	}
331
	
329

  
332 330
	/**
333 331
	 * DOCUMENT ME!
334 332
	 *
......
355 353
	 */
356 354
	public void viewActivated() {
357 355
	}
358
	
356

  
359 357
}  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"

Also available in: Unified diff