Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.selectiontools.app / org.gvsig.selectiontools.app.mainplugin / src / main / java / org / gvsig / selectiontools / app / extension / tools / buffer / gui / BufferConfigurationPanel.java @ 40944

History | View | Annotate | Download (24.1 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.selectiontools.app.extension.tools.buffer.gui;
25

    
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 *
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 *
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
44
 * MA  02110-1301, USA.
45
 *
46
 */
47

    
48
import java.awt.Dimension;
49
import java.awt.FlowLayout;
50
import java.awt.event.ActionEvent;
51
import java.awt.event.ActionListener;
52
import java.awt.event.ComponentAdapter;
53
import java.awt.event.ComponentEvent;
54
import java.text.DecimalFormat;
55
import java.util.ArrayList;
56
import java.util.Arrays;
57
import java.util.Iterator;
58

    
59
import javax.swing.BorderFactory;
60
import javax.swing.JCheckBox;
61
import javax.swing.JLabel;
62
import javax.swing.JOptionPane;
63
import javax.swing.JPanel;
64
import javax.swing.JTextField;
65
import javax.swing.text.NumberFormatter;
66

    
67
import org.gvsig.andami.PluginServices;
68
import org.gvsig.andami.messages.NotificationManager;
69
import org.gvsig.andami.ui.mdiManager.IWindow;
70
import org.gvsig.andami.ui.mdiManager.WindowInfo;
71
import org.gvsig.app.ApplicationLocator;
72
import org.gvsig.app.project.documents.view.gui.IView;
73
import org.gvsig.fmap.dal.exception.DataException;
74
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
75
import org.gvsig.fmap.mapcontrol.MapControl;
76
import org.gvsig.gui.beans.AcceptCancelPanel;
77
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
78
import org.gvsig.gui.beans.progresspanel.ProgressPanel;
79
import org.gvsig.i18n.Messages;
80
import org.gvsig.selectiontools.app.extension.tools.buffer.process.BufferSelectionProcess;
81
import org.gvsig.utils.swing.JComboBox;
82

    
83
/**
84
 * 
85
 * 
86
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
87
 */
88
public class BufferConfigurationPanel extends JPanel implements IWindow {
89

    
90
    private WindowInfo viewInfo = null;
91
    private final short Window_Width = 354;
92
    private final short Window_Height = 315; // 35;
93
    private JTextField distanceText = null;
94
    private JComboBox distanceUnitsCombo = null;
95
    private JComboBox polygonSidesCombo = null;
96
    private JComboBox lineSidesCombo = null;
97
    private JComboBox pointSidesCombo = null;
98
    private JComboBox multiPointSidesCombo = null;
99
    private JLabel distanceUnitsLabel = null;
100
    private JLabel polygonSideLabel = null;
101
    private JLabel lineSideLabel = null;
102
    private JLabel pointSideLabel = null;
103
    private JLabel multiPointSideLabel = null;
104
    private JPanel polygonSidePanel = null;
105
    private JPanel lineSidePanel = null;
106
    private JPanel pointSidePanel = null;
107
    private JPanel multiPointSidePanel = null;
108
    private JLabel widthLabel = null;
109
    private JPanel widthPanel = null;
110
    // private JPanel distanceUnits = null;
111
    private JPanel sidePanel = null;
112
    private JPanel optionsPanel = null;
113
    private AdaptedAcceptCancelPanel acceptCancelPanel = null;
114
    private FLyrVect[] layers;
115
    private MapControl mapControl;
116
    private IView view;
117
    private JCheckBox multiLayerSelectionCBox;
118
    private SideInfo outside, inside, out_in_side;
119

    
120
    /**
121
     * <p>
122
     * Creates a new form where user can define the option of the buffer.
123
     * </p>
124
     */
125
    public BufferConfigurationPanel(FLyrVect[] array, IView view) {
126
        super();
127

    
128
        layers = array;
129
        this.view = view;
130
        mapControl = view.getMapControl();
131

    
132
        initialize();
133
    }
134

    
135
    /**
136
     * <p>
137
     * Initializes this component.
138
     * </p>
139
     */
140
    private void initialize() {
141
        outside =
142
            new SideInfo(BufferSelectionProcess.BUFFER_OUTSIDE_POLY,
143
                PluginServices.getText(null, "Outside"));
144
        inside =
145
            new SideInfo(BufferSelectionProcess.BUFFER_INSIDE_POLY,
146
                PluginServices.getText(null, "Inside"));
147
        out_in_side =
148
            new SideInfo(BufferSelectionProcess.BUFFER_INSIDE_OUTSIDE_POLY,
149
                PluginServices.getText(null, "Both"));
150

    
151
        setLayout(new FlowLayout());
152
        add(getWidthPanel());
153
        add(getSidePanel());
154
        add(getOptionsPanel());
155
        add(getAdaptedAcceptCancelPanel());
156
    }
157

    
158
    private JPanel getOptionsPanel() {
159
        if (optionsPanel == null) {
160
            optionsPanel = new JPanel();
161
            optionsPanel.setLayout(new FlowLayout());
162
            optionsPanel.setPreferredSize(new Dimension(344, 80)); // 106));
163
            optionsPanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(optionsPanel,
164
                "Options")));
165
            optionsPanel.add(getMultiLayerSelectionCBox());
166
        }
167

    
168
        return optionsPanel;
169
    }
