svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.newlayer / org.gvsig.newlayer.lib / org.gvsig.newlayer.lib.impl / src / main / java / org / gvsig / newlayer / impl / AddNewLayerQuestionPanel.java @ 40560
History | View | Annotate | Download (2.52 KB)
1 | 40560 | jjdelcerro | /**
|
---|---|---|---|
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 | 40435 | jjdelcerro | package org.gvsig.newlayer.impl; |
25 | |||
26 | import java.awt.BorderLayout; |
||
27 | |||
28 | import javax.swing.JCheckBox; |
||
29 | import javax.swing.JPanel; |
||
30 | |||
31 | import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
||
32 | import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
||
33 | import org.gvsig.i18n.Messages; |
||
34 | import org.gvsig.newlayer.NewLayerService; |
||
35 | import org.gvsig.newlayer.NewLayerWizard; |
||
36 | |||
37 | public class AddNewLayerQuestionPanel extends JPanel implements OptionPanel{ |
||
38 | |||
39 | private static final long serialVersionUID = -5251910576017225307L; |
||
40 | private NewLayerWizard wizard;
|
||
41 | private JCheckBox questionCheckBox = null; |
||
42 | |||
43 | public AddNewLayerQuestionPanel(NewLayerWizard wizard){
|
||
44 | this.wizard = wizard;
|
||
45 | initializeComponents(); |
||
46 | } |
||
47 | |||
48 | public String getPanelTitle() { |
||
49 | return "Add layer question panel"; |
||
50 | } |
||
51 | |||
52 | public void nextPanel() throws NotContinueWizardException { |
||
53 | getService().addLayerToView(getAddLayerToView()); |
||
54 | } |
||
55 | |||
56 | public void lastPanel() { |
||
57 | // do nothing
|
||
58 | |||
59 | } |
||
60 | |||
61 | public void updatePanel() { |
||
62 | initializeComponents(); |
||
63 | } |
||
64 | |||
65 | public JPanel getJPanel() { |
||
66 | return this; |
||
67 | } |
||
68 | |||
69 | private void initializeComponents() { |
||
70 | this.setLayout(new BorderLayout()); |
||
71 | this.add(getQuestionCheckBox(), BorderLayout.CENTER); |
||
72 | } |
||
73 | |||
74 | private JCheckBox getQuestionCheckBox(){ |
||
75 | if (this.questionCheckBox == null){ |
||
76 | this.questionCheckBox = new JCheckBox(Messages.getText("add_layer_to_view_question"), true); |
||
77 | } |
||
78 | return this.questionCheckBox; |
||
79 | } |
||
80 | |||
81 | private NewLayerService getService() {
|
||
82 | return this.wizard.getService(); |
||
83 | } |
||
84 | |||
85 | public boolean getAddLayerToView(){ |
||
86 | return getQuestionCheckBox().isSelected();
|
||
87 | } |
||
88 | } |