Statistics
| Revision:

root / 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 @ 37891

History | View | Annotate | Download (1.58 KB)

1
package org.gvsig.newlayer.impl;
2

    
3
import java.awt.BorderLayout;
4

    
5
import javax.swing.JCheckBox;
6
import javax.swing.JPanel;
7

    
8
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException;
9
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
10
import org.gvsig.i18n.Messages;
11
import org.gvsig.newlayer.NewLayerService;
12
import org.gvsig.newlayer.NewLayerWizard;
13

    
14
public class AddNewLayerQuestionPanel extends JPanel implements OptionPanel{
15
        
16
    private static final long serialVersionUID = -5251910576017225307L;
17
    private NewLayerWizard wizard;
18
        private JCheckBox questionCheckBox = null;
19
        
20
        public AddNewLayerQuestionPanel(NewLayerWizard wizard){
21
                this.wizard = wizard;
22
                initializeComponents();
23
        }
24

    
25
        public String getPanelTitle() {
26
                return "Add layer question panel";
27
        }
28

    
29
        public void nextPanel() throws NotContinueWizardException {
30
                getService().addLayerToView(getAddLayerToView());
31
        }
32

    
33
        public void lastPanel() {
34
                // do nothing
35
                
36
        }
37

    
38
        public void updatePanel() {
39
                initializeComponents();
40
        }
41

    
42
        public JPanel getJPanel() {
43
                return this;
44
        }
45

    
46
    private void initializeComponents() {
47
        this.setLayout(new BorderLayout());
48
        this.add(getQuestionCheckBox(), BorderLayout.CENTER);        
49
    }
50
    
51
    private JCheckBox getQuestionCheckBox(){
52
            if (this.questionCheckBox == null){
53
                    this.questionCheckBox = new JCheckBox(Messages.getText("add_layer_to_view_question"), true);
54
            }
55
            return this.questionCheckBox;
56
    }
57

    
58
        private NewLayerService getService() {
59
                return this.wizard.getService();
60
        } 
61
        
62
        public boolean getAddLayerToView(){
63
                return getQuestionCheckBox().isSelected();
64
        }
65
}