170

    
171
    private JCheckBox getMultiLayerSelectionCBox() {
172
        if (multiLayerSelectionCBox == null) {
173
            multiLayerSelectionCBox = new JCheckBox();
174
            multiLayerSelectionCBox.setPreferredSize(new Dimension(330, 22));
175
            multiLayerSelectionCBox.setText(PluginServices.getText(multiLayerSelectionCBox,
176
                "_MultiLayer_selection"));
177
            multiLayerSelectionCBox.setSelected(true);
178
            multiLayerSelectionCBox.setToolTipText(PluginServices.getText(null,
179
                "multiLayerSelection_checkbox_TOOLTIP_HTML_explanation"));
180
        }
181

    
182
        return multiLayerSelectionCBox;
183
    }
184

    
185
    private JPanel getWidthPanel() {
186
        if (widthPanel == null) {
187
            widthPanel = new JPanel();
188
            widthPanel.setPreferredSize(new Dimension(344, 55));
189
            widthPanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(widthPanel,
190
                "Width")));
191
            widthPanel.setLayout(new FlowLayout());
192
            widthPanel.add(getWidthLabel());
193
            widthPanel.add(getWidthText());
194
            widthPanel.add(getDistanceUnitsLabel());
195
            widthPanel.add(getDistanceUnitsCombo());
196
        }
197

    
198
        return widthPanel;
199
    }
200

    
201
    private JLabel getWidthLabel() {
202
        if (widthLabel == null) {
203
            widthLabel = new JLabel();
204
            widthLabel.setPreferredSize(new Dimension(68, 22));
205
            widthLabel.setText(PluginServices.getText(widthLabel, "Width"));
206
            widthLabel.setToolTipText(PluginServices.getText(null,
207
                "bufferWidth_TOOLTIP_HTML_explanation"));
208
        }
209

    
210
        return widthLabel;
211
    }
212

    
213
    private JTextField getWidthText() {
214
        if (distanceText == null) {
215
            /*
216
            DecimalFormat decimalFormat = new DecimalFormat();
217
            
218
            decimalFormat.setDecimalSeparatorAlwaysShown(true);
219
            decimalFormat.setMaximumIntegerDigits(12);
220
            decimalFormat.setMinimumIntegerDigits(1);
221
            decimalFormat.setMinimumFractionDigits(2);
222
            decimalFormat.setMaximumFractionDigits(4);
223
            
224
            decimalFormat.getDecimalFormatSymbols().setDecimalSeparator('.');
225

226
            NumberFormatter numberFormatter = new NumberFormatter();
227
            numberFormatter.setAllowsInvalid(false);
228
            numberFormatter.setOverwriteMode(false);
229
            numberFormatter.setCommitsOnValidEdit(true);
230
            numberFormatter.setMinimum(new Double(0));
231
            numberFormatter.setFormat(decimalFormat);
232
            */
233

    
234
            // numberFormatter.setFormat(new
235
            // DecimalFormat("([+]|[-])?[0-9]+([.][0-9]+)?"));
236

    
237
            distanceText = new JTextField();
238
            distanceText.setPreferredSize(new Dimension(85, 22));
239
            distanceText.setText("100");
240
        }
241

    
242
        return distanceText;
243
    }
