Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / FAlignDialog.java @ 5503

History | View | Annotate | Download (16 KB)

1
/*
2
 * Created on 19-jul-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
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
 *   Av. Blasco Ib??ez, 50
28
 *   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
package com.iver.cit.gvsig.gui.layout.dialogs;
46

    
47
import com.iver.andami.PluginServices;
48
import com.iver.andami.ui.mdiManager.SingletonView;
49
import com.iver.andami.ui.mdiManager.ViewInfo;
50

    
51
import com.iver.cit.gvsig.AddLayer;
52
import com.iver.cit.gvsig.gui.layout.Layout;
53

    
54
import javax.swing.ImageIcon;
55
import javax.swing.JPanel;
56
import javax.swing.JToggleButton;
57

    
58

    
59
/**
60
 * Contenedor de los botones necesarios para alinear, desplazar y cambiar el
61
 * tama?o de los fframes.
62
 *
63
 * @author Vicente Caballero Navarro
64
 */
65
public class FAlignDialog extends JPanel implements SingletonView {
66
        private static final ImageIcon ileft = new ImageIcon(AddLayer.class.getClassLoader()
67
                                                                                                                                        .getResource("images/left.PNG"));
68
        private static final ImageIcon icenterV = new ImageIcon(AddLayer.class.getClassLoader()
69
                                                                                                                                           .getResource("images/centerV.PNG"));
70
        private static final ImageIcon iright = new ImageIcon(AddLayer.class.getClassLoader()
71
                                                                                                                                         .getResource("images/right.PNG"));
72
        private static final ImageIcon iup = new ImageIcon(AddLayer.class.getClassLoader()
73
                                                                                                                                  .getResource("images/up.PNG"));
74
        private static final ImageIcon icenterH = new ImageIcon(AddLayer.class.getClassLoader()
75
                                                                                                                                           .getResource("images/centerH.PNG"));
76
        private static final ImageIcon idown = new ImageIcon(AddLayer.class.getClassLoader()
77
                                                                                                                                        .getResource("images/down.PNG"));
78
        private static final ImageIcon idistUp = new ImageIcon(AddLayer.class.getClassLoader()
79
                                                                                                                                          .getResource("images/distUp.PNG"));
80
        private static final ImageIcon idistCenterH = new ImageIcon(AddLayer.class.getClassLoader()
81
                                                                                                                                                   .getResource("images/distCenterH.PNG"));
82
        private static final ImageIcon idistDown = new ImageIcon(AddLayer.class.getClassLoader()
83
                                                                                                                                                .getResource("images/distDown.PNG"));
84
        private static final ImageIcon idistLeft = new ImageIcon(AddLayer.class.getClassLoader()
85
                                                                                                                                                .getResource("images/distLeft.PNG"));
86
        private static final ImageIcon idistCenterV = new ImageIcon(AddLayer.class.getClassLoader()
87
                                                                                                                                                   .getResource("images/distCenterV.PNG"));
88
        private static final ImageIcon idistRight = new ImageIcon(AddLayer.class.getClassLoader()
89
                                                                                                                                                 .getResource("images/distRight.PNG"));
90
        private static final ImageIcon isizeWidth = new ImageIcon(AddLayer.class.getClassLoader()
91
                                                                                                                                                 .getResource("images/sizeWidth.PNG"));
92
        private static final ImageIcon isizeHeight = new ImageIcon(AddLayer.class.getClassLoader()
93
                                                                                                                                                  .getResource("images/sizeHeight.PNG"));
94
        private static final ImageIcon isizeOther = new ImageIcon(AddLayer.class.getClassLoader()
95
                                                                                                                                                 .getResource("images/sizeOther.PNG"));
96
        private static final ImageIcon ispaceRight = new ImageIcon(AddLayer.class.getClassLoader()
97
                                                                                                                                                  .getResource("images/spaceRight.PNG"));
98
        private static final ImageIcon ispaceDown = new ImageIcon(AddLayer.class.getClassLoader()
99
                                                                                                                                                 .getResource("images/spaceDown.PNG"));
100
        private static final ImageIcon iinLayout = new ImageIcon(AddLayer.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
        private javax.swing.JLabel lTamano = null;
118
        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

    
127
        /**
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

    
138
        /**
139
         * This method initializes this
140
         */
141
        private void initialize() {
142
                this.setLayout(null);
143

    
144
                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
                this.add(getLTamano(), null);
160
                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
                this.setSize(310, 190);
169
                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

    
207
        /**
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

    
221
                return bleft;
222
        }
223

    
224
        /**
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

    
238
                return bcenterV;
239
        }
240

    
241
        /**
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

    
254
                return bright;
255
        }
256

    
257
        /**
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

    
270
                return bup;
271
        }
272

    
273
        /**
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

    
286
                return bcenterH;
287
        }
288

    
289
        /**
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

    
302
                return bdown;
303
        }
304

    
305
        /**
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

    
318
                return bdistUp;
319
        }
320

    
321
        /**
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

    
334
                return lAlineamiento;
335
        }
336

    
337
        /**
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

    
349
                return lDistribuir;
350
        }
351

    
352
        /**
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

    
365
                return bdistcenterV;
366
        }
367

    
368
        /**
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

    
381
                return bdistDown;
382
        }
383

    
384
        /**
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

    
397
                return bdistLeft;
398
        }
399

    
400
        /**
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

    
413
                return bdistcenterH;
414
        }
415

    
416
        /**
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

    
428
                return bdistRight;
429
        }
430

    
431
        /**
432
         * This method initializes lTamano
433
         *
434
         * @return javax.swing.JLabel
435
         */
436
        private javax.swing.JLabel getLTamano() {
437
                if (lTamano == null) {
438
                        lTamano = new javax.swing.JLabel();
439
                        lTamano.setBounds(10, 101, 107, 13);
440
                        lTamano.setText(PluginServices.getText(this, "coincidir_tamanyo"));
441
                }
442

    
443
                return lTamano;
444
        }
445

    
446
        /**
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

    
458
                return bsizecenterV;
459
        }
460

    
461
        /**
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

    
473
                return bsizecenterH;
474
        }
475

    
476
        /**
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

    
488
                return bsizeother;
489
        }
490

    
491
        /**
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

    
503
                return bspaceRight;
504
        }
505

    
506
        /**
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

    
518
                return bspaceDown;
519
        }
520

    
521
        /**
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

    
533
                return lEspacio;
534
        }
535

    
536
        /**
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

    
548
                return lEnElMapa;
549
        }
550

    
551
        /**
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

    
563
                return binLayout;
564
        }
565

    
566
        /**
567
         * @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
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODELESSDIALOG);
578
                m_viewinfo.setTitle(PluginServices.getText(this, "alinear"));
579

    
580
                return m_viewinfo;
581
        }
582

    
583
        /**
584
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
585
         */
586
        public void viewActivated() {
587
        }
588
}  //  @jve:decl-index=0:visual-constraint="10,10"