Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublishGeoserver / src / org / gvsig / publish / geoserver / gui / GSFeatureResourceAdvancedPanel.java @ 19432

History | View | Annotate | Download (5.89 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.geoserver.gui;
42

    
43
import java.util.EventListener;
44

    
45
import javax.swing.JPanel;
46

    
47
import org.gvsig.publish.geoserver.model.GSFeatureResource;
48
import org.gvsig.publish.gui.publish.IPublishPluginPanel;
49

    
50
public class GSFeatureResourceAdvancedPanel extends JPanel implements
51
                IPublishPluginPanel {
52
        //Associations
53
        private GSFeatureResource model;
54
        
55
        /**
56
         * Default constructor
57
         */
58
        public GSFeatureResourceAdvancedPanel() {
59
                super();
60
                initComponents();
61
                initLabels();
62
        }
63
        /**
64
         * Initializes labels for multi-language
65
         */
66
        private void initLabels() {
67
                // TODO Auto-generated method stub
68
                
69
        }
70
        
71
    private void initComponents() {
72
        java.awt.GridBagConstraints gridBagConstraints;
73

    
74
        cacheCheck = new javax.swing.JCheckBox();
75
        cacheSpinner = new javax.swing.JSpinner();
76
        nsLabel = new javax.swing.JLabel();
77
        nsText = new javax.swing.JTextField();
78
        jSeparator1 = new javax.swing.JSeparator();
79
        infoLabel = new javax.swing.JLabel();
80

    
81
        setLayout(new java.awt.GridBagLayout());
82

    
83
        cacheCheck.setSelected(true);
84
        cacheCheck.setText("is_cached");
85
        cacheCheck.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
86
        gridBagConstraints = new java.awt.GridBagConstraints();
87
        gridBagConstraints.gridx = 1;
88
        gridBagConstraints.gridy = 2;
89
        gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
90
        add(cacheCheck, gridBagConstraints);
91

    
92
        cacheSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(3600), null, null, Integer.valueOf(1)));
93
        gridBagConstraints = new java.awt.GridBagConstraints();
94
        gridBagConstraints.gridx = 2;
95
        gridBagConstraints.gridy = 2;
96
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
97
        gridBagConstraints.weightx = 1.0;
98
        gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 5);
99
        add(cacheSpinner, gridBagConstraints);
100

    
101
        nsLabel.setText("namespace");
102
        gridBagConstraints = new java.awt.GridBagConstraints();
103
        gridBagConstraints.gridx = 1;
104
        gridBagConstraints.gridy = 1;
105
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 2);
106
        add(nsLabel, gridBagConstraints);
107

    
108
        nsText.setEditable(false);
109
        gridBagConstraints = new java.awt.GridBagConstraints();
110
        gridBagConstraints.gridx = 2;
111
        gridBagConstraints.gridy = 1;
112
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
113
        gridBagConstraints.weightx = 1.0;
114
        add(nsText, gridBagConstraints);
115
        gridBagConstraints = new java.awt.GridBagConstraints();
116
        gridBagConstraints.gridx = 1;
117
        gridBagConstraints.gridy = 0;
118
        gridBagConstraints.gridwidth = 2;
119
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
120
        gridBagConstraints.weightx = 1.0;
121
        add(jSeparator1, gridBagConstraints);
122

    
123
        infoLabel.setFont(new java.awt.Font("Dialog", 1, 11));
124
        infoLabel.setText("advanced");
125
        gridBagConstraints = new java.awt.GridBagConstraints();
126
        gridBagConstraints.gridx = 0;
127
        gridBagConstraints.gridy = 0;
128
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
129
        add(infoLabel, gridBagConstraints);
130
    }// </editor-fold>
131
    
132
    
133
    // Variables declaration - do not modify
134
    private javax.swing.JCheckBox cacheCheck;
135
    private javax.swing.JSpinner cacheSpinner;
136
    private javax.swing.JLabel infoLabel;
137
    private javax.swing.JSeparator jSeparator1;
138
    private javax.swing.JLabel nsLabel;
139
    private javax.swing.JTextField nsText;
140
    // End of variables declaration
141
            
142
        /*
143
         * (non-Javadoc)
144
         * @see org.gvsig.publish.gui.publish.IPublishPluginPanel#getModel()
145
         */
146
        public Object getModel() {
147
                //model.getConfig().setOgcMetadata((CommonOGCMetadata)commonOgc.getModel());
148
                model.getConfig().setCacheEnabled(cacheCheck.isSelected());
149
                model.getConfig().setCacheMaxage(new Integer(cacheSpinner.getModel().getValue().toString()).intValue());
150
                model.getConfig().getNamespace().setPrefix(nsText.getText());
151
                return model;
152
        }
153
        /*
154
         * (non-Javadoc)
155
         * @see org.gvsig.publish.gui.publish.IPublishPluginPanel#setListener(java.util.EventListener)
156
         */
157
        public void setListener(EventListener listener) {
158
                // TODO Auto-generated method stub
159

    
160
        }
161
        /*
162
         * (non-Javadoc)
163
         * @see org.gvsig.publish.gui.publish.IPublishPluginPanel#setModel(java.lang.Object)
164
         */
165
        public void setModel(Object entityModel) {
166
                // cast to geoserver feature remote resource
167
                model = (GSFeatureResource)entityModel;
168
                cacheCheck.setSelected(model.getConfig().isCacheEnabled());
169
                cacheSpinner.getModel().setValue(new Integer(model.getConfig().getCacheMaxage()));
170
                nsText.setText(model.getConfig().getNamespace().getPrefix());
171
        }
172

    
173
}