244

    
245
    private JLabel getDistanceUnitsLabel() {
246
        if (distanceUnitsLabel == null) {
247
            distanceUnitsLabel =
248
                new JLabel(PluginServices.getText(distanceUnitsLabel, "Unit"));
249
            distanceUnitsLabel.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
250
            distanceUnitsLabel.setPreferredSize(new Dimension(68, 22));
251
            distanceUnitsLabel.setToolTipText(PluginServices.getText(null,
252
                "distanceUnitsLabel_TOOLTIP_HTML_explanation"));
253
        }
254

    
255
        return distanceUnitsLabel;
256
    }
257

    
258
    private JComboBox getDistanceUnitsCombo() {
259
        if (distanceUnitsCombo == null) {
260
            distanceUnitsCombo = new JComboBox();
261
            distanceUnitsCombo.setPreferredSize(new Dimension(85, 22));
262
            distanceUnitsCombo.addItem("km");
263
            distanceUnitsCombo.addItem("m");
264
            distanceUnitsCombo.addItem("cm");
265
            distanceUnitsCombo.addItem("mm");
266
            distanceUnitsCombo.addItem("mi");
267
            distanceUnitsCombo.addItem("Ya");
268
            distanceUnitsCombo.addItem("ft");
269
            distanceUnitsCombo.addItem("in");
270
            // distanceUnitsCombo.addItem("?");
271
            distanceUnitsCombo.setSelectedIndex(1); // By default in meters
272
            distanceUnitsCombo.setToolTipText(PluginServices.getText(null,
273
                "distanceUnitsLabel_TOOLTIP_HTML_explanation"));
274
        }
275

    
276
        return distanceUnitsCombo;
277
    }
278

    
279
    private JPanel getSidePanel() {
280
        if (sidePanel == null) {
281
            sidePanel = new JPanel();
282
            sidePanel.setLayout(new FlowLayout());
283
            sidePanel.setPreferredSize(new Dimension(344, 166));
284
            sidePanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(sidePanel,
285
                "Side")));
286
            sidePanel.setToolTipText(PluginServices.getText(null,
287
                "sideLabel_TOOLTIP_HTML_explanation"));
288
            sidePanel.add(getPolygonSidePanel());
289
            sidePanel.add(getLineSidePanel());
290
            sidePanel.add(getPointSidePanel());
291
            sidePanel.add(getMultiPointSidePanel());
292
        }
293

    
294
        return sidePanel;
295
    }
296

    
297
    private JPanel getPolygonSidePanel() {
298
        if (polygonSidePanel == null) {
299
            polygonSidePanel = new JPanel();
300
            polygonSidePanel.setPreferredSize(new Dimension(336, 28));
301
            polygonSidePanel.add(getPolygonSideLabel());
302
            polygonSidePanel.add(getPolygonSidesCombo());
303
        }
304

    
305
        return polygonSidePanel;
306
    }
307

    
308
    private JLabel getPolygonSideLabel() {
309
        if (polygonSideLabel == null) {
310
            polygonSideLabel =
311
                new JLabel(PluginServices.getText(polygonSideLabel, "Polygon"));
312
            polygonSideLabel.setPreferredSize(new Dimension(90, 22));
313
            polygonSideLabel.setToolTipText(PluginServices.getText(null,
314
                "polygonSideLabel_TOOLTIP_HTML_explanation"));
315
        }
316

    
317
        return polygonSideLabel;
318
    }
319

    
320
    private JComboBox getPolygonSidesCombo() {
321
        if (polygonSidesCombo == null) {
322
            polygonSidesCombo = new JComboBox();
323
            polygonSidesCombo.setPreferredSize(new Dimension(230, 22));
324
            polygonSidesCombo.addItem(outside);
325
            polygonSidesCombo.addItem(inside);
326
            // polygonSidesCombo.addItem(out_in_side); // Disabled because fails
327
            // quite often
328
            polygonSidesCombo.setToolTipText(PluginServices.getText(null,
329
                "polygonSideLabel_TOOLTIP_HTML_explanation"));
330
        }
331

    
332
        return polygonSidesCombo;
333
    }
