Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / FAlignDialog.java @ 1656

History | View | Annotate | Download (16 KB)

1 312 fernando
/*
2
 * Created on 19-jul-2004
3
 *
4
 */
5 1656 vcaballero
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6 1103 fjp
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27 1656 vcaballero
 *   Av. Blasco Ib??ez, 50
28 1103 fjp
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45 312 fernando
package com.iver.cit.gvsig.gui.layout.dialogs;
46
47 596 fernando
import com.iver.andami.PluginServices;
48
import com.iver.andami.ui.mdiManager.SingletonView;
49
import com.iver.andami.ui.mdiManager.ViewInfo;
50 1074 vcaballero
51 312 fernando
import com.iver.cit.gvsig.Abrir;
52
import com.iver.cit.gvsig.gui.layout.Layout;
53
54 1074 vcaballero
import javax.swing.ImageIcon;
55
import javax.swing.JPanel;
56
import javax.swing.JToggleButton;
57 312 fernando
58 1074 vcaballero
59 312 fernando
/**
60 1074 vcaballero
 * Contenedor de los botones necesarios para alinear, desplazar y cambiar el
61 1656 vcaballero
 * tama?o de los fframes.
62 1074 vcaballero
 *
63 312 fernando
 * @author Vicente Caballero Navarro
64
 */
