Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / gui / dialogs / EventsFAlign.java @ 36648

History | View | Annotate | Download (47.5 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.project.documents.layout.gui.dialogs;
23

    
24
import java.awt.event.ActionEvent;
25
import java.awt.event.ActionListener;
26
import java.awt.geom.Rectangle2D;
27
import java.util.Iterator;
28
import java.util.TreeMap;
29

    
30
import org.slf4j.Logger;
31
import org.slf4j.LoggerFactory;
32

    
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.app.project.documents.layout.commands.FrameCommandsRecord;
35
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
36
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
37

    
38
/**
39
 * Clase que hace de Listener de FAlignDialog.
40
 * 
41
 * @author Vicente Caballero Navarro
42
 */
43
public class EventsFAlign implements ActionListener {
44

    
45
    protected static final Logger LOG = LoggerFactory
46
        .getLogger(EventsFAlign.class);
47
    private LayoutPanel m_layout;
48
    private boolean inLayout = false;
49

    
50
    /**
51
     * Crea un nuevo FAlign.
52
     * 
53
     * @param layout
54
     *            Referencia al Layout.
55
     */
56
    public EventsFAlign(LayoutPanel layout) {
57
        m_layout = layout;
58
    }
59

    
60
    /**
61
     * Desplaza los fframes seleccionados a la izquierda del fframe m?s
62
     * occidental.
63
     * 
64
     * @throws CloneNotSupportedException
65
     */
66
    private void alignLeft() throws CloneNotSupportedException {
67
        double xmin = Double.MAX_VALUE;
68
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
69

    
70
        for (int i = 0; i < fframes.length; i++) {
71
            IFFrame fframe = fframes[i];
72

    
73
            if (xmin > fframe.getBoundBox().getMinX()) {
74
                xmin = fframe.getBoundBox().getMinX();
75
            }
76
        }
77

    
78
        FrameCommandsRecord efs =
79
            m_layout.getLayoutContext().getFrameCommandsRecord();
80
        efs.startComplex(PluginServices.getText(this, "align_left"));
81

    
82
        for (int i = fframes.length - 1; i >= 0; i--) {
83
            IFFrame fframe = (IFFrame) fframes[i].clone();
84

    
85
            Rectangle2D.Double r =
86
                (Rectangle2D.Double) fframe.getBoundBox().clone();
87
            r.x = xmin;
88
            fframe.setBoundBox(r);
89
            efs.update(fframes[i], fframe);
90
        }
91

    
92
        efs.endComplex();
93
    }
94

    
95
    /**
96
     * Desplaza los fframes seleccionados a la izquierda del Layout.
97
     * 
98
     * @throws CloneNotSupportedException
99
     */
100
    private void alignLeftL() throws CloneNotSupportedException {
101
        double xmin = 0;
102
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
103
        FrameCommandsRecord efs =
104
            m_layout.getLayoutContext().getFrameCommandsRecord();
105
        efs.startComplex(PluginServices.getText(this, "align_to_layout_left"));
106

    
107
        for (int i = 0; i < fframes.length; i++) {
108
            IFFrame fframe = (IFFrame) fframes[i].clone();
109

    
110
            Rectangle2D.Double r =
111
                (Rectangle2D.Double) fframe.getBoundBox().clone();
112
            r.x = xmin;
113
            fframe.setBoundBox(r);
114
            efs.update(fframes[i], fframe);
115
        }
116

    
117
        efs.endComplex();
118
    }
119

    
120
    /**
121
     * Desplaza los fframes seleccionados al centro del fframe mas ancho de
122
     * forma horizontal.
123
     * 
124
     * @throws CloneNotSupportedException
125
     */
126
    private void alignCenterV() throws CloneNotSupportedException {
127
        double xcenter = 0;
128
        double w = Double.NEGATIVE_INFINITY;
129
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
130

    
131
        for (int i = 0; i < fframes.length; i++) {
132
            IFFrame fframe = fframes[i];
133

    
134
            if (w < fframe.getBoundBox().getWidth()) {
135
                w = fframe.getBoundBox().getWidth();
136
                xcenter = fframe.getBoundBox().getCenterX();
137
            }
138
        }
139

    
140
        FrameCommandsRecord efs =
141
            m_layout.getLayoutContext().getFrameCommandsRecord();
142
        efs.startComplex(PluginServices.getText(this, "align_center"));
143

    
144
        for (int i = 0; i < fframes.length; i++) {
145
            IFFrame fframe = (IFFrame) fframes[i].clone();
146

    
147
            Rectangle2D.Double r =
148
                (Rectangle2D.Double) fframe.getBoundBox().clone();
149
            r.x = xcenter - (fframe.getBoundBox().width / 2);
150
            fframe.setBoundBox(r);
151
            efs.update(fframes[i], fframe);
152
        }
153

    
154
        efs.endComplex();
155
    }
156

    
157
    /**
158
     * Desplaza los fframes seleccionados al centro del Layout horizontalmente.
159
     * 
160
     * @throws CloneNotSupportedException
161
     */
162
    private void alignCenterVL() throws CloneNotSupportedException {
163
        double xcenter = 0;
164
        xcenter =
165
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAncho() / 2;
166

    
167
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
168
        FrameCommandsRecord efs =
169
            m_layout.getLayoutContext().getFrameCommandsRecord();
170
        efs.startComplex(PluginServices.getText(this, "align_to_layout_center"));
171

    
172
        for (int i = 0; i < fframes.length; i++) {
173
            IFFrame fframe = (IFFrame) fframes[i].clone();
174

    
175
            Rectangle2D.Double r =
176
                (Rectangle2D.Double) fframe.getBoundBox().clone();
177
            r.x = xcenter - (fframe.getBoundBox().width / 2);
178
            fframe.setBoundBox(r);
179
            efs.update(fframes[i], fframe);
180
        }
181

    
182
        efs.endComplex();
183
    }
184

    
185
    /**
186
     * Desplaza los fframes seleccionados a la parte derecha del fframe m?s
187
     * oriental.
188
     * 
189
     * @throws CloneNotSupportedException
190
     */
191
    private void alignRight() throws CloneNotSupportedException {
192
        double xmax = Double.NEGATIVE_INFINITY;
193
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
194

    
195
        for (int i = 0; i < fframes.length; i++) {
196
            IFFrame fframe = fframes[i];
197

    
198
            if (xmax < fframe.getBoundBox().getMaxX()) {
199
                xmax = fframe.getBoundBox().getMaxX();
200
            }
201
        }
202

    
203
        FrameCommandsRecord efs =
204
            m_layout.getLayoutContext().getFrameCommandsRecord();
205
        efs.startComplex(PluginServices.getText(this, "align_right"));
206

    
207
        for (int i = 0; i < fframes.length; i++) {
208
            IFFrame fframe = (IFFrame) fframes[i].clone();
209

    
210
            Rectangle2D.Double r =
211
                (Rectangle2D.Double) fframe.getBoundBox().clone();
212
            r.x = xmax - fframes[i].getBoundBox().width;
213
            fframe.setBoundBox(r);
214
            efs.update(fframes[i], fframe);
215
        }
216

    
217
        efs.endComplex();
218
    }
219

    
220
    /**
221
     * Desplaza los fframes seleccionados a la parte derecha del Layout.
222
     * 
223
     * @throws CloneNotSupportedException
224
     */
225
    private void alignRightL() throws CloneNotSupportedException {
226
        double xmax = 0;
227
        xmax =
228
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAncho();
229

    
230
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
231
        FrameCommandsRecord efs =
232
            m_layout.getLayoutContext().getFrameCommandsRecord();
233
        efs.startComplex(PluginServices.getText(this, "align_to_layout_right"));
234

    
235
        for (int i = 0; i < fframes.length; i++) {
236
            IFFrame fframe = (IFFrame) fframes[i].clone();
237

    
238
            Rectangle2D.Double r =
239
                (Rectangle2D.Double) fframe.getBoundBox().clone();
240
            r.x = xmax - fframes[i].getBoundBox().width;
241
            fframe.setBoundBox(r);
242
            efs.update(fframes[i], fframe);
243
        }
244

    
245
        efs.endComplex();
246
    }
247

    
248
    /**
249
     * Desplaza los fframes seleccionados a la parte inferior del fframe m?s
250
     * hacia abajo.
251
     * 
252
     * @throws CloneNotSupportedException
253
     */
254
    private void alignDown() throws CloneNotSupportedException {
255
        double ymax = Double.NEGATIVE_INFINITY;
256
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
257

    
258
        for (int i = 0; i < fframes.length; i++) {
259
            IFFrame fframe = fframes[i];
260

    
261
            if (ymax < fframe.getBoundBox().getMaxY()) {
262
                ymax = fframe.getBoundBox().getMaxY();
263
            }
264
        }
265

    
266
        FrameCommandsRecord efs =
267
            m_layout.getLayoutContext().getFrameCommandsRecord();
268
        efs.startComplex(PluginServices.getText(this, "align_down"));
269

    
270
        for (int i = 0; i < fframes.length; i++) {
271
            IFFrame fframe = (IFFrame) fframes[i].clone();
272

    
273
            Rectangle2D.Double r =
274
                (Rectangle2D.Double) fframe.getBoundBox().clone();
275
            r.y = ymax - fframe.getBoundBox().height;
276
            fframe.setBoundBox(r);
277
            efs.update(fframes[i], fframe);
278
        }
279

    
280
        efs.endComplex();
281
    }
282

    
283
    /**
284
     * Desplaza los fframes seleccionados a la parte inferior del Layout.
285
     * 
286
     * @throws CloneNotSupportedException
287
     */
288
    private void alignDownL() throws CloneNotSupportedException {
289
        double ymax = 0;
290
        ymax =
291
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAlto();
292

    
293
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
294
        FrameCommandsRecord efs =
295
            m_layout.getLayoutContext().getFrameCommandsRecord();
296
        efs.startComplex(PluginServices.getText(this, "align_to_layout_down"));
297

    
298
        for (int i = 0; i < fframes.length; i++) {
299
            IFFrame fframe = (IFFrame) fframes[i].clone();
300
            Rectangle2D.Double r =
301
                (Rectangle2D.Double) fframe.getBoundBox().clone();
302
            r.y = ymax - fframe.getBoundBox().height;
303
            fframe.setBoundBox(r);
304
            efs.update(fframes[i], fframe);
305
        }
306

    
307
        efs.endComplex();
308
    }
309

    
310
    /**
311
     * Desplaza los fframes seleccionados a la parte superior del fframe que
312
     * m?s arriba este colocado.
313
     * 
314
     * @throws CloneNotSupportedException
315
     */
316
    private void alignUp() throws CloneNotSupportedException {
317
        double ymin = Double.MAX_VALUE;
318
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
319

    
320
        for (int i = 0; i < fframes.length; i++) {
321
            IFFrame fframe = fframes[i];
322

    
323
            if (ymin > fframe.getBoundBox().getMinY()) {
324
                ymin = fframe.getBoundBox().getMinY();
325
            }
326
        }
327

    
328
        FrameCommandsRecord efs =
329
            m_layout.getLayoutContext().getFrameCommandsRecord();
330
        efs.startComplex(PluginServices.getText(this, "align_up"));
331

    
332
        for (int i = 0; i < fframes.length; i++) {
333
            IFFrame fframe = (IFFrame) fframes[i].clone();
334
            Rectangle2D.Double r =
335
                (Rectangle2D.Double) fframe.getBoundBox().clone();
336
            r.y = ymin;
337
            fframe.setBoundBox(r);
338
            efs.update(fframes[i], fframe);
339
        }
340

    
341
        efs.endComplex();
342
    }
343

    
344
    /**
345
     * Desplaza los fframes seleccionados a la parte superior del Layout.
346
     * 
347
     * @throws CloneNotSupportedException
348
     */
349
    private void alignUpL() throws CloneNotSupportedException {
350
        double ymin = 0;
351
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
352
        FrameCommandsRecord efs =
353
            m_layout.getLayoutContext().getFrameCommandsRecord();
354
        efs.startComplex(PluginServices.getText(this, "align_to_layout_up"));
355

    
356
        for (int i = 0; i < fframes.length; i++) {
357
            IFFrame fframe = (IFFrame) fframes[i].clone();
358
            Rectangle2D.Double r =
359
                (Rectangle2D.Double) fframe.getBoundBox().clone();
360
            r.y = ymin;
361
            fframe.setBoundBox(r);
362
            efs.update(fframes[i], fframe);
363
        }
364

    
365
        efs.endComplex();
366
    }
367

    
368
    /**
369
     * Desplaza los fframes seleccionados al centro del fframe m?s alto
370
     * verticalmente.
371
     * 
372
     * @throws CloneNotSupportedException
373
     */
374
    private void alignCenterH() throws CloneNotSupportedException {
375
        double ycenter = 0;
376
        double h = Double.NEGATIVE_INFINITY;
377
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
378

    
379
        for (int i = 0; i < fframes.length; i++) {
380
            IFFrame fframe = fframes[i];
381

    
382
            if (h < fframe.getBoundBox().getHeight()) {
383
                h = fframe.getBoundBox().getHeight();
384
                ycenter = fframe.getBoundBox().getCenterY();
385
            }
386
        }
387

    
388
        FrameCommandsRecord efs =
389
            m_layout.getLayoutContext().getFrameCommandsRecord();
390
        efs.startComplex(PluginServices.getText(this, "align_vertical_center"));
391

    
392
        for (int i = 0; i < fframes.length; i++) {
393
            IFFrame fframe = (IFFrame) fframes[i].clone();
394
            Rectangle2D.Double r =
395
                (Rectangle2D.Double) fframe.getBoundBox().clone();
396
            r.y = ycenter - (fframe.getBoundBox().height / 2);
397
            fframe.setBoundBox(r);
398
            efs.update(fframes[i], fframe);
399
        }
400

    
401
        efs.endComplex();
402
    }
403

    
404
    /**
405
     * Desplaza los fframes seleccionados en el Layout al centro verticalmente.
406
     * 
407
     * @throws CloneNotSupportedException
408
     */
409
    private void alignCenterHL() throws CloneNotSupportedException {
410
        double ycenter = 0;
411
        ycenter =
412
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAlto() / 2;
413

    
414
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
415
        FrameCommandsRecord efs =
416
            m_layout.getLayoutContext().getFrameCommandsRecord();
417
        efs.startComplex(PluginServices.getText(this,
418
            "align_to_layout_vertical_center"));
419

    
420
        for (int i = 0; i < fframes.length; i++) {
421
            IFFrame fframe = (IFFrame) fframes[i].clone();
422
            Rectangle2D.Double r =
423
                (Rectangle2D.Double) fframe.getBoundBox().clone();
424
            r.y = ycenter - (fframe.getBoundBox().height / 2);
425
            fframe.setBoundBox(r);
426
            efs.update(fframes[i], fframe);
427
        }
428

    
429
        efs.endComplex();
430
    }
431

    
432
    /**
433
     * Distribuye los fframes seleccionados de forma equidistante y vertical,
434
     * de izquierda a derecha.
435
     * 
436
     * @throws CloneNotSupportedException
437
     */
438
    private void distLeft() throws CloneNotSupportedException {
439
        double xmin = Double.MAX_VALUE;
440
        double xmax = Double.NEGATIVE_INFINITY;
441
        int num = 0;
442
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
443
        num = fframes.length;
444

    
445
        for (int i = 0; i < num; i++) {
446
            IFFrame fframe = fframes[i];
447

    
448
            if (xmin > fframe.getBoundBox().getMinX()) {
449
                xmin = fframe.getBoundBox().getMinX();
450
            }
451

    
452
            if (xmax < fframe.getBoundBox().getMaxX()) {
453
                xmax = fframe.getBoundBox().getMaxX();
454
            }
455
        }
456

    
457
        double dif = xmax - xmin;
458
        double dist = dif / num;
459
        FrameCommandsRecord efs =
460
            m_layout.getLayoutContext().getFrameCommandsRecord();
461
        efs.startComplex(PluginServices.getText(this, "distributes_left"));
462

    
463
        for (int i = 0; i < fframes.length; i++) {
464
            IFFrame fframe = (IFFrame) fframes[i].clone();
465
            Rectangle2D.Double r =
466
                (Rectangle2D.Double) fframe.getBoundBox().clone();
467
            r.x = xmin + (dist * i);
468
            fframe.setBoundBox(r);
469
            efs.update(fframes[i], fframe);
470
        }
471

    
472
        efs.endComplex();
473
    }
474

    
475
    /**
476
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
477
     * y vertical, de izquierda a derecha.
478
     * 
479
     * @throws CloneNotSupportedException
480
     */
481
    private void distLeftL() throws CloneNotSupportedException {
482
        double xmin = 0;
483
        double xmax = 0;
484
        xmax =
485
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAncho();
486

    
487
        int num = 0;
488
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
489
        num = fframes.length;
490

    
491
        double dif = xmax - xmin;
492
        double dist = dif / num;
493
        FrameCommandsRecord efs =
494
            m_layout.getLayoutContext().getFrameCommandsRecord();
495
        efs.startComplex(PluginServices.getText(this,
496
            "distributes_to_layout_left"));
497

    
498
        for (int i = 0; i < fframes.length; i++) {
499
            IFFrame fframe = (IFFrame) fframes[i].clone();
500
            Rectangle2D.Double r =
501
                (Rectangle2D.Double) fframe.getBoundBox().clone();
502
            r.x = xmin + (dist * i);
503
            fframe.setBoundBox(r);
504
            efs.update(fframes[i], fframe);
505
        }
506

    
507
        efs.endComplex();
508
    }
509

    
510
    /**
511
     * Distribuye los fframes seleccionados de forma equidistante y vertical,
512
     * de derecha a izquierda.
513
     */
514
    private void distRight() {
515
        double xmin = Double.MAX_VALUE;
516
        double xmax = Double.NEGATIVE_INFINITY;
517
        int num = 0;
518
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
519
        num = fframes.length;
520

    
521
        for (int i = 0; i < num; i++) {
522
            IFFrame fframe = fframes[i];
523

    
524
            if (xmin > fframe.getBoundBox().getMinX()) {
525
                xmin = fframe.getBoundBox().getMinX();
526
            }
527

    
528
            if (xmax < fframe.getBoundBox().getMaxX()) {
529
                xmax = fframe.getBoundBox().getMaxX();
530
            }
531
        }
532

    
533
        double dif = xmax - xmin;
534
        double dist = dif / num;
535
        FrameCommandsRecord efs =
536
            m_layout.getLayoutContext().getFrameCommandsRecord();
537
        efs.startComplex(PluginServices.getText(this, "distributes_right"));
538

    
539
        for (int i = 0; i < fframes.length; i++) {
540
            IFFrame fframe = fframes[i];
541
            Rectangle2D.Double r =
542
                (Rectangle2D.Double) fframe.getBoundBox().clone();
543
            r.x = xmax - (dist * i) - fframe.getBoundBox().width;
544
            fframe.setBoundBox(r);
545
            efs.update(fframes[i], fframe);
546
        }
547

    
548
        efs.endComplex();
549
    }
550

    
551
    /**
552
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
553
     * y vertical, de derecha a izquierda.
554
     * 
555
     * @throws CloneNotSupportedException
556
     */
557
    private void distRightL() throws CloneNotSupportedException {
558
        double xmin = 0;
559
        double xmax = 0;
560
        xmax =
561
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAncho();
562

    
563
        int num = 0;
564
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
565
        num = fframes.length;
566

    
567
        double dif = xmax - xmin;
568
        double dist = dif / num;
569
        FrameCommandsRecord efs =
570
            m_layout.getLayoutContext().getFrameCommandsRecord();
571
        efs.startComplex(PluginServices.getText(this,
572
            "distributes_to_layout_right"));
573

    
574
        for (int i = 0; i < fframes.length; i++) {
575
            IFFrame fframe = (IFFrame) fframes[i].clone();
576
            Rectangle2D.Double r =
577
                (Rectangle2D.Double) fframe.getBoundBox().clone();
578
            r.x = xmax - (dist * i) - fframe.getBoundBox().width;
579
            fframe.setBoundBox(r);
580
            efs.update(fframes[i], fframe);
581
        }
582

    
583
        efs.endComplex();
584
    }
585

    
586
    /**
587
     * Distribuye los fframes seleccionados de forma equidistante y vertical,
588
     * desde arriba hacia abajo.
589
     */
590
    private void distUp() {
591
        double ymin = Double.MAX_VALUE;
592
        double ymax = Double.NEGATIVE_INFINITY;
593
        int num = 0;
594
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
595
        num = fframes.length;
596

    
597
        for (int i = 0; i < num; i++) {
598
            IFFrame fframe = fframes[i];
599

    
600
            if (ymin > fframe.getBoundBox().getMinY()) {
601
                ymin = fframe.getBoundBox().getMinY();
602
            }
603

    
604
            if (ymax < fframe.getBoundBox().getMaxY()) {
605
                ymax = fframe.getBoundBox().getMaxY();
606
            }
607
        }
608

    
609
        double dif = ymax - ymin;
610
        double dist = dif / num;
611
        FrameCommandsRecord efs =
612
            m_layout.getLayoutContext().getFrameCommandsRecord();
613
        efs.startComplex(PluginServices.getText(this, "distributes_up"));
614

    
615
        for (int i = 0; i < fframes.length; i++) {
616
            IFFrame fframe = fframes[i];
617
            Rectangle2D.Double r =
618
                (Rectangle2D.Double) fframe.getBoundBox().clone();
619
            r.y = ymin + (dist * i);
620
            fframe.setBoundBox(r);
621
            efs.update(fframes[i], fframe);
622
        }
623

    
624
        efs.endComplex();
625
    }
626

    
627
    /**
628
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
629
     * y vertical, desde arriba hacia abajo.
630
     * 
631
     * @throws CloneNotSupportedException
632
     */
633
    private void distUpL() throws CloneNotSupportedException {
634
        double ymin = 0;
635
        double ymax = 0;
636
        ymax =
637
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAlto();
638

    
639
        int num = 0;
640
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
641

    
642
        num = fframes.length;
643

    
644
        double dif = ymax - ymin;
645
        double dist = dif / num;
646
        FrameCommandsRecord efs =
647
            m_layout.getLayoutContext().getFrameCommandsRecord();
648
        efs.startComplex(PluginServices.getText(this,
649
            "distributes_to_layout_up"));
650

    
651
        for (int i = 0; i < fframes.length; i++) {
652
            IFFrame fframe = (IFFrame) fframes[i].clone();
653
            Rectangle2D.Double r =
654
                (Rectangle2D.Double) fframe.getBoundBox().clone();
655
            r.y = ymin + (dist * i);
656
            fframe.setBoundBox(r);
657
            efs.update(fframes[i], fframe);
658
        }
659

    
660
        efs.endComplex();
661
    }
662

    
663
    /**
664
     * Distribuye los fframes seleccionados de forma equidistante y vertical,
665
     * desde bajo hacia arriba.
666
     * 
667
     * @throws CloneNotSupportedException
668
     */
669
    private void distDown() throws CloneNotSupportedException {
670
        double ymin = Double.MAX_VALUE;
671
        double ymax = Double.NEGATIVE_INFINITY;
672
        int num = 0;
673
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
674
        num = fframes.length;
675

    
676
        for (int i = 0; i < num; i++) {
677
            IFFrame fframe = fframes[i];
678

    
679
            if (ymin > fframe.getBoundBox().getMinY()) {
680
                ymin = fframe.getBoundBox().getMinY();
681
            }
682

    
683
            if (ymax < fframe.getBoundBox().getMaxY()) {
684
                ymax = fframe.getBoundBox().getMaxY();
685
            }
686
        }
687

    
688
        double dif = ymax - ymin;
689
        double dist = dif / num;
690
        FrameCommandsRecord efs =
691
            m_layout.getLayoutContext().getFrameCommandsRecord();
692
        efs.startComplex(PluginServices.getText(this, "distributes_down"));
693

    
694
        for (int i = 0; i < fframes.length; i++) {
695
            IFFrame fframe = (IFFrame) fframes[i].clone();
696
            Rectangle2D.Double r =
697
                (Rectangle2D.Double) fframe.getBoundBox().clone();
698
            r.y = ymax - (dist * i) - fframe.getBoundBox().height;
699
            fframe.setBoundBox(r);
700
            efs.update(fframes[i], fframe);
701
        }
702

    
703
        efs.endComplex();
704
    }
705

    
706
    /**
707
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
708
     * y vertical, desde bajo hacia arriba.
709
     * 
710
     * @throws CloneNotSupportedException
711
     */
712
    private void distDownL() throws CloneNotSupportedException {
713
        double ymin = 0;
714
        double ymax = 0;
715
        ymax =
716
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAlto();
717

    
718
        int num = 0;
719
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
720

    
721
        num = fframes.length;
722

    
723
        double dif = ymax - ymin;
724
        double dist = dif / num;
725
        FrameCommandsRecord efs =
726
            m_layout.getLayoutContext().getFrameCommandsRecord();
727
        efs.startComplex(PluginServices.getText(this,
728
            "distributes_to_layout_down"));
729

    
730
        for (int i = fframes.length - 1; i >= 0; i--) {
731
            IFFrame fframe = (IFFrame) fframes[i].clone();
732
            Rectangle2D.Double r =
733
                (Rectangle2D.Double) fframe.getBoundBox().clone();
734
            r.y = ymax - (dist * i) - fframe.getBoundBox().height;
735
            fframe.setBoundBox(r);
736
            efs.update(fframes[i], fframe);
737
        }
738

    
739
        efs.endComplex();
740
    }
741

    
742
    /**
743
     * Distribuye los fframes seleccionados de forma equidistante y vertical.
744
     * 
745
     * @throws CloneNotSupportedException
746
     */
747
    private void distCenterH() throws CloneNotSupportedException {
748
        double xmin = Double.MAX_VALUE;
749
        double xmax = Double.NEGATIVE_INFINITY;
750
        int num = 0;
751
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
752
        num = fframes.length;
753

    
754
        for (int i = 0; i < num; i++) {
755
            IFFrame fframe = fframes[i];
756

    
757
            if (xmin > fframe.getBoundBox().getMinX()) {
758
                xmin = fframe.getBoundBox().getMinX();
759
            }
760

    
761
            if (xmax < fframe.getBoundBox().getMaxX()) {
762
                xmax = fframe.getBoundBox().getMaxX();
763
            }
764
        }
765

    
766
        double dif = xmax - xmin;
767
        double dist = dif / num;
768
        FrameCommandsRecord efs =
769
            m_layout.getLayoutContext().getFrameCommandsRecord();
770
        efs.startComplex(PluginServices.getText(this, "distributes_vertical"));
771

    
772
        for (int i = 0; i < fframes.length; i++) {
773
            IFFrame fframe = (IFFrame) fframes[i].clone();
774
            Rectangle2D.Double r =
775
                (Rectangle2D.Double) fframe.getBoundBox().clone();
776
            r.x =
777
                (xmin + (((dist) * (i + 1)) - (dist / 2)))
778
                    - (fframe.getBoundBox().width / 2);
779
            fframe.setBoundBox(r);
780
            efs.update(fframes[i], fframe);
781
        }
782

    
783
        efs.endComplex();
784
    }
785

    
786
    /**
787
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
788
     * y vertical.
789
     * 
790
     * @throws CloneNotSupportedException
791
     */
792
    private void distCenterHL() throws CloneNotSupportedException {
793
        double xmin = 0;
794
        double xmax = 0;
795
        xmax =
796
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAncho();
797

    
798
        int num = 0;
799
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
800
        num = fframes.length;
801

    
802
        double dif = xmax - xmin;
803
        double dist = dif / num;
804
        FrameCommandsRecord efs =
805
            m_layout.getLayoutContext().getFrameCommandsRecord();
806
        efs.startComplex(PluginServices.getText(this,
807
            "distributes_to_layout_vertical"));
808

    
809
        for (int i = 0; i < fframes.length; i++) {
810
            IFFrame fframe = (IFFrame) fframes[i].clone();
811
            Rectangle2D.Double r =
812
                (Rectangle2D.Double) fframe.getBoundBox().clone();
813
            r.x =
814
                (xmin + (((dist) * (i + 1)) - (dist / 2)))
815
                    - (fframe.getBoundBox().width / 2);
816
            fframe.setBoundBox(r);
817
            efs.update(fframes[i], fframe);
818
        }
819

    
820
        efs.endComplex();
821
    }
822

    
823
    /**
824
     * Distribuye los fframes seleccionados de forma equidistante y horizontal.
825
     * 
826
     * @throws CloneNotSupportedException
827
     */
828
    private void distCenterV() throws CloneNotSupportedException {
829
        double ymin = Double.MAX_VALUE;
830
        double ymax = Double.NEGATIVE_INFINITY;
831
        int num = 0;
832
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
833
        num = fframes.length;
834

    
835
        for (int i = 0; i < num; i++) {
836
            IFFrame fframe = fframes[i];
837

    
838
            if (ymin > fframe.getBoundBox().getMinY()) {
839
                ymin = fframe.getBoundBox().getMinY();
840
            }
841

    
842
            if (ymax < fframe.getBoundBox().getMaxY()) {
843
                ymax = fframe.getBoundBox().getMaxY();
844
            }
845
        }
846

    
847
        double dif = ymax - ymin;
848
        double dist = dif / num;
849
        FrameCommandsRecord efs =
850
            m_layout.getLayoutContext().getFrameCommandsRecord();
851
        efs.startComplex(PluginServices.getText(this, "distributes_horizontal"));
852

    
853
        for (int i = 0; i < fframes.length; i++) {
854
            IFFrame fframe = (IFFrame) fframes[i].clone();
855
            Rectangle2D.Double r =
856
                (Rectangle2D.Double) fframe.getBoundBox().clone();
857
            r.y =
858
                (ymin + (((dist) * (i + 1)) - (dist / 2)))
859
                    - (fframe.getBoundBox().height / 2);
860
            fframe.setBoundBox(r);
861
            efs.update(fframes[i], fframe);
862
        }
863

    
864
        efs.endComplex();
865
    }
866

    
867
    /**
868
     * Distribuye los fframes seleccionados en el Layout de forma equidistante
869
     * y horizontal.
870
     * 
871
     * @throws CloneNotSupportedException
872
     */
873
    private void distCenterVL() throws CloneNotSupportedException {
874
        double ymin = 0;
875
        double ymax = 0;
876
        ymax =
877
            m_layout.getLayoutContext().getAttributes().m_sizePaper.getAlto();
878

    
879
        int num = 0;
880
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
881
        num = fframes.length;
882

    
883
        double dif = ymax - ymin;
884
        double dist = dif / num;
885
        FrameCommandsRecord efs =
886
            m_layout.getLayoutContext().getFrameCommandsRecord();
887
        efs.startComplex(PluginServices.getText(this,
888
            "distributes_to_layout_horizontal"));
889

    
890
        for (int i = 0; i < fframes.length; i++) {
891
            IFFrame fframe = (IFFrame) fframes[i].clone();
892
            Rectangle2D.Double r =
893
                (Rectangle2D.Double) fframe.getBoundBox().clone();
894
            r.y =
895
                (ymin + (((dist) * (i + 1)) - (dist / 2)))
896
                    - (fframe.getBoundBox().height / 2);
897
            fframe.setBoundBox(r);
898
            efs.update(fframes[i], fframe);
899
        }
900

    
901
        efs.endComplex();
902
    }
903

    
904
    /**
905
     * Cambia la anchura de los fframes seleccionados por la anchura del m?s
906
     * ancho.
907
     * 
908
     * @throws CloneNotSupportedException
909
     */
910
    private void sizeWidth() throws CloneNotSupportedException {
911
        double wmax = Double.NEGATIVE_INFINITY;
912
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
913

    
914
        for (int i = 0; i < fframes.length; i++) {
915
            IFFrame fframe = fframes[i];
916

    
917
            if (wmax < fframe.getBoundBox().getWidth()) {
918
                wmax = fframe.getBoundBox().getWidth();
919
            }
920
        }
921

    
922
        FrameCommandsRecord efs =
923
            m_layout.getLayoutContext().getFrameCommandsRecord();
924
        efs.startComplex(PluginServices.getText(this, "change_width"));
925

    
926
        for (int i = 0; i < fframes.length; i++) {
927
            IFFrame fframe = (IFFrame) fframes[i].clone();
928
            Rectangle2D.Double r =
929
                (Rectangle2D.Double) fframe.getBoundBox().clone();
930
            r.width = wmax;
931
            fframe.setBoundBox(r);
932
            efs.update(fframes[i], fframe);
933
        }
934

    
935
        efs.endComplex();
936
    }
937

    
938
    /**
939
     * Cambia la altura de los fframes seleccionados por la altura del mas
940
     * alto.
941
     * 
942
     * @throws CloneNotSupportedException
943
     */
944
    private void sizeHeight() throws CloneNotSupportedException {
945
        double hmax = Double.NEGATIVE_INFINITY;
946
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
947

    
948
        for (int i = 0; i < fframes.length; i++) {
949
            IFFrame fframe = fframes[i];
950

    
951
            if (hmax < fframe.getBoundBox().getHeight()) {
952
                hmax = fframe.getBoundBox().getHeight();
953
            }
954
        }
955

    
956
        FrameCommandsRecord efs =
957
            m_layout.getLayoutContext().getFrameCommandsRecord();
958
        efs.startComplex(PluginServices.getText(this, "change_height"));
959

    
960
        for (int i = 0; i < fframes.length; i++) {
961
            IFFrame fframe = (IFFrame) fframes[i].clone();
962
            Rectangle2D.Double r =
963
                (Rectangle2D.Double) fframe.getBoundBox().clone();
964
            r.height = hmax;
965
            fframe.setBoundBox(r);
966
            efs.update(fframes[i], fframe);
967
        }
968

    
969
        efs.endComplex();
970
    }
971

    
972
    /**
973
     * Distribuye horizontalmente los fframes dejando como espacio entre ellos
974
     * la media de todos los espacios.
975
     * 
976
     * @throws CloneNotSupportedException
977
     */
978
    private void spaceRight() throws CloneNotSupportedException {
979
        double total = 0;
980
        double num = 0;
981
        double xmin = Double.MAX_VALUE;
982
        double xmax = Double.NEGATIVE_INFINITY;
983

    
984
        TreeMap<Double, IFFrame> treemap = new TreeMap<Double, IFFrame>();
985
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
986
        num = fframes.length;
987

    
988
        for (int i = 0; i < num; i++) {
989
            IFFrame fframe = fframes[i];
990
            treemap.put(new Double(fframe.getBoundBox().getMinX()), fframe);
991
        }
992

    
993
        Iterator<Double> j = treemap.keySet().iterator();
994

    
995
        if (j.hasNext()) {
996
            IFFrame fframeA = (IFFrame) treemap.get(j.next());
997
            IFFrame fframeS = null;
998
            xmin = fframeA.getBoundBox().x;
999

    
1000
            while (j.hasNext()) {
1001
                fframeS = (IFFrame) treemap.get(j.next());
1002
                total +=
1003
                    (fframeS.getBoundBox().getMinX() - fframeA.getBoundBox()
1004
                        .getMaxX());
1005
                fframeA = fframeS;
1006
            }
1007

    
1008
            if (fframeS != null) {
1009
                xmax = fframeS.getBoundBox().getMaxX();
1010
            }
1011
        }
1012

    
1013
        if (inLayout) {
1014
            total +=
1015
                (xmin + (m_layout.getLayoutContext().getAttributes().m_sizePaper
1016
                    .getAncho() - xmax));
1017
            num += 2;
1018
        }
1019

    
1020
        double dist = total / (num - 1);
1021
        Iterator<Double> k = treemap.keySet().iterator();
1022
        FrameCommandsRecord efs =
1023
            m_layout.getLayoutContext().getFrameCommandsRecord();
1024
        efs.startComplex(PluginServices.getText(this, "horizontal_space"));
1025

    
1026
        if (k.hasNext()) {
1027
            IFFrame fframe = (IFFrame) treemap.get(k.next());
1028
            IFFrame fframeA = (IFFrame) fframe.clone();
1029

    
1030
            if (inLayout) {
1031
                Rectangle2D.Double r =
1032
                    (Rectangle2D.Double) fframeA.getBoundBox().clone();
1033
                r.x = dist;
1034
                fframeA.setBoundBox(r);
1035
                efs.update(fframe, fframeA);
1036
            }
1037

    
1038
            while (k.hasNext()) {
1039
                IFFrame fframeAux = (IFFrame) treemap.get(k.next());
1040
                IFFrame fframeS = (IFFrame) fframeAux.clone();
1041
                Rectangle2D.Double r =
1042
                    (Rectangle2D.Double) fframeS.getBoundBox().clone();
1043
                r.x = fframeA.getBoundBox().getMaxX() + dist;
1044
                fframeS.setBoundBox(r);
1045
                efs.update(fframeAux, fframeS);
1046
                fframeA = fframeS;
1047
            }
1048
        }
1049

    
1050
        efs.endComplex();
1051
    }
1052

    
1053
    /**
1054
     * Distribuye verticalmente los fframes dejando como espacio entre ellos la
1055
     * media de todos los espacios.
1056
     * 
1057
     * @throws CloneNotSupportedException
1058
     */
1059
    private void spaceDown() throws CloneNotSupportedException {
1060
        double total = 0;
1061
        double num = 0;
1062
        double ymin = Double.MAX_VALUE;
1063
        double ymax = Double.NEGATIVE_INFINITY;
1064

    
1065
        TreeMap<Double, IFFrame> treemap = new TreeMap<Double, IFFrame>();
1066
        IFFrame[] fframes = m_layout.getLayoutContext().getFFrameSelected();
1067
        num = fframes.length;
1068

    
1069
        for (int i = 0; i < num; i++) {
1070
            IFFrame fframe = fframes[i];
1071
            treemap.put(new Double(fframe.getBoundBox().getMinY()), fframe);
1072
        }
1073

    
1074
        Iterator<Double> j = treemap.keySet().iterator();
1075

    
1076
        if (j.hasNext()) {
1077
            IFFrame fframeA = (IFFrame) treemap.get(j.next());
1078
            ymin = fframeA.getBoundBox().y;
1079

    
1080
            IFFrame fframeS = null;
1081

    
1082
            while (j.hasNext()) {
1083
                fframeS = (IFFrame) treemap.get(j.next());
1084
                total +=
1085
                    (fframeS.getBoundBox().getMinY() - fframeA.getBoundBox()
1086
                        .getMaxY());
1087
                fframeA = fframeS;
1088
            }
1089

    
1090
            if (fframeS != null) {
1091
                ymax = fframeS.getBoundBox().getMaxY();
1092
            }
1093
        }
1094

    
1095
        if (inLayout) {
1096
            total +=
1097
                (ymin + (m_layout.getLayoutContext().getAttributes().m_sizePaper
1098
                    .getAlto() - ymax));
1099
            num += 2;
1100
        }
1101

    
1102
        double dist = total / (num - 1);
1103
        Iterator<Double> k = treemap.keySet().iterator();
1104
        FrameCommandsRecord efs =
1105
            m_layout.getLayoutContext().getFrameCommandsRecord();
1106
        efs.startComplex(PluginServices.getText(this, "vertical_space"));
1107

    
1108
        if (k.hasNext()) {
1109
            IFFrame fframe = (IFFrame) treemap.get(k.next());
1110
            IFFrame fframeA = (IFFrame) fframe.clone();
1111

    
1112
            if (inLayout) {
1113
                Rectangle2D.Double r =
1114
                    (Rectangle2D.Double) fframeA.getBoundBox().clone();
1115
                r.y = dist;
1116
                fframeA.setBoundBox(r);
1117
                efs.update(fframe, fframeA);
1118
            }
1119

    
1120
            while (k.hasNext()) {
1121
                IFFrame fframeAux = (IFFrame) treemap.get(k.next());
1122
                IFFrame fframeS = (IFFrame) fframeAux.clone();
1123
                Rectangle2D.Double r =
1124
                    (Rectangle2D.Double) fframeS.getBoundBox().clone();
1125
                r.y = fframeA.getBoundBox().getMaxY() + dist;
1126
                fframeS.setBoundBox(r);
1127
                efs.update(fframeAux, fframeS);
1128
                fframeA = fframeS;
1129
            }
1130
        }
1131

    
1132
        efs.endComplex();
1133
    }
1134

    
1135
    /**
1136
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1137
     */
1138
    public void actionPerformed(ActionEvent e) {
1139
        m_layout.getLayoutContext().updateFFrames();
1140

    
1141
        try {
1142
            if (!inLayout) {
1143
                if (e.getActionCommand() == "LEFT") {
1144
                    alignLeft();
1145
                } else
1146
                    if (e.getActionCommand() == "CENTERV") {
1147
                        alignCenterV();
1148
                    } else
1149
                        if (e.getActionCommand() == "RIGHT") {
1150
                            alignRight();
1151
                        } else
1152
                            if (e.getActionCommand() == "UP") {
1153
                                alignUp();
1154
                            } else
1155
                                if (e.getActionCommand() == "CENTERH") {
1156
                                    alignCenterH();
1157
                                } else
1158
                                    if (e.getActionCommand() == "DOWN") {
1159
                                        alignDown();
1160
                                    } else
1161
                                        if (e.getActionCommand() == "DISTUP") {
1162
                                            distUp();
1163
                                        } else
1164
                                            if (e.getActionCommand() == "DISTCENTERV") {
1165
                                                distCenterV();
1166
                                            } else
1167
                                                if (e.getActionCommand() == "DISTDOWN") {
1168
                                                    distDown();
1169
                                                } else
1170
                                                    if (e.getActionCommand() == "DISTLEFT") {
1171
                                                        distLeft();
1172
                                                    } else
1173
                                                        if (e
1174
                                                            .getActionCommand() == "DISTCENTERH") {
1175
                                                            distCenterH();
1176
                                                        } else
1177
                                                            if (e
1178
                                                                .getActionCommand() == "DISTRIGHT") {
1179
                                                                distRight();
1180
                                                            } else
1181
                                                                if (e
1182
                                                                    .getActionCommand() == "SIZECENTERV") {
1183
                                                                    sizeWidth();
1184
                                                                } else
1185
                                                                    if (e
1186
                                                                        .getActionCommand() == "SIZECENTERH") {
1187
                                                                        sizeHeight();
1188
                                                                    } else
1189
                                                                        if (e
1190
                                                                            .getActionCommand() == "SIZEOTHER") {
1191
                                                                            sizeWidth();
1192
                                                                            m_layout
1193
                                                                                .getLayoutContext()
1194
                                                                                .updateFFrames();
1195
                                                                            sizeHeight();
1196
                                                                        } else
1197
                                                                            if (e
1198
                                                                                .getActionCommand() == "SPACERIGHT") {
1199
                                                                                spaceRight();
1200
                                                                            } else
1201
                                                                                if (e
1202
                                                                                    .getActionCommand() == "SPACEDOWN") {
1203
                                                                                    spaceDown();
1204
                                                                                } else
1205
                                                                                    if (e
1206
                                                                                        .getActionCommand() == "INLAYOUT") {
1207
                                                                                        inLayout =
1208
                                                                                            true;
1209
                                                                                    }
1210
            } else {
1211
                if (e.getActionCommand() == "LEFT") {
1212
                    alignLeftL();
1213
                } else
1214
                    if (e.getActionCommand() == "CENTERV") {
1215
                        alignCenterVL();
1216
                    } else
1217
                        if (e.getActionCommand() == "RIGHT") {
1218
                            alignRightL();
1219
                        } else
1220
                            if (e.getActionCommand() == "UP") {
1221
                                alignUpL();
1222
                            } else
1223
                                if (e.getActionCommand() == "CENTERH") {
1224
                                    alignCenterHL();
1225
                                } else
1226
                                    if (e.getActionCommand() == "DOWN") {
1227
                                        alignDownL();
1228
                                    } else
1229
                                        if (e.getActionCommand() == "DISTUP") {
1230
                                            distUpL();
1231
                                        } else
1232
                                            if (e.getActionCommand() == "DISTCENTERV") {
1233
                                                distCenterVL();
1234
                                            } else
1235
                                                if (e.getActionCommand() == "DISTDOWN") {
1236
                                                    distDownL();
1237
                                                } else
1238
                                                    if (e.getActionCommand() == "DISTLEFT") {
1239
                                                        distLeftL();
1240
                                                    } else
1241
                                                        if (e
1242
                                                            .getActionCommand() == "DISTCENTERH") {
1243
                                                            distCenterHL();
1244
                                                        } else
1245
                                                            if (e
1246
                                                                .getActionCommand() == "DISTRIGHT") {
1247
                                                                distRightL();
1248
                                                            } else
1249
                                                                if (e
1250
                                                                    .getActionCommand() == "SIZECENTERV") {
1251
                                                                    sizeWidth();
1252
                                                                } else
1253
                                                                    if (e
1254
                                                                        .getActionCommand() == "SIZECENTERH") {
1255
                                                                        sizeHeight();
1256
                                                                    } else
1257
                                                                        if (e
1258
                                                                            .getActionCommand() == "SIZEOTHER") {
1259
                                                                            sizeWidth();
1260
                                                                            m_layout
1261
                                                                                .getLayoutContext()
1262
                                                                                .updateFFrames();
1263
                                                                            sizeHeight();
1264
                                                                        } else
1265
                                                                            if (e
1266
                                                                                .getActionCommand() == "SPACERIGHT") {
1267
                                                                                spaceRight();
1268
                                                                            } else
1269
                                                                                if (e
1270
                                                                                    .getActionCommand() == "SPACEDOWN") {
1271
                                                                                    spaceDown();
1272
                                                                                } else
1273
                                                                                    if (e
1274
                                                                                        .getActionCommand() == "INLAYOUT") {
1275
                                                                                        inLayout =
1276
                                                                                            false;
1277
                                                                                    }
1278
            }
1279
        } catch (CloneNotSupportedException e1) {
1280
            LOG.error("It is not possible clonate the object", e);
1281
        }
1282

    
1283
        m_layout.getLayoutContext().updateFFrames();
1284
        m_layout.getLayoutContext().callLayoutDrawListeners();
1285
    }
1286
}