Revision 26594 tmp/trunk/cliente/WorkSpace_WPSClient/extWPSCallejero/src/es/logex/gvsig/streetsmap/ui/PanelQuerysBuilder.java

View differences:

PanelQuerysBuilder.java
1 1
package es.logex.gvsig.streetsmap.ui;
2
import com.cloudgarden.resource.ArrayFocusTraversalPolicy;
3 2

  
3
import java.awt.Component;
4
import java.awt.Container;
4 5
import java.awt.Dimension;
6
import java.awt.FocusTraversalPolicy;
5 7
import java.awt.GridBagConstraints;
6 8
import java.awt.GridBagLayout;
7 9
import java.awt.Insets;
......
26 28
import javax.swing.JTextField;
27 29
import javax.swing.ListModel;
28 30
import javax.swing.SwingConstants;
31
import javax.swing.SwingUtilities;
29 32
import javax.swing.event.DocumentEvent;
30 33
import javax.swing.event.DocumentListener;
31 34
import javax.swing.event.ListDataEvent;
......
139 142
	public PanelQuerysBuilder(PanelQuerysActionsDelegate queryClient) {
140 143
		this();
141 144
		panelQuerysClient = queryClient;
145
		//SwingUtilities.getWindowAncestor(this).pack();
142 146
	}
143 147
	
144 148
	private void initGUI() {
145 149
		try {
146 150
			GridBagLayout thisLayout = new GridBagLayout();
147 151
			setPreferredSize(new Dimension(400, 300));
148
			thisLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.2, 0.0, 0.7, 0.0, 0.1};
152
			thisLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.4, 0.0, 0.6, 0.0, 0.1};
149 153
			thisLayout.rowHeights = new int[] {7, 45, 7, 7, 7, 7, 7, 7};
150 154
			thisLayout.columnWeights = new double[] {0.0, 0.1, 0.0};
151 155
			thisLayout.columnWidths = new int[] {7, 7, 7};
......
258 262
			}
259 263
			{
260 264
				PanelItemsQuery = new JPanel();
261
				this.add(PanelItemsQuery, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
265
				this.add(PanelItemsQuery, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
262 266
				this.add(getPanelHeader(), new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
263 267
				GridBagLayout PanelItemsQueryLayout = new GridBagLayout();
264 268
				PanelItemsQueryLayout.columnWidths = new int[] {7, 7, 20, 7, 7};
265
				PanelItemsQueryLayout.rowHeights = new int[] {7, 7};
269
				PanelItemsQueryLayout.rowHeights = new int[] {7, 7, 7, 7};
266 270
				PanelItemsQueryLayout.columnWeights = new double[] {0.1, 2.0, 0.1, 0.1, 0.0};
267
				PanelItemsQueryLayout.rowWeights = new double[] {0.1, 0.1};
271
				PanelItemsQueryLayout.rowWeights = new double[] {0.5, 0.0, 0.5, 0.0};
268 272
				PanelItemsQuery.setPreferredSize(new java.awt.Dimension(400,38));
269 273
				PanelItemsQuery.setLayout(PanelItemsQueryLayout);
270 274
				PanelItemsQuery.setSize(400, 32);
271 275
				{
272 276
					Municipio = new JLabel();
273
					PanelItemsQuery.add(Municipio, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
277
					PanelItemsQuery.add(Municipio, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
274 278
					Municipio.setText("Municipio");
275 279
				}
276 280
				{
277 281
					lblCalleVia = new JLabel();
278
					PanelItemsQuery.add(lblCalleVia, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
282
					PanelItemsQuery.add(lblCalleVia, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
279 283
					lblCalleVia.setText("Calle o Via");
280 284
				}
281 285
				{
282 286
					lblNumero = new JLabel();
283
					PanelItemsQuery.add(lblNumero, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
287
					PanelItemsQuery.add(lblNumero, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
284 288
					lblNumero.setText("NÂș");
285 289
				}
286 290
				{
287 291
					txtNumeroPol = new JTextField();
288
					PanelItemsQuery.add(txtNumeroPol, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
292
					PanelItemsQuery.add(txtNumeroPol, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
289 293
					txtNumeroPol.setToolTipText("Introduce el numero de patio a localizar");
290 294
				}
291 295
				{
292 296
					txtCalleVia = new JTextField();
293 297
					txtCalleVia.getDocument().addDocumentListener(new SyncButtonsQueryDocumentListener());
294
					PanelItemsQuery.add(txtCalleVia, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
298
					PanelItemsQuery.add(txtCalleVia, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
295 299
					txtCalleVia.setToolTipText("Introduce el nombre de la calle o via a buscar");
296 300
				}
297 301
				{
298 302
					txtMunicipio = new JTextField();
299 303
					txtMunicipio.getDocument().addDocumentListener(new SyncButtonsQueryDocumentListener());
300
					PanelItemsQuery.add(txtMunicipio, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
304
					PanelItemsQuery.add(txtMunicipio, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
301 305
					txtMunicipio.setToolTipText("Introduce el nombre del municipio a buscar");
302 306
				}
303 307
				PanelItemsQuery.setFocusCycleRoot(true);
304
				PanelItemsQuery.setFocusTraversalPolicy(new ArrayFocusTraversalPolicy(new java.awt.Component[] {txtMunicipio, txtCalleVia, txtNumeroPol}));
308
				PanelItemsQuery.setFocusTraversalPolicy(new FocusTraversalPolicy()
309
						{
310

  
311
							@Override
312
							public Component getComponentAfter(
313
									Container container, Component component) {
314
								if(component == txtMunicipio)
315
								{
316
									return txtCalleVia;
317
								}
318
								if(component == txtCalleVia)
319
								{
320
									return txtNumeroPol;
321
								}
322
								if(component == txtNumeroPol)
323
								{
324
									return txtMunicipio;
325
								}
326
								return component;
327
							}
328

  
329
							@Override
330
							public Component getComponentBefore(
331
									Container container, Component component) {
332
								if(component == txtMunicipio)
333
								{
334
									return txtNumeroPol;
335
								}
336
								if(component == txtCalleVia)
337
								{
338
									return txtMunicipio;
339
								}
340
								if(component == txtNumeroPol)
341
								{
342
									return txtCalleVia;
343
								}
344
								return component;
345
							}
346

  
347
							@Override
348
							public Component getDefaultComponent(
349
									Container container) {
350
								return txtMunicipio;
351
							}
352

  
353
							@Override
354
							public Component getFirstComponent(
355
									Container container) {
356
								return txtMunicipio;
357
							}
358

  
359
							@Override
360
							public Component getLastComponent(
361
									Container container) {
362
								return txtNumeroPol;
363
							}
364
					
365
						}
366
				);
367
			
305 368
			}
306 369
			((DefaultComboBoxModel)listResultsQuery.getModel()).removeAllElements();
307 370
		} catch (Exception e) {

Also available in: Unified diff