334

    
335
    private JPanel getLineSidePanel() {
336
        if (lineSidePanel == null) {
337
            lineSidePanel = new JPanel();
338
            lineSidePanel.setPreferredSize(new Dimension(336, 28));
339
            lineSidePanel.add(getLineSideLabel());
340
            lineSidePanel.add(getLineSidesCombo());
341
        }
342

    
343
        return lineSidePanel;
344
    }
345

    
346
    private JLabel getLineSideLabel() {
347
        if (lineSideLabel == null) {
348
            lineSideLabel =
349
                new JLabel(PluginServices.getText(lineSideLabel, "Line"));
350
            lineSideLabel.setPreferredSize(new Dimension(90, 22));
351
            lineSideLabel.setToolTipText(PluginServices.getText(null,
352
                "lineSideLabel_TOOLTIP_HTML_explanation"));
353
        }
354

    
355
        return lineSideLabel;
356
    }
357

    
358
    private JComboBox getLineSidesCombo() {
359
        if (lineSidesCombo == null) {
360
            lineSidesCombo = new JComboBox();
361
            lineSidesCombo.setPreferredSize(new Dimension(230, 22));
362
            lineSidesCombo.addItem(outside);
363
            lineSidesCombo.setToolTipText(PluginServices.getText(null,
364
                "lineSideLabel_TOOLTIP_HTML_explanation"));
365
        }
366

    
367
        return lineSidesCombo;
368
    }
369

    
370
    private JPanel getPointSidePanel() {
371
        if (pointSidePanel == null) {
372
            pointSidePanel = new JPanel();
373
            pointSidePanel.setPreferredSize(new Dimension(336, 28));
374
            pointSidePanel.add(getPointSideLabel());
375
            pointSidePanel.add(getPointSidesCombo());
376
        }
377

    
378
        return pointSidePanel;
379
    }
380

    
381
    private JLabel getPointSideLabel() {
382
        if (pointSideLabel == null) {
383
            pointSideLabel =
384
                new JLabel(PluginServices.getText(pointSideLabel, "Point"));
385
            pointSideLabel.setPreferredSize(new Dimension(90, 22));
386
            pointSideLabel.setToolTipText(PluginServices.getText(null,
387
                "pointSideLabel_TOOLTIP_HTML_explanation"));
388
        }
389

    
390
        return pointSideLabel;
391
    }
392

    
393
    private JComboBox getPointSidesCombo() {
394
        if (pointSidesCombo == null) {
395
            pointSidesCombo = new JComboBox();
396
            pointSidesCombo.setPreferredSize(new Dimension(230, 22));
397
            pointSidesCombo.addItem(outside);
398
            pointSidesCombo.setToolTipText(PluginServices.getText(null,
399
                "pointSideLabel_TOOLTIP_HTML_explanation"));
400
        }
401

    
402
        return pointSidesCombo;
403
    }
404

    
405
    private JPanel getMultiPointSidePanel() {
406
        if (multiPointSidePanel == null) {
407
            multiPointSidePanel = new JPanel();
408
            multiPointSidePanel.setPreferredSize(new Dimension(336, 28));
409
            multiPointSidePanel.add(getMultiPointSideLabel());
410
            multiPointSidePanel.add(getMultiPointSidesCombo());
411
        }
412

    
413
        return multiPointSidePanel;
414
    }
415

    
416
    private JLabel getMultiPointSideLabel() {
417
        if (multiPointSideLabel == null) {
418
            multiPointSideLabel =
419
                new JLabel(PluginServices.getText(multiPointSideLabel,
420
                    "MultiPoint"));
421
            multiPointSideLabel.setPreferredSize(new Dimension(90, 22));
422
            multiPointSideLabel.setToolTipText(PluginServices.getText(null,
423
                "multiPointSideLabel_TOOLTIP_HTML_explanation"));
424
        }
425

    
426
        return multiPointSideLabel;
427
    }
