Statistics
| Revision:

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

History | View | Annotate | Download (17.7 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.project.documents.layout.gui.dialogs;
46

    
47
import javax.swing.ImageIcon;
48
import javax.swing.JPanel;
49
import javax.swing.JToggleButton;
50

    
51
import com.iver.andami.PluginServices;
52
import com.iver.andami.ui.mdiManager.SingletonWindow;
53
import com.iver.andami.ui.mdiManager.WindowInfo;
54
import com.iver.cit.gvsig.AddLayer;
55
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
56

    
57

    
58
/**
59
 * Contenedor de los botones necesarios para alinear, desplazar y cambiar el
60
 * tama�o de los fframes.
61
 *
62
 * @author Vicente Caballero Navarro
63
 */
64
public class FAlignDialog extends JPanel implements SingletonWindow {
65
        private static final ImageIcon ileft = PluginServices.getIconTheme()
66
                .get("text-left-icon");
67
        private static final ImageIcon icenterV = PluginServices.getIconTheme()
68
                .get("text-center-v-icon");
69

    
70
        private static final ImageIcon iright = PluginServices.getIconTheme()
71
                .get("text-right-icon");
72
        private static final ImageIcon iup = PluginServices.getIconTheme()
73
                .get("text-up-icon");
74
        private static final ImageIcon icenterH= PluginServices.getIconTheme()
75
                .get("text-center-h-icon");
76
        private static final ImageIcon idown = PluginServices.getIconTheme()
77
                .get("text-down-icon");
78
        private static final ImageIcon idistUp = PluginServices.getIconTheme()
79
                .get("text-distup-icon");
80
        private static final ImageIcon idistCenterH = PluginServices.getIconTheme()
81
                .get("text-distcenterh-icon");
82
        private static final ImageIcon idistDown = PluginServices.getIconTheme()
83
                .get("text-distdown-icon");
84
        private static final ImageIcon idistLeft = PluginServices.getIconTheme()
85
                .get("text-distleft-icon");
86
        private static final ImageIcon idistCenterV = PluginServices.getIconTheme()
87
                .get("text-distcenterv-icon");
88
        private static final ImageIcon idistRight = PluginServices.getIconTheme()
89
                .get("text-distright-icon");
90
        private static final ImageIcon isizeWidth = PluginServices.getIconTheme()
91
                .get("text-size-width-icon");
92
        private static final ImageIcon isizeHeight = PluginServices.getIconTheme()
93
                .get("text-size-height-icon");
94
        private static final ImageIcon isizeOther = PluginServices.getIconTheme()
95
                .get("text-size-other-icon");
96
        private static final ImageIcon ispaceRight = PluginServices.getIconTheme()
97
                .get("text-space-right-icon");
98
        private static final ImageIcon ispaceDown =PluginServices.getIconTheme()
99
                .get("text-space-down-icon");
100
        private static final ImageIcon iinLayout = PluginServices.getIconTheme()
101
                .get("text-inlayout-icon");
102

    
103
        private javax.swing.JButton bleft = null;
104
        private javax.swing.JButton bcenterV = null;
105
        private javax.swing.JButton bright = null;
106
        private javax.swing.JButton bup = null;
107
        private javax.swing.JButton bcenterH = null;
108
        private javax.swing.JButton bdown = null;
109
        private javax.swing.JButton bdistUp = null;
110
        private Layout m_layout = null;
111
        private javax.swing.JLabel lAlineamiento = null;
112
        private javax.swing.JLabel lDistribuir = null;
113
        private javax.swing.JButton bdistcenterV = null;
114
        private javax.swing.JButton bdistDown = null;
115
        private javax.swing.JButton bdistLeft = null;
116
        private javax.swing.JButton bdistcenterH = null;
117
        private javax.swing.JButton bdistRight = null;
118
        private javax.swing.JLabel lTamano = null;
119
        private javax.swing.JButton bsizecenterV = null;
120
        private javax.swing.JButton bsizecenterH = null;
121
        private javax.swing.JButton bsizeother = null;
122
        private javax.swing.JButton bspaceRight = null;
123
        private javax.swing.JButton bspaceDown = null;
124
        private javax.swing.JLabel lEspacio = null;
125
        private javax.swing.JLabel lEnElMapa = null;
126
        private JToggleButton binLayout = null;
127

    
128
        /**
129
         * This is the default constructor
130
         *
131
         * @param layout Referencia al Layout.
132
         */
133
        public FAlignDialog(Layout layout) {
134
                super();
135
                m_layout = layout;
136
                initialize();
137
        }
138

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

    
145
                EventsFAlign listener = new EventsFAlign(m_layout);
146
                this.add(getBleft(), null);
147
                this.add(getBcenterV(), null);
148
                this.add(getBright(), null);
149
                this.add(getBup(), null);
150
                this.add(getBcenterH(), null);
151
                this.add(getBdown(), null);
152
                this.add(getBdistUp(), null);
153
                this.add(getLAlineamiento(), null);
154
                this.add(getLDistribuir(), null);
155
                this.add(getBdistcenterV(), null);
156
                this.add(getBdistDown(), null);
157
                this.add(getBdistLeft(), null);
158
                this.add(getBdistcenterH(), null);
159
                this.add(getBdistRight(), null);
160
                this.add(getLTamano(), null);
161
                this.add(getBsizecenterV(), null);
162
                this.add(getBsizecenterH(), null);
163
                this.add(getBsizeother(), null);
164
                this.add(getBspaceRight(), null);
165
                this.add(getBspaceDown(), null);
166
                this.add(getLEspacio(), null);
167
                this.add(getLEnElMapa(), null);
168
                this.add(getBinLayout(), null);
169
                this.setSize(310, 190);
170
                getBleft().addActionListener(listener);
171
                getBleft().setActionCommand("LEFT");
172
                getBcenterV().addActionListener(listener);
173
                getBcenterV().setActionCommand("CENTERV");
174
                getBright().addActionListener(listener);
175
                getBright().setActionCommand("RIGHT");
176
                getBup().addActionListener(listener);
177
                getBup().setActionCommand("UP");
178
                getBcenterH().addActionListener(listener);
179
                getBcenterH().setActionCommand("CENTERH");
180
                getBdown().addActionListener(listener);
181
                getBdown().setActionCommand("DOWN");
182
                getBdistUp().addActionListener(listener);
183
                getBdistUp().setActionCommand("DISTUP");
184
                getBdistcenterV().addActionListener(listener);
185
                getBdistcenterV().setActionCommand("DISTCENTERV");
186
                getBdistDown().addActionListener(listener);
187
                getBdistDown().setActionCommand("DISTDOWN");
188
                getBdistLeft().addActionListener(listener);
189
                getBdistLeft().setActionCommand("DISTLEFT");
190
                getBdistcenterH().addActionListener(listener);
191
                getBdistcenterH().setActionCommand("DISTCENTERH");
192
                getBdistRight().addActionListener(listener);
193
                getBdistRight().setActionCommand("DISTRIGHT");
194
                getBsizecenterV().addActionListener(listener);
195
                getBsizecenterV().setActionCommand("SIZECENTERV");
196
                getBsizecenterH().addActionListener(listener);
197
                getBsizecenterH().setActionCommand("SIZECENTERH");
198
                getBsizeother().addActionListener(listener);
199
                getBsizeother().setActionCommand("SIZEOTHER");
200
                getBspaceRight().addActionListener(listener);
201
                getBspaceRight().setActionCommand("SPACERIGHT");
202
                getBspaceDown().addActionListener(listener);
203
                getBspaceDown().setActionCommand("SPACEDOWN");
204
                getBinLayout().addActionListener(listener);
205
                getBinLayout().setActionCommand("INLAYOUT");
206
        }
207

    
208
        /**
209
         * This method initializes bleft
210
         *
211
         * @return javax.swing.JButton
212
         */
213
        private javax.swing.JButton getBleft() {
214
                if (bleft == null) {
215
                        bleft = new javax.swing.JButton();
216
                        bleft.setSize(24, 24);
217
                        bleft.setIcon(ileft);
218
                        bleft.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_a_la_izquierda"));
219
                        bleft.setLocation(10, 30);
220
                        bleft.setPreferredSize(new java.awt.Dimension(30, 30));
221
                }
222

    
223
                return bleft;
224
        }
225

    
226
        /**
227
         * This method initializes bcenterV
228
         *
229
         * @return javax.swing.JButton
230
         */
231
        private javax.swing.JButton getBcenterV() {
232
                if (bcenterV == null) {
233
                        bcenterV = new javax.swing.JButton();
234
                        bcenterV.setSize(24, 24);
235
                        bcenterV.setIcon(icenterV);
236
                        bcenterV.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_al_centro_por_el_eje_x"));
237
                        bcenterV.setLocation(35, 30);
238
                        bcenterV.setPreferredSize(new java.awt.Dimension(39, 20));
239
                }
240

    
241
                return bcenterV;
242
        }
243

    
244
        /**
245
         * This method initializes bright
246
         *
247
         * @return javax.swing.JButton
248
         */
249
        private javax.swing.JButton getBright() {
250
                if (bright == null) {
251
                        bright = new javax.swing.JButton();
252
                        bright.setSize(24, 24);
253
                        bright.setIcon(iright);
254
                        bright.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_a_la_derecha"));
255
                        bright.setLocation(60, 30);
256
                }
257

    
258
                return bright;
259
        }
260

    
261
        /**
262
         * This method initializes bup
263
         *
264
         * @return javax.swing.JButton
265
         */
266
        private javax.swing.JButton getBup() {
267
                if (bup == null) {
268
                        bup = new javax.swing.JButton();
269
                        bup.setSize(24, 24);
270
                        bup.setIcon(iup);
271
                        bup.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_hacia_arriba"));
272
                        bup.setLocation(100, 30);
273
                }
274

    
275
                return bup;
276
        }
277

    
278
        /**
279
         * This method initializes bcenterH
280
         *
281
         * @return javax.swing.JButton
282
         */
283
        private javax.swing.JButton getBcenterH() {
284
                if (bcenterH == null) {
285
                        bcenterH = new javax.swing.JButton();
286
                        bcenterH.setSize(24, 24);
287
                        bcenterH.setIcon(icenterH);
288
                        bcenterH.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_al_centro_por_el_eje_y"));
289
                        bcenterH.setLocation(125, 30);
290
                }
291

    
292
                return bcenterH;
293
        }
294

    
295
        /**
296
         * This method initializes bdown
297
         *
298
         * @return javax.swing.JButton
299
         */
300
        private javax.swing.JButton getBdown() {
301
                if (bdown == null) {
302
                        bdown = new javax.swing.JButton();
303
                        bdown.setSize(24, 24);
304
                        bdown.setIcon(idown);
305
                        bdown.setToolTipText(PluginServices.getText(this,"desplaza_los_elementos_seleccionados_hacia_abajo"));
306
                        bdown.setLocation(150, 30);
307
                }
308

    
309
                return bdown;
310
        }
311

    
312
        /**
313
         * This method initializes bdistUp
314
         *
315
         * @return javax.swing.JButton
316
         */
317
        private javax.swing.JButton getBdistUp() {
318
                if (bdistUp == null) {
319
                        bdistUp = new javax.swing.JButton();
320
                        bdistUp.setSize(24, 24);
321
                        bdistUp.setIcon(idistUp);
322
                        bdistUp.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_de_arriba_hacia_abajo"));
323
                        bdistUp.setLocation(100, 73);
324
                }
325

    
326
                return bdistUp;
327
        }
328

    
329
        /**
330
         * This method initializes lAlineamiento
331
         *
332
         * @return javax.swing.JLabel
333
         */
334
        private javax.swing.JLabel getLAlineamiento() {
335
                if (lAlineamiento == null) {
336
                        lAlineamiento = new javax.swing.JLabel();
337
                        lAlineamiento.setSize(107, 13);
338
                        lAlineamiento.setText(PluginServices.getText(this, "alineamiento"));
339
                        lAlineamiento.setLocation(10, 10);
340
                }
341

    
342
                return lAlineamiento;
343
        }
344

    
345
        /**
346
         * This method initializes lDistribuir
347
         *
348
         * @return javax.swing.JLabel
349
         */
350
        private javax.swing.JLabel getLDistribuir() {
351
                if (lDistribuir == null) {
352
                        lDistribuir = new javax.swing.JLabel();
353
                        lDistribuir.setBounds(10, 57, 107, 13);
354
                        lDistribuir.setText(PluginServices.getText(this, "distribuir"));
355
                }
356

    
357
                return lDistribuir;
358
        }
359

    
360
        /**
361
         * This method initializes bdistcenterV
362
         *
363
         * @return javax.swing.JButton
364
         */
365
        private javax.swing.JButton getBdistcenterV() {
366
                if (bdistcenterV == null) {
367
                        bdistcenterV = new javax.swing.JButton();
368
                        bdistcenterV.setSize(24, 24);
369
                        bdistcenterV.setIcon(idistCenterH);
370
                        bdistcenterV.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_y_vertical"));
371
                        bdistcenterV.setLocation(125, 73);
372
                }
373

    
374
                return bdistcenterV;
375
        }
376

    
377
        /**
378
         * This method initializes bdistDown
379
         *
380
         * @return javax.swing.JButton
381
         */
382
        private javax.swing.JButton getBdistDown() {
383
                if (bdistDown == null) {
384
                        bdistDown = new javax.swing.JButton();
385
                        bdistDown.setSize(24, 24);
386
                        bdistDown.setIcon(idistDown);
387
                        bdistDown.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_de_abajo_hacia_arriba"));
388
                        bdistDown.setLocation(150, 73);
389
                }
390

    
391
                return bdistDown;
392
        }
393

    
394
        /**
395
         * This method initializes bdistLeft
396
         *
397
         * @return javax.swing.JButton
398
         */
399
        private javax.swing.JButton getBdistLeft() {
400
                if (bdistLeft == null) {
401
                        bdistLeft = new javax.swing.JButton();
402
                        bdistLeft.setSize(24, 24);
403
                        bdistLeft.setIcon(idistLeft);
404
                        bdistLeft.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_de_izquierda_a_derecha"));
405
                        bdistLeft.setLocation(10, 73);
406
                }
407

    
408
                return bdistLeft;
409
        }
410

    
411
        /**
412
         * This method initializes bdistcenterH
413
         *
414
         * @return javax.swing.JButton
415
         */
416
        private javax.swing.JButton getBdistcenterH() {
417
                if (bdistcenterH == null) {
418
                        bdistcenterH = new javax.swing.JButton();
419
                        bdistcenterH.setSize(24, 24);
420
                        bdistcenterH.setIcon(idistCenterV);
421
                        bdistcenterH.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_y_horizontal"));
422
                        bdistcenterH.setLocation(35, 73);
423
                }
424

    
425
                return bdistcenterH;
426
        }
427

    
428
        /**
429
         * This method initializes bdistRight
430
         *
431
         * @return javax.swing.JButton
432
         */
433
        private javax.swing.JButton getBdistRight() {
434
                if (bdistRight == null) {
435
                        bdistRight = new javax.swing.JButton();
436
                        bdistRight.setIcon(idistRight);
437
                        bdistRight.setToolTipText(PluginServices.getText(this,"distribuye_los_elementos_seleccionados_de_forma_equidistante_de_derecha_a_izquierda"));
438
                        bdistRight.setBounds(60, 73, 24, 24);
439
                }
440

    
441
                return bdistRight;
442
        }
443

    
444
        /**
445
         * This method initializes lTamano
446
         *
447
         * @return javax.swing.JLabel
448
         */
449
        private javax.swing.JLabel getLTamano() {
450
                if (lTamano == null) {
451
                        lTamano = new javax.swing.JLabel();
452
                        lTamano.setBounds(10, 101, 107, 13);
453
                        lTamano.setText(PluginServices.getText(this, "coincidir_tamanyo"));
454
                }
455

    
456
                return lTamano;
457
        }
458

    
459
        /**
460
         * This method initializes bsizecenterV
461
         *
462
         * @return javax.swing.JButton
463
         */
464
        private javax.swing.JButton getBsizecenterV() {
465
                if (bsizecenterV == null) {
466
                        bsizecenterV = new javax.swing.JButton();
467
                        bsizecenterV.setIcon(isizeWidth);
468
                        bsizecenterV.setToolTipText(PluginServices.getText(this,"cambiar_el_ancho_de_los_elementos_seleccionados_hasta_coincidir_con_el_mas_ancho"));
469
                        bsizecenterV.setBounds(10, 115, 24, 24);
470
                }
471

    
472
                return bsizecenterV;
473
        }
474

    
475
        /**
476
         * This method initializes bsizecenterH
477
         *
478
         * @return javax.swing.JButton
479
         */
480
        private javax.swing.JButton getBsizecenterH() {
481
                if (bsizecenterH == null) {
482
                        bsizecenterH = new javax.swing.JButton();
483
                        bsizecenterH.setIcon(isizeHeight);
484
                        bsizecenterH.setToolTipText(PluginServices.getText(this,"cambiar_el_alto_de_los_elementos_seleccionados_hasta_coincidir_con_el_mas_alto"));
485
                        bsizecenterH.setBounds(35, 115, 24, 24);
486
                }
487

    
488
                return bsizecenterH;
489
        }
490

    
491
        /**
492
         * This method initializes bsizeother
493
         *
494
         * @return javax.swing.JButton
495
         */
496
        private javax.swing.JButton getBsizeother() {
497
                if (bsizeother == null) {
498
                        bsizeother = new javax.swing.JButton();
499
                        bsizeother.setIcon(isizeOther);
500
                        bsizeother.setToolTipText(PluginServices.getText(this,"cambiar_el_tamano_de_los_elementos_seleccionados_hasta_coincidir_con_el_mas_grande"));
501
                        bsizeother.setBounds(60, 115, 24, 24);
502
                }
503

    
504
                return bsizeother;
505
        }
506

    
507
        /**
508
         * This method initializes bspaceRight
509
         *
510
         * @return javax.swing.JButton
511
         */
512
        private javax.swing.JButton getBspaceRight() {
513
                if (bspaceRight == null) {
514
                        bspaceRight = new javax.swing.JButton();
515
                        bspaceRight.setIcon(ispaceRight);
516
                        bspaceRight.setToolTipText(PluginServices.getText(this,"distribuye_el_espacio_entre_los_elementos_en_horizontal"));
517
                        bspaceRight.setBounds(125, 115, 24, 24);
518
                }
519

    
520
                return bspaceRight;
521
        }
522

    
523
        /**
524
         * This method initializes bspaceDown
525
         *
526
         * @return javax.swing.JButton
527
         */
528
        private javax.swing.JButton getBspaceDown() {
529
                if (bspaceDown == null) {
530
                        bspaceDown = new javax.swing.JButton();
531
                        bspaceDown.setIcon(ispaceDown);
532
                        bspaceDown.setToolTipText(PluginServices.getText(this,"distribuye_el_espacio_entre_los_elementos_en_vertical"));
533
                        bspaceDown.setBounds(150, 115, 24, 24);
534
                }
535

    
536
                return bspaceDown;
537
        }
538

    
539
        /**
540
         * This method initializes lEspacio
541
         *
542
         * @return javax.swing.JLabel
543
         */
544
        private javax.swing.JLabel getLEspacio() {
545
                if (lEspacio == null) {
546
                        lEspacio = new javax.swing.JLabel();
547
                        lEspacio.setBounds(125, 100, 57, 15);
548
                        lEspacio.setText(PluginServices.getText(this, "espacio"));
549
                }
550

    
551
                return lEspacio;
552
        }
553

    
554
        /**
555
         * This method initializes lEnElMapa
556
         *
557
         * @return javax.swing.JLabel
558
         */
559
        private javax.swing.JLabel getLEnElMapa() {
560
                if (lEnElMapa == null) {
561
                        lEnElMapa = new javax.swing.JLabel();
562
                        lEnElMapa.setBounds(187, 33, 77, 17);
563
                        lEnElMapa.setText(PluginServices.getText(this, "en_el_mapa"));
564
                }
565

    
566
                return lEnElMapa;
567
        }
568

    
569
        /**
570
         * This method initializes binLayout
571
         *
572
         * @return javax.swing.JButton
573
         */
574
        private JToggleButton getBinLayout() {
575
                if (binLayout == null) {
576
                        binLayout = new JToggleButton();
577
                        binLayout.setIcon(iinLayout);
578
                        binLayout.setToolTipText(PluginServices.getText(this,"distribuir_elementos_sobre_todo_el_layout"));
579
                        binLayout.setBounds(199, 58, 51, 41);
580
                }
581

    
582
                return binLayout;
583
        }
584

    
585
        /**
586
         * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
587
         */
588
        public Object getWindowModel() {
589
                return "AlignDialog";
590
        }
591

    
592
        /**
593
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
594
         */
595
        public WindowInfo getWindowInfo() {
596
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG|WindowInfo.PALETTE);
597
                m_viewinfo.setTitle(PluginServices.getText(this, "alinear"));
598

    
599
                return m_viewinfo;
600
        }
601

    
602
        /**
603
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
604
         */
605
        public void viewActivated() {
606
        }
607

    
608
        public Object getWindowProfile() {
609
                return WindowInfo.PROPERTIES_PROFILE;
610
        }
611
}  //  @jve:decl-index=0:visual-constraint="10,10"