65
public class FAlignDialog extends JPanel implements SingletonView {
66 1074 vcaballero
        private static final ImageIcon ileft = new ImageIcon(Abrir.class.getClassLoader()
67
                                                                                                                                        .getResource("images/left.PNG"));
68
        private static final ImageIcon icenterV = new ImageIcon(Abrir.class.getClassLoader()
69
                                                                                                                                           .getResource("images/centerV.PNG"));
70
        private static final ImageIcon iright = new ImageIcon(Abrir.class.getClassLoader()
71
                                                                                                                                         .getResource("images/right.PNG"));
72
        private static final ImageIcon iup = new ImageIcon(Abrir.class.getClassLoader()
73
                                                                                                                                  .getResource("images/up.PNG"));
74
        private static final ImageIcon icenterH = new ImageIcon(Abrir.class.getClassLoader()
75
                                                                                                                                           .getResource("images/centerH.PNG"));
76
        private static final ImageIcon idown = new ImageIcon(Abrir.class.getClassLoader()
77
                                                                                                                                        .getResource("images/down.PNG"));
78
        private static final ImageIcon idistUp = new ImageIcon(Abrir.class.getClassLoader()
79
                                                                                                                                          .getResource("images/distUp.PNG"));
80
        private static final ImageIcon idistCenterH = new ImageIcon(Abrir.class.getClassLoader()
81
                                                                                                                                                   .getResource("images/distCenterH.PNG"));
82
        private static final ImageIcon idistDown = new ImageIcon(Abrir.class.getClassLoader()
83
                                                                                                                                                .getResource("images/distDown.PNG"));
84
        private static final ImageIcon idistLeft = new ImageIcon(Abrir.class.getClassLoader()
85
                                                                                                                                                .getResource("images/distLeft.PNG"));
86
        private static final ImageIcon idistCenterV = new ImageIcon(Abrir.class.getClassLoader()
87
                                                                                                                                                   .getResource("images/distCenterV.PNG"));
88
        private static final ImageIcon idistRight = new ImageIcon(Abrir.class.getClassLoader()
89
                                                                                                                                                 .getResource("images/distRight.PNG"));
90
        private static final ImageIcon isizeWidth = new ImageIcon(Abrir.class.getClassLoader()
91
                                                                                                                                                 .getResource("images/sizeWidth.PNG"));
92
        private static final ImageIcon isizeHeight = new ImageIcon(Abrir.class.getClassLoader()
93
                                                                                                                                                  .getResource("images/sizeHeight.PNG"));
94
        private static final ImageIcon isizeOther = new ImageIcon(Abrir.class.getClassLoader()
95
                                                                                                                                                 .getResource("images/sizeOther.PNG"));
96
        private static final ImageIcon ispaceRight = new ImageIcon(Abrir.class.getClassLoader()
97
                                                                                                                                                  .getResource("images/spaceRight.PNG"));
98
        private static final ImageIcon ispaceDown = new ImageIcon(Abrir.class.getClassLoader()
99
                                                                                                                                                 .getResource("images/spaceDown.PNG"));
100
        private static final ImageIcon iinLayout = new ImageIcon(Abrir.class.getClassLoader()
101
                                                                                                                                                .getResource("images/inLayout.PNG"));
102
        private javax.swing.JButton bleft = null;
103
        private javax.swing.JButton bcenterV = null;
104
        private javax.swing.JButton bright = null;
105
        private javax.swing.JButton bup = null;
106
        private javax.swing.JButton bcenterH = null;
107
        private javax.swing.JButton bdown = null;
108
        private javax.swing.JButton bdistUp = null;
109
        private Layout m_layout = null;
110
        private javax.swing.JLabel lAlineamiento = null;
111
        private javax.swing.JLabel lDistribuir = null;
112
        private javax.swing.JButton bdistcenterV = null;
113
        private javax.swing.JButton bdistDown = null;
114
        private javax.swing.JButton bdistLeft = null;
115
        private javax.swing.JButton bdistcenterH = null;
116
        private javax.swing.JButton bdistRight = null;
117 1616 fernando
        private javax.swing.JLabel lTamano = null;
118 1074 vcaballero
        private javax.swing.JButton bsizecenterV = null;
119
        private javax.swing.JButton bsizecenterH = null;
120
        private javax.swing.JButton bsizeother = null;
121
        private javax.swing.JButton bspaceRight = null;
122
        private javax.swing.JButton bspaceDown = null;
123
        private javax.swing.JLabel lEspacio = null;
124
        private javax.swing.JLabel lEnElMapa = null;
125
        private JToggleButton binLayout = null;
126 312 fernando
127 1074 vcaballero
        /**
128
         * This is the default constructor
129
         *
130
         * @param layout Referencia al Layout.
131
         */
132
        public FAlignDialog(Layout layout) {
133
                super();
134
                m_layout = layout;
135
                initialize();
136
        }
137 312 fernando
138 1074 vcaballero
        /**
139
         * This method initializes this
140
         */
141
        private void initialize() {
142
                this.setLayout(null);
143 312 fernando
144 1074 vcaballero
                EventsFAlign listener = new EventsFAlign(m_layout);
145
                this.add(getBleft(), null);
146
                this.add(getBcenterV(), null);
147
                this.add(getBright(), null);
148
                this.add(getBup(), null);
149
                this.add(getBcenterH(), null);
150
                this.add(getBdown(), null);
151
                this.add(getBdistUp(), null);
152
                this.add(getLAlineamiento(), null);
153
                this.add(getLDistribuir(), null);
154
                this.add(getBdistcenterV(), null);
155
                this.add(getBdistDown(), null);
156
                this.add(getBdistLeft(), null);
157
                this.add(getBdistcenterH(), null);
158
                this.add(getBdistRight(), null);
159 1616 fernando
                this.add(getLTamano(), null);
160 1074 vcaballero
                this.add(getBsizecenterV(), null);
161
                this.add(getBsizecenterH(), null);
162
                this.add(getBsizeother(), null);
163
                this.add(getBspaceRight(), null);
164
                this.add(getBspaceDown(), null);
165
                this.add(getLEspacio(), null);
166
                this.add(getLEnElMapa(), null);
167
                this.add(getBinLayout(), null);
168 1312 vcaballero
                this.setSize(310, 190);
169 1074 vcaballero
                getBleft().addActionListener(listener);
170
                getBleft().setActionCommand("LEFT");
171
                getBcenterV().addActionListener(listener);
172
                getBcenterV().setActionCommand("CENTERV");
173
                getBright().addActionListener(listener);
174
                getBright().setActionCommand("RIGHT");
175
                getBup().addActionListener(listener);
176
                getBup().setActionCommand("UP");
177
                getBcenterH().addActionListener(listener);
178
                getBcenterH().setActionCommand("CENTERH");
179
                getBdown().addActionListener(listener);
180
                getBdown().setActionCommand("DOWN");
181
                getBdistUp().addActionListener(listener);
182
                getBdistUp().setActionCommand("DISTUP");
183
                getBdistcenterV().addActionListener(listener);
184
                getBdistcenterV().setActionCommand("DISTCENTERV");
185
                getBdistDown().addActionListener(listener);
186
                getBdistDown().setActionCommand("DISTDOWN");
187
                getBdistLeft().addActionListener(listener);
188
                getBdistLeft().setActionCommand("DISTLEFT");
189
                getBdistcenterH().addActionListener(listener);
190
                getBdistcenterH().setActionCommand("DISTCENTERH");
191
                getBdistRight().addActionListener(listener);
192
                getBdistRight().setActionCommand("DISTRIGHT");
193
                getBsizecenterV().addActionListener(listener);
194
                getBsizecenterV().setActionCommand("SIZECENTERV");
195
                getBsizecenterH().addActionListener(listener);
196
                getBsizecenterH().setActionCommand("SIZECENTERH");
197
                getBsizeother().addActionListener(listener);
198
                getBsizeother().setActionCommand("SIZEOTHER");
199
                getBspaceRight().addActionListener(listener);
200
                getBspaceRight().setActionCommand("SPACERIGHT");
201
                getBspaceDown().addActionListener(listener);
202
                getBspaceDown().setActionCommand("SPACEDOWN");
203
                getBinLayout().addActionListener(listener);
204
                getBinLayout().setActionCommand("INLAYOUT");
205
        }
206 312 fernando
207 1074 vcaballero
        /**
208
         * This method initializes bleft
209
         *
210
         * @return javax.swing.JButton
211
         */
212
        private javax.swing.JButton getBleft() {
213
                if (bleft == null) {
214
                        bleft = new javax.swing.JButton();
215
                        bleft.setSize(24, 24);
216
                        bleft.setIcon(ileft);
217
                        bleft.setLocation(10, 30);
218
                        bleft.setPreferredSize(new java.awt.Dimension(30, 30));
219
                }
220 312 fernando
221 1074 vcaballero
                return bleft;
222
        }
223 312 fernando
224 1074 vcaballero
        /**
225
         * This method initializes bcenterV
226
         *
227
         * @return javax.swing.JButton
228
         */
229
        private javax.swing.JButton getBcenterV() {
230
                if (bcenterV == null) {
231
                        bcenterV = new javax.swing.JButton();
232
                        bcenterV.setSize(24, 24);
233
                        bcenterV.setIcon(icenterV);
234
                        bcenterV.setLocation(35, 30);
235
                        bcenterV.setPreferredSize(new java.awt.Dimension(39, 20));
236
                }
237 312 fernando
238 1074 vcaballero
                return bcenterV;
239
        }
240 312 fernando
241 1074 vcaballero
        /**
242
         * This method initializes bright
243
         *
244
         * @return javax.swing.JButton
245
         */
246
        private javax.swing.JButton getBright() {
247
                if (bright == null) {
248
                        bright = new javax.swing.JButton();
249
                        bright.setSize(24, 24);
250
                        bright.setIcon(iright);
251
                        bright.setLocation(60, 30);
252
                }
253 312 fernando
254 1074 vcaballero
                return bright;
255
        }
256 312 fernando
257 1074 vcaballero
        /**
258
         * This method initializes bup
259
         *
260
         * @return javax.swing.JButton
261
         */
262
        private javax.swing.JButton getBup() {
263
                if (bup == null) {
264
                        bup = new javax.swing.JButton();
265
                        bup.setSize(24, 24);
266
                        bup.setIcon(iup);
267
                        bup.setLocation(100, 30);
268
                }
269 312 fernando
270 1074 vcaballero
                return bup;
271
        }
272 312 fernando
273 1074 vcaballero
        /**
274
         * This method initializes bcenterH
275
         *
276
         * @return javax.swing.JButton
277
         */
278
        private javax.swing.JButton getBcenterH() {
279
                if (bcenterH == null) {
280
                        bcenterH = new javax.swing.JButton();
281
                        bcenterH.setSize(24, 24);
282
                        bcenterH.setIcon(icenterH);
283
                        bcenterH.setLocation(125, 30);
284
                }
285 312 fernando
286 1074 vcaballero
                return bcenterH;
287
        }
288 312 fernando
289 1074 vcaballero
        /**
290
         * This method initializes bdown
291
         *
292
         * @return javax.swing.JButton
293
         */
294
        private javax.swing.JButton getBdown() {
295
                if (bdown == null) {
296
                        bdown = new javax.swing.JButton();
297
                        bdown.setSize(24, 24);
298
                        bdown.setIcon(idown);
299
                        bdown.setLocation(150, 30);
300
                }
301 312 fernando
302 1074 vcaballero
                return bdown;
303
        }
304 312 fernando
305 1074 vcaballero
        /**
306
         * This method initializes bdistUp
307
         *
308
         * @return javax.swing.JButton
309
         */
310
        private javax.swing.JButton getBdistUp() {
311
                if (bdistUp == null) {
312
                        bdistUp = new javax.swing.JButton();
313
                        bdistUp.setSize(24, 24);
314
                        bdistUp.setIcon(idistUp);
315
                        bdistUp.setLocation(100, 73);
316
                }
317 312 fernando
318 1074 vcaballero
                return bdistUp;
319
        }
320 312 fernando
321 1074 vcaballero
        /**
322
         * This method initializes lAlineamiento
323
         *
324
         * @return javax.swing.JLabel
325
         */
326
        private javax.swing.JLabel getLAlineamiento() {
327
                if (lAlineamiento == null) {
328
                        lAlineamiento = new javax.swing.JLabel();
329
                        lAlineamiento.setSize(107, 13);
330
                        lAlineamiento.setText(PluginServices.getText(this, "alineamiento"));
331
                        lAlineamiento.setLocation(10, 10);
332
                }
333 312 fernando
334 1074 vcaballero
                return lAlineamiento;
335
        }
336 312 fernando
337 1074 vcaballero
        /**
338
         * This method initializes lDistribuir
339
         *
340
         * @return javax.swing.JLabel
341
         */
342
        private javax.swing.JLabel getLDistribuir() {
343
                if (lDistribuir == null) {
344
                        lDistribuir = new javax.swing.JLabel();
345
                        lDistribuir.setBounds(10, 57, 107, 13);
346
                        lDistribuir.setText(PluginServices.getText(this, "distribuir"));
347
                }
348 312 fernando
349 1074 vcaballero
                return lDistribuir;
350
        }
351 312 fernando
352 1074 vcaballero
        /**
353
         * This method initializes bdistcenterV
354
         *
355
         * @return javax.swing.JButton
356
         */
357
        private javax.swing.JButton getBdistcenterV() {
358
                if (bdistcenterV == null) {
359
                        bdistcenterV = new javax.swing.JButton();
360
                        bdistcenterV.setSize(24, 24);
361
                        bdistcenterV.setIcon(idistCenterH);
362
                        bdistcenterV.setLocation(125, 73);
363
                }
364 312 fernando
365 1074 vcaballero
                return bdistcenterV;
366
        }
367 312 fernando
368 1074 vcaballero
        /**
369
         * This method initializes bdistDown
370
         *
371
         * @return javax.swing.JButton
372
         */
373
        private javax.swing.JButton getBdistDown() {
374
                if (bdistDown == null) {
375
                        bdistDown = new javax.swing.JButton();
376
                        bdistDown.setSize(24, 24);
377
                        bdistDown.setIcon(idistDown);
378
                        bdistDown.setLocation(150, 73);
379
                }
380 312 fernando
381 1074 vcaballero
                return bdistDown;
382
        }
383 312 fernando
384 1074 vcaballero
        /**
385
         * This method initializes bdistLeft
386
         *
387
         * @return javax.swing.JButton
388
         */
389
        private javax.swing.JButton getBdistLeft() {
390
                if (bdistLeft == null) {
391
                        bdistLeft = new javax.swing.JButton();
392
                        bdistLeft.setSize(24, 24);
393
                        bdistLeft.setIcon(idistLeft);
394
                        bdistLeft.setLocation(10, 73);
395
                }
396 312 fernando
397 1074 vcaballero
                return bdistLeft;
398
        }
399 312 fernando
400 1074 vcaballero
        /**
401
         * This method initializes bdistcenterH
402
         *
403
         * @return javax.swing.JButton
404
         */
405
        private javax.swing.JButton getBdistcenterH() {
406
                if (bdistcenterH == null) {
407
                        bdistcenterH = new javax.swing.JButton();
408
                        bdistcenterH.setSize(24, 24);
409
                        bdistcenterH.setIcon(idistCenterV);
410
                        bdistcenterH.setLocation(35, 73);
411
                }
412 312 fernando
413 1074 vcaballero
                return bdistcenterH;
414
        }
415 312 fernando
416 1074 vcaballero
        /**
417
         * This method initializes bdistRight
418
         *
419
         * @return javax.swing.JButton
420
         */
421
        private javax.swing.JButton getBdistRight() {
422
                if (bdistRight == null) {
423
                        bdistRight = new javax.swing.JButton();
424
                        bdistRight.setIcon(idistRight);
425
                        bdistRight.setBounds(60, 73, 24, 24);
426
                }
427 312 fernando
428 1074 vcaballero
                return bdistRight;
429
        }
430 312 fernando
431 1074 vcaballero
        /**
432 1616 fernando
         * This method initializes lTamano
433 1074 vcaballero
         *
434
         * @return javax.swing.JLabel
435
         */
436 1616 fernando
        private javax.swing.JLabel getLTamano() {
437
                if (lTamano == null) {
438
                        lTamano = new javax.swing.JLabel();
439
                        lTamano.setBounds(10, 101, 107, 13);
440 1656 vcaballero
                        lTamano.setText(PluginServices.getText(this, "coincidir_tama?o"));
441 1074 vcaballero
                }
442 312 fernando
443 1616 fernando
                return lTamano;
444 1074 vcaballero
        }
445 312 fernando
446 1074 vcaballero
        /**
447
         * This method initializes bsizecenterV
448
         *
449
         * @return javax.swing.JButton
450
         */
451
        private javax.swing.JButton getBsizecenterV() {
452
                if (bsizecenterV == null) {
453
                        bsizecenterV = new javax.swing.JButton();
454
                        bsizecenterV.setIcon(isizeWidth);
455
                        bsizecenterV.setBounds(10, 115, 24, 24);
456
                }
457 312 fernando
458 1074 vcaballero
                return bsizecenterV;
459
        }
460 312 fernando
461 1074 vcaballero
        /**
462
         * This method initializes bsizecenterH
463
         *
464
         * @return javax.swing.JButton
465
         */
466
        private javax.swing.JButton getBsizecenterH() {
467
                if (bsizecenterH == null) {
468
                        bsizecenterH = new javax.swing.JButton();
469
                        bsizecenterH.setIcon(isizeHeight);
470
                        bsizecenterH.setBounds(35, 115, 24, 24);
471
                }
472 312 fernando
473 1074 vcaballero
                return bsizecenterH;
474
        }
475 312 fernando
476 1074 vcaballero
        /**
477
         * This method initializes bsizeother
478
         *
479
         * @return javax.swing.JButton
480
         */
481
        private javax.swing.JButton getBsizeother() {
482
                if (bsizeother == null) {
483
                        bsizeother = new javax.swing.JButton();
484
                        bsizeother.setIcon(isizeOther);
485
                        bsizeother.setBounds(60, 115, 24, 24);
486
                }
487 312 fernando
488 1074 vcaballero
                return bsizeother;
489
        }
490 312 fernando
491 1074 vcaballero
        /**
492
         * This method initializes bspaceRight
493
         *
494
         * @return javax.swing.JButton
495
         */
496
        private javax.swing.JButton getBspaceRight() {
497
                if (bspaceRight == null) {
498
                        bspaceRight = new javax.swing.JButton();
499
                        bspaceRight.setIcon(ispaceRight);
500
                        bspaceRight.setBounds(125, 115, 24, 24);
501
                }
502 312 fernando
503 1074 vcaballero
                return bspaceRight;
504
        }
505 312 fernando
506 1074 vcaballero
        /**
507
         * This method initializes bspaceDown
508
         *
509
         * @return javax.swing.JButton
510
         */
511
        private javax.swing.JButton getBspaceDown() {
512
                if (bspaceDown == null) {
513
                        bspaceDown = new javax.swing.JButton();
514
                        bspaceDown.setIcon(ispaceDown);
515
                        bspaceDown.setBounds(150, 115, 24, 24);
516
                }
517 312 fernando
518 1074 vcaballero
                return bspaceDown;
519
        }
520 312 fernando
521 1074 vcaballero
        /**
522
         * This method initializes lEspacio
523
         *
524
         * @return javax.swing.JLabel
525
         */
526
        private javax.swing.JLabel getLEspacio() {
527
                if (lEspacio == null) {
528
                        lEspacio = new javax.swing.JLabel();
529
                        lEspacio.setBounds(125, 100, 57, 15);
530
                        lEspacio.setText(PluginServices.getText(this, "espacio"));
531
                }
532 312 fernando
533 1074 vcaballero
                return lEspacio;
534
        }
535 312 fernando
536 1074 vcaballero
        /**
537
         * This method initializes lEnElMapa
538
         *
539
         * @return javax.swing.JLabel
540
         */
541
        private javax.swing.JLabel getLEnElMapa() {
542
                if (lEnElMapa == null) {
543
                        lEnElMapa = new javax.swing.JLabel();
544
                        lEnElMapa.setBounds(187, 33, 77, 17);
545
                        lEnElMapa.setText(PluginServices.getText(this, "en_el_mapa"));
546
                }
547 312 fernando
548 1074 vcaballero
                return lEnElMapa;
549
        }
550 312 fernando
551 1074 vcaballero
        /**
552
         * This method initializes binLayout
553
         *
554
         * @return javax.swing.JButton
555
         */
556
        private JToggleButton getBinLayout() {
557
                if (binLayout == null) {
558
                        binLayout = new JToggleButton();
559
                        binLayout.setIcon(iinLayout);
560
                        binLayout.setBounds(199, 58, 51, 41);
561
                }
562 312 fernando
563 1074 vcaballero
                return binLayout;
564
        }
565
566
        /**
567 312 fernando
         * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
568
         */
569
        public Object getViewModel() {
570
                return "AlignDialog";
571
        }
572
573
        /**
574
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
575
         */
576
        public ViewInfo getViewInfo() {
577 1074 vcaballero
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODELESSDIALOG);
578
                m_viewinfo.setTitle(PluginServices.getText(this, "alinear"));
579
580
                return m_viewinfo;
581 312 fernando
        }
582
583
        /**
584
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
585
         */
586
        public void viewActivated() {
587
        }
588 1312 vcaballero
}  //  @jve:decl-index=0:visual-constraint="10,10"