428

    
429
    private JComboBox getMultiPointSidesCombo() {
430
        if (multiPointSidesCombo == null) {
431
            multiPointSidesCombo = new JComboBox();
432
            multiPointSidesCombo.setPreferredSize(new Dimension(230, 22));
433
            multiPointSidesCombo.addItem(outside);
434
            multiPointSidesCombo.setToolTipText(PluginServices.getText(null,
435
                "multiPointSideLabel_TOOLTIP_HTML_explanation"));
436
        }
437

    
438
        return multiPointSidesCombo;
439
    }
440

    
441
    /**
442
     * <p>
443
     * This method initializes acceptCancelPanel.
444
     * </p>
445
     * 
446
     * @return an adapted {@link AcceptCancelPanel AcceptCancelPanel}
447
     */
448
    private AdaptedAcceptCancelPanel getAdaptedAcceptCancelPanel() {
449
        if (acceptCancelPanel == null) {
450
            acceptCancelPanel = new AdaptedAcceptCancelPanel();
451
        }
452

    
453
        return acceptCancelPanel;
454
    }
455

    
456
    /*
457
     * (non-Javadoc)
458
     * 
459
     * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
460
     */
461
    public WindowInfo getWindowInfo() {
462
        if (viewInfo == null) {
463
            viewInfo = new WindowInfo(WindowInfo.MODALDIALOG);
464
            viewInfo.setTitle(
465
                Messages.getText("Select_by_buffer"));
466
            viewInfo.setWidth(Window_Width);
467
            viewInfo.setHeight(Window_Height);
468
        }
469

    
470
        return viewInfo;
471
    }
472

    
473
    /**
474
     * <p>
475
     * Adapts {@link AcceptCancelPanel AcceptCancelPanel} to be used as a
476
     * component of the <code>BufferConfigurationPanel</code> panel.
477
     * </p>
478
     * 
479
     * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
480
     */
481
    private class AdaptedAcceptCancelPanel extends AcceptCancelPanel {
482

    
483
        public AdaptedAcceptCancelPanel() {
484
            super();
485

    
486
            addOkButtonActionListener(getOKAction());
487
            addCancelButtonActionListener(getCancelAction());
488
            setPreferredSize(new Dimension(350, 30));
489
        }
490

    
491
        /**
492
         * <p>
493
         * Create the action that will be executed when user pressed the
494
         * <i>ok</i> button.
495
         * </p>
496
         * 
497
         * @return action that will be executed when user pressed the
498
         *         <i>cancel</i>
499
         *         button
500
         */
501
        private ActionListener getOKAction() {
502
            // OK button action
503
            return new ActionListener() {
504

    
505
                /*
506
                 * @see
507
                 * java.awt.event.ActionListener#actionPerformed(java.awt.event
508
                 * .ActionEvent)
509
                 */
510
                public void actionPerformed(ActionEvent e) {
511

    
512
                    /* 1- Validates the buffer width */
513
                    double width;
514

    
515
                    try {
516
                        width = Double.parseDouble(getWidthText().getText());
517
                        /*
518
                                .replaceAll("(\\.)?", "")
519
                                .replace(",", ".")); // Formats the decimal
520
                                                     // number to be parsed
521
                                                      * 
522
                                                      */
523
                    } catch (Exception ex) {
524
                        
525
                        JOptionPane.showMessageDialog(
526
                            ApplicationLocator.getManager().getRootComponent(),
527
                            Messages.getText("_Invalid_width_value")
528
                            + " : \"" + getWidthText().getText() + "\"",
529
                            Messages.getText("Select_by_buffer"),
530
                            JOptionPane.WARNING_MESSAGE);
531
                        return;
532
                    }
533
                    
534
                    /* 2- Closes this window */
535
                    closeThis();
536

    
537

    
538
                    /* 3- Creates the process */
539
                    // checks layers to proccess if multilayer is not selected
540
                    ArrayList<FLyrVect> tmpLayersToProccess =
541
                        new ArrayList<FLyrVect>(layers.length);
542
                    tmpLayersToProccess.addAll(Arrays.asList(layers));
543
                    if (!multiLayerSelectionCBox.isSelected()) {
544
                        Iterator<FLyrVect> iter =
545
                            tmpLayersToProccess.iterator();
546
                        FLyrVect curLayer;
547
                        while (iter.hasNext()) {
548
                            curLayer = (FLyrVect) iter.next();
549
                            try {
550
                                if (curLayer.getFeatureStore()
551
                                    .getFeatureSelection()
552
                                    .isEmpty()) {
553
                                    iter.remove();
554
                                }
555
                            } catch (DataException e1) {
556
                                NotificationManager.showMessageError(PluginServices.getText(null,
557
                                    "Failed_selecting_layer"),
558
                                    e1);
559
                                return;
560

    
561
                            }
562
                        }
563
                    }
564
                    FLyrVect[] layersToProcess =
565
                        (FLyrVect[]) tmpLayersToProccess.toArray(new FLyrVect[tmpLayersToProccess.size()]);
566

    
567
                    BufferSelectionProcess iprocess =
568
                        new BufferSelectionProcess(PluginServices.getText(this,
569
                            "Select_by_buffer"),
570
                            PluginServices.getText(this,
571
                                "Ongoing_process_please_wait"),
572
                            mapControl,
573
                            ((SideInfo) getPolygonSidesCombo().getSelectedItem()).getSide(),
574
                            ((SideInfo) getLineSidesCombo().getSelectedItem()).getSide(),
575
                            ((SideInfo) getPointSidesCombo().getSelectedItem()).getSide(),
576
                            ((SideInfo) getMultiPointSidesCombo().getSelectedItem()).getSide(),
577
                            width,
578
                            (short) getDistanceUnitsCombo().getSelectedIndex(),
579
                            layersToProcess,
580
                            getMultiLayerSelectionCBox().isSelected());// getAddBufferLayersCBox().isSelected(),
581
                                                                       // getAddInfluenceAreaLayersCBox().isSelected(),
582
                                                                       // getMultiLayerSelectionCBox().isSelected());
583
                    IncrementableTask iTask =
584
                        new IncrementableTask(iprocess,
585
                            new ProgressPanel(false));
586
                    iTask.addIncrementableListener(iprocess);
587
                    iprocess.setIncrementableTask(iTask);
588

    
589
                    iTask.getProgressPanel()
590
                        .addComponentListener(new ComponentAdapter() {
591
                            public void componentHidden(ComponentEvent e) {
592
                                mapControl.getMapContext().invalidate();
593
                            }
594
                        });
595

    
596
                    /* 4- Starts the process */
597
                    iprocess.start();
598
                    iTask.start();
599
                }
600
            };
601
        }
602

    
603
        /**
604
         * <p>
605
         * Create the action that will be executed when user pressed the
606
         * <i>cancel</i> button.
607
         * </p>
608
         * 
609
         * @return action that will be executed when user pressed the
610
         *         <i>cancel</i>
611
         *         button
612
         */
613
        private ActionListener getCancelAction() {
614
            // Cancel button action
615
            return new ActionListener() {
616

    
617
                /*
618
                 * @see
619
                 * java.awt.event.ActionListener#actionPerformed(java.awt.event
620
                 * .ActionEvent)
621
                 */
622
                public void actionPerformed(ActionEvent e) {
623
                    closeThis();
624
                }
625
            };
626
        }
627
    }
628

    
629
    /**
630
     * <p>
631
     * Closes this window.
632
     * </p>
633
     */
634
    private void closeThis() {
635
        PluginServices.getMDIManager().closeWindow(this);
636
    }
637

    
638
    /**
639
     * 
640
     * 
641
     * 
642
     * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
643
     */
644
    private class SideInfo {
645

    
646
        private byte side;
647
        private String name;
648

    
649
        public SideInfo(byte side, String name) {
650
            this.side = side;
651
            this.name = name;
652
        }
653

    
654
        public String toString() {
655
            return name;
656
        }
657

    
658
        public String getName() {
659
            return name;
660
        }
661

    
662
        public byte getSide() {
663
            return side;
664
        }
665
    }
666

    
667
    public Object getWindowProfile() {
668
        return WindowInfo.DIALOG_PROFILE;
669
    }
670
}