svn-gvsig-desktop / branches / v2_0_0_prep / libraries / org.gvsig.newlayer / org.gvsig.newlayer.lib / org.gvsig.newlayer.lib.impl / src / main / java / org / gvsig / newlayer / impl / AddNewLayerQuestionPanel.java @ 37333
History | View | Annotate | Download (1.72 KB)
1 | 36220 | fdiaz | package org.gvsig.newlayer.impl; |
---|---|---|---|
2 | |||
3 | import java.awt.BorderLayout; |
||
4 | |||
5 | import javax.swing.JCheckBox; |
||
6 | import javax.swing.JList; |
||
7 | import javax.swing.JOptionPane; |
||
8 | import javax.swing.JPanel; |
||
9 | import javax.swing.JScrollPane; |
||
10 | import javax.swing.ListModel; |
||
11 | import javax.swing.event.ListSelectionEvent; |
||
12 | import javax.swing.event.ListSelectionListener; |
||
13 | |||
14 | import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
||
15 | import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
||
16 | import org.gvsig.i18n.Messages; |
||
17 | import org.gvsig.newlayer.NewLayerService; |
||
18 | import org.gvsig.newlayer.NewLayerWizard; |
||
19 | |||
20 | public class AddNewLayerQuestionPanel extends JPanel implements OptionPanel{ |
||
21 | |||
22 | private NewLayerWizard wizard;
|
||
23 | private JCheckBox questionCheckBox = null; |
||
24 | |||
25 | public AddNewLayerQuestionPanel(NewLayerWizard wizard){
|
||
26 | this.wizard = wizard;
|
||
27 | initializeComponents(); |
||
28 | } |
||
29 | |||
30 | public String getPanelTitle() { |
||
31 | return "Add layer question panel"; |
||
32 | } |
||
33 | |||
34 | public void nextPanel() throws NotContinueWizardException { |
||
35 | getService().addLayerToView(getAddLayerToView()); |
||
36 | } |
||
37 | |||
38 | public void lastPanel() { |
||
39 | // do nothing
|
||
40 | |||
41 | } |
||
42 | |||
43 | public void updatePanel() { |
||
44 | initializeComponents(); |
||
45 | } |
||
46 | |||
47 | public JPanel getJPanel() { |
||
48 | return this; |
||
49 | } |
||
50 | |||
51 | private void initializeComponents() { |
||
52 | this.setLayout(new BorderLayout()); |
||
53 | this.add(getQuestionCheckBox(), BorderLayout.CENTER); |
||
54 | } |
||
55 | |||
56 | private JCheckBox getQuestionCheckBox(){ |
||
57 | if (this.questionCheckBox == null){ |
||
58 | this.questionCheckBox = new JCheckBox(Messages.getText("add_layer_to_view_question"), true); |
||
59 | } |
||
60 | return this.questionCheckBox; |
||
61 | } |
||
62 | |||
63 | private NewLayerService getService() {
|
||
64 | return this.wizard.getService(); |
||
65 | } |
||
66 | |||
67 | public boolean getAddLayerToView(){ |
||
68 | return getQuestionCheckBox().isSelected();
|
||
69 | } |
||
70 | } |