Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extPublishMapserver / src / org / gvsig / publish / mapserver / gui / preferences / MapserverPreferencesPage.java @ 32205

History | View | Annotate | Download (3.87 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.publish.mapserver.gui.preferences;
42

    
43
import java.awt.Component;
44

    
45
import javax.swing.ImageIcon;
46
import javax.swing.JOptionPane;
47
import javax.swing.JPanel;
48

    
49
import org.gvsig.publish.PublishLogger;
50

    
51
import com.iver.andami.PluginServices;
52
import com.iver.andami.messages.NotificationManager;
53
import com.iver.andami.preferences.AbstractPreferencePage;
54
import com.iver.andami.preferences.StoreException;
55
import com.iver.utiles.swing.JComboBox;
56
/**
57
 * Mapserver preferences panel.
58
 * 
59
 * @author jvhigon
60
 *
61
 */
62
public class MapserverPreferencesPage extends AbstractPreferencePage {
63
        /**
64
         * 
65
         */
66
        private static final long serialVersionUID = 2738440296945968471L;
67

    
68
        //GUI components
69
        private JComboBox comboViews=null;
70
        //Attributes
71
        private String id;
72
        private MapserverPersistence persistence = null;
73
        /**
74
         * constructor
75
         */
76
        public MapserverPreferencesPage() {
77
                super();
78
                persistence = new MapserverPersistence();
79
                this.id = getClass().getName();
80
                addComponent(PluginServices.getText(this, "publishms_publish_view") + ":",
81
                                getViewsCombo());
82
        }
83

    
84
        private Component getViewsCombo() {
85
                if (comboViews == null){
86
                        comboViews = new JComboBox();
87
                }                
88
                comboViews.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Wizard", "Tree"}));
89
                add(comboViews, new java.awt.GridBagConstraints());
90
                return comboViews;
91
        }
92

    
93
        /*
94
         * (non-Javadoc)
95
         * @see com.iver.andami.preferences.AbstractPreferencePage#setChangesApplied()
96
         */
97
        public void setChangesApplied() {
98
                persistence.setGUIControllerType(comboViews.getSelectedIndex());
99
        }
100

    
101
        /*
102
         * (non-Javadoc)
103
         * @see com.iver.andami.preferences.AbstractPreferencePage#storeValues()
104
         */
105
        public void storeValues() throws StoreException {
106
                persistence.setGUIControllerType(comboViews.getSelectedIndex());                
107
        }
108

    
109
        public String getID() {                
110
                return id;
111
        }
112

    
113
        public ImageIcon getIcon() {
114
                ImageIcon icon = null;
115
                try {
116
                        icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/mapserver-logo.png"));                        
117
                }catch( java.lang.NullPointerException e){
118
                        PublishLogger.getLog().error("ERROR " + getClass().getName() + ":Error loading icons", e);
119
                }
120
                return icon;
121
        }
122

    
123
        public JPanel getPanel() {
124
                return this;
125
        }
126

    
127
        public String getTitle() {
128
                
129
                return PluginServices.getText(this, "publishms_publish_mapserver");
130
        }
131

    
132
        public void initializeDefaults() {                
133
                comboViews.setSelectedIndex(0);
134
        }
135
        /*
136
         * (non-Javadoc)
137
         * @see com.iver.andami.preferences.IPreference#initializeValues()
138
         */
139
        public void initializeValues() {                
140
                comboViews.setSelectedIndex(persistence.getGUIControllerType());                
141
        }
142

    
143
        public boolean isValueChanged() {
144
                NotificationManager.showMessageInfo(PluginServices.getText(this,"publishms_restart"), null);
145
                return true;
146
        }
147

    
148
}