Revision 19432
branches/v10/extensions/extPublishGeoserver/src-test/org/gvsig/publish/geoserver/model/GeoserverTest.java | ||
---|---|---|
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.model; |
|
42 |
|
|
43 |
import org.gvsig.publish.serversmodel.Server; |
|
44 |
import org.gvsig.publish.serversmodel.ServerTest; |
|
45 |
|
|
46 |
public class GeoserverTest extends ServerTest { |
|
47 |
private Server server=null; |
|
48 |
|
|
49 |
public GeoserverTest() { |
|
50 |
super(); |
|
51 |
server = new Geoserver(); |
|
52 |
server.setTitle("Geoserver Title"); |
|
53 |
} |
|
54 |
/** |
|
55 |
* creates a new server in order to be uses by ServerTest |
|
56 |
*/ |
|
57 |
public Server getServer() { |
|
58 |
return server; |
|
59 |
} |
|
60 |
|
|
61 |
} |
branches/v10/extensions/extPublishGeoserver/src-test/org/gvsig/publish/geoserver/gui/Test_GeoserverGUI.java | ||
---|---|---|
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 |
import java.net.MalformedURLException; |
|
43 |
import java.net.URL; |
|
44 |
|
|
45 |
import javax.swing.JFrame; |
|
46 |
|
|
47 |
import org.gvsig.publish.PublishRegister; |
|
48 |
import org.gvsig.publish.geoserver.model.GSWFSService; |
|
49 |
import org.gvsig.publish.geoserver.model.GSFeatureResource; |
|
50 |
import org.gvsig.publish.geoserver.model.Geoserver; |
|
51 |
import org.gvsig.publish.gui.publish.PublishController; |
|
52 |
import org.gvsig.publish.serversmodel.Publication; |
|
53 |
import org.gvsig.publish.serversmodel.RemoteResource; |
|
54 |
import org.gvsig.publish.serversmodel.Server; |
|
55 |
import org.gvsig.publish.serversmodel.Service; |
|
56 |
/** |
|
57 |
* Tests the Mapserver GUI |
|
58 |
* |
|
59 |
* @author jvhigon |
|
60 |
* |
|
61 |
*/ |
|
62 |
public class Test_GeoserverGUI{ |
|
63 |
static public PublishController ctrl = null; |
|
64 |
static public Publication publication=null; |
|
65 |
static public Server server=null; |
|
66 |
static public Service service=null; |
|
67 |
static public RemoteResource rr=null; |
|
68 |
|
|
69 |
public static void main(String[] args) { |
|
70 |
//Schedule a job for the event-dispatching thread: |
|
71 |
//creating and showing this application's GUI. |
|
72 |
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
|
73 |
public void run() { |
|
74 |
createModel(); |
|
75 |
createController(); |
|
76 |
registerController(); |
|
77 |
showGUI(); |
|
78 |
} |
|
79 |
}); |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
private static void createModel(){ |
|
84 |
publication = new Publication(); |
|
85 |
server = new Geoserver(); |
|
86 |
try { |
|
87 |
server.setServerURL(new URL("http://localhost:8080/geoserver")); |
|
88 |
} catch (MalformedURLException e) { |
|
89 |
e.printStackTrace(); |
|
90 |
} |
|
91 |
publication.setServer(server); |
|
92 |
service = new GSWFSService((Geoserver)server); |
|
93 |
server.addService(service); |
|
94 |
rr = new GSFeatureResource((GSWFSService)service); |
|
95 |
rr.setName("test"); |
|
96 |
service.addRemoteResource(rr); |
|
97 |
} |
|
98 |
private static void createController(){ |
|
99 |
ctrl = new PublishController(); |
|
100 |
ctrl.setPublication(publication); |
|
101 |
|
|
102 |
} |
|
103 |
private static void registerController(){ |
|
104 |
//register controller |
|
105 |
PublishRegister.register().addController(Geoserver.REGISTER_TAG, GeoserverController.class); |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
private static void showGUI(){ |
|
110 |
//Create and set up the window. |
|
111 |
JFrame frame = new JFrame("Testing Geoserver GUI"); |
|
112 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
113 |
//Add the publish panel |
|
114 |
frame.getContentPane().add(ctrl.getWindow()); |
|
115 |
//Display the window. |
|
116 |
frame.pack(); |
|
117 |
frame.setVisible(true); |
|
118 |
|
|
119 |
} |
|
120 |
|
|
121 |
} |
branches/v10/extensions/extPublishGeoserver/config/text.properties | ||
---|---|---|
1 |
malformed_url=URL incorrecta |
branches/v10/extensions/extPublishGeoserver/config/text_en.properties | ||
---|---|---|
1 |
malformed_url=Malformed URL |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GSWFSBasicPanel.java | ||
---|---|---|
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.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
import java.util.EventListener; |
|
46 |
|
|
47 |
import javax.swing.JOptionPane; |
|
48 |
import javax.swing.JPanel; |
|
49 |
|
|
50 |
import org.gvsig.publish.PublishExtension; |
|
51 |
import org.gvsig.publish.PublishLogger; |
|
52 |
import org.gvsig.publish.geoserver.conf.GSWFS; |
|
53 |
import org.gvsig.publish.geoserver.model.GSWFSService; |
|
54 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
55 |
import org.gvsig.publish.ogcmetadata.CommonOGCMetadata; |
|
56 |
import org.gvsig.publish.serversmodel.Service; |
|
57 |
|
|
58 |
public class GSWFSBasicPanel extends JPanel implements |
|
59 |
IPublishPluginPanel { |
|
60 |
//Associations |
|
61 |
private GSWFSService model=null; |
|
62 |
/** |
|
63 |
* Default constructor |
|
64 |
*/ |
|
65 |
public GSWFSBasicPanel() { |
|
66 |
super(); |
|
67 |
initComponents(); |
|
68 |
initLabels(); |
|
69 |
initIcons(); |
|
70 |
} |
|
71 |
/** |
|
72 |
* Initialize icons |
|
73 |
*/ |
|
74 |
private void initIcons() { |
|
75 |
//wfs logo |
|
76 |
try { |
|
77 |
icon.setIcon(new javax.swing.ImageIcon(PublishExtension.class.getClassLoader().getResource("images/publish-wfs10.gif"))); |
|
78 |
}catch( java.lang.NullPointerException e){ |
|
79 |
PublishLogger.getLog().error("ERROR " + getClass().getName() + ":Error loading icons", e); |
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
} |
|
84 |
/** |
|
85 |
* Initializes labels for multi-language |
|
86 |
*/ |
|
87 |
private void initLabels() { |
|
88 |
// TODO Auto-generated method stub |
|
89 |
|
|
90 |
} |
|
91 |
private void initComponents() { |
|
92 |
java.awt.GridBagConstraints gridBagConstraints; |
|
93 |
|
|
94 |
commonOgc = new org.gvsig.publish.gui.ogcMetadata.CommonOGCMetadataPanel(); |
|
95 |
urlLabel = new javax.swing.JLabel(); |
|
96 |
urlText = new javax.swing.JTextField(); |
|
97 |
jSeparator1 = new javax.swing.JSeparator(); |
|
98 |
icon = new javax.swing.JLabel(); |
|
99 |
infoLabel = new javax.swing.JLabel(); |
|
100 |
|
|
101 |
setLayout(new java.awt.GridBagLayout()); |
|
102 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
103 |
gridBagConstraints.gridx = 1; |
|
104 |
gridBagConstraints.gridy = 3; |
|
105 |
gridBagConstraints.gridwidth = 2; |
|
106 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
107 |
gridBagConstraints.weightx = 1.0; |
|
108 |
gridBagConstraints.weighty = 1.0; |
|
109 |
add(commonOgc, gridBagConstraints); |
|
110 |
|
|
111 |
urlLabel.setText("url"); |
|
112 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
113 |
gridBagConstraints.gridx = 1; |
|
114 |
gridBagConstraints.gridy = 2; |
|
115 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 2); |
|
116 |
add(urlLabel, gridBagConstraints); |
|
117 |
|
|
118 |
urlText.setEditable(false); |
|
119 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
120 |
gridBagConstraints.gridx = 2; |
|
121 |
gridBagConstraints.gridy = 2; |
|
122 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
123 |
gridBagConstraints.weightx = 1.0; |
|
124 |
gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 5); |
|
125 |
add(urlText, gridBagConstraints); |
|
126 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
127 |
gridBagConstraints.gridx = 1; |
|
128 |
gridBagConstraints.gridy = 1; |
|
129 |
gridBagConstraints.gridwidth = 2; |
|
130 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
131 |
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); |
|
132 |
add(jSeparator1, gridBagConstraints); |
|
133 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
134 |
gridBagConstraints.gridx = 0; |
|
135 |
gridBagConstraints.gridy = 0; |
|
136 |
add(icon, gridBagConstraints); |
|
137 |
|
|
138 |
infoLabel.setFont(new java.awt.Font("Dialog", 1, 11)); |
|
139 |
infoLabel.setText("basic_info"); |
|
140 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
141 |
gridBagConstraints.gridx = 0; |
|
142 |
gridBagConstraints.gridy = 1; |
|
143 |
add(infoLabel, gridBagConstraints); |
|
144 |
}// </editor-fold> |
|
145 |
|
|
146 |
|
|
147 |
// Variables declaration - do not modify |
|
148 |
private org.gvsig.publish.gui.ogcMetadata.CommonOGCMetadataPanel commonOgc; |
|
149 |
private javax.swing.JLabel icon; |
|
150 |
private javax.swing.JLabel infoLabel; |
|
151 |
private javax.swing.JSeparator jSeparator1; |
|
152 |
private javax.swing.JLabel urlLabel; |
|
153 |
private javax.swing.JTextField urlText; |
|
154 |
// End of variables declaration |
|
155 |
|
|
156 |
public Object getModel() { |
|
157 |
try { |
|
158 |
model.getConfig().setOnlineResource(new URL(urlText.getText())); |
|
159 |
} catch (MalformedURLException e) { |
|
160 |
JOptionPane.showMessageDialog(this, |
|
161 |
"malformed_url", |
|
162 |
"malformed_url", |
|
163 |
JOptionPane.ERROR_MESSAGE); |
|
164 |
} |
|
165 |
model.setOgcMetadata((CommonOGCMetadata)commonOgc.getModel()); |
|
166 |
return model; |
|
167 |
} |
|
168 |
|
|
169 |
public void setListener(EventListener listener) { |
|
170 |
// TODO Auto-generated method stub |
|
171 |
|
|
172 |
} |
|
173 |
/** |
|
174 |
* Fill the GUI with the model |
|
175 |
*/ |
|
176 |
public void setModel(Object entityModel) { |
|
177 |
// cast to geoserverwfs |
|
178 |
model = (GSWFSService)entityModel; |
|
179 |
urlText.setText(model.getConfig().getOnlineResource().toString()); |
|
180 |
commonOgc.setModel(model.getOgcMetadata()); |
|
181 |
} |
|
182 |
|
|
183 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GSFileChooser.java | ||
---|---|---|
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 javax.swing.JFileChooser; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
47 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
48 |
/** |
|
49 |
* File chooser for geoserver config directory |
|
50 |
* @author jvhigon |
|
51 |
* |
|
52 |
*/ |
|
53 |
public class GSFileChooser extends JFileChooser implements IWindow { |
|
54 |
private WindowInfo mWindowInfo = null; |
|
55 |
/** |
|
56 |
* default constructor |
|
57 |
*/ |
|
58 |
public GSFileChooser() { |
|
59 |
setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
|
60 |
} |
|
61 |
/** |
|
62 |
* @return information about the window. Needed by gvSIG |
|
63 |
*/ |
|
64 |
public WindowInfo getWindowInfo() { |
|
65 |
if (mWindowInfo == null){ |
|
66 |
//mWindowInfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE); |
|
67 |
mWindowInfo=new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE); |
|
68 |
mWindowInfo.setTitle(PluginServices.getText(this,"mapfile_chooser_window")); |
|
69 |
mWindowInfo.setHeight(100); |
|
70 |
mWindowInfo.setWidth(200); |
|
71 |
} |
|
72 |
return mWindowInfo; |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GSFeatureResourceBasicPanel.java | ||
---|---|---|
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.conf.GSService; |
|
48 |
import org.gvsig.publish.geoserver.model.GSFeatureResource; |
|
49 |
import org.gvsig.publish.geoserver.model.GSWFSService; |
|
50 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
51 |
import org.gvsig.publish.ogcmetadata.CommonOGCMetadata; |
|
52 |
|
|
53 |
public class GSFeatureResourceBasicPanel extends JPanel implements |
|
54 |
IPublishPluginPanel { |
|
55 |
//Associations |
|
56 |
private GSFeatureResource model; |
|
57 |
/** |
|
58 |
* Default constructor |
|
59 |
*/ |
|
60 |
public GSFeatureResourceBasicPanel() { |
|
61 |
super(); |
|
62 |
initComponents(); |
|
63 |
initLabels(); |
|
64 |
} |
|
65 |
/** |
|
66 |
* Initializes labels for multi-language |
|
67 |
*/ |
|
68 |
private void initLabels() { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
private void initComponents() { |
|
74 |
java.awt.GridBagConstraints gridBagConstraints; |
|
75 |
|
|
76 |
commonOgc = new org.gvsig.publish.gui.ogcMetadata.CommonOGCMetadataPanel(); |
|
77 |
jSeparator1 = new javax.swing.JSeparator(); |
|
78 |
infoLabel = new javax.swing.JLabel(); |
|
79 |
|
|
80 |
setLayout(new java.awt.GridBagLayout()); |
|
81 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
82 |
gridBagConstraints.gridx = 1; |
|
83 |
gridBagConstraints.gridy = 1; |
|
84 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
85 |
gridBagConstraints.weightx = 1.0; |
|
86 |
gridBagConstraints.weighty = 1.0; |
|
87 |
add(commonOgc, gridBagConstraints); |
|
88 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
89 |
gridBagConstraints.gridx = 1; |
|
90 |
gridBagConstraints.gridy = 0; |
|
91 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
92 |
gridBagConstraints.weightx = 1.0; |
|
93 |
add(jSeparator1, gridBagConstraints); |
|
94 |
|
|
95 |
infoLabel.setFont(new java.awt.Font("Dialog", 1, 11)); |
|
96 |
infoLabel.setText("basic"); |
|
97 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
98 |
gridBagConstraints.gridx = 0; |
|
99 |
gridBagConstraints.gridy = 0; |
|
100 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); |
|
101 |
add(infoLabel, gridBagConstraints); |
|
102 |
}// </editor-fold> |
|
103 |
|
|
104 |
|
|
105 |
// Variables declaration - do not modify |
|
106 |
private org.gvsig.publish.gui.ogcMetadata.CommonOGCMetadataPanel commonOgc; |
|
107 |
private javax.swing.JLabel infoLabel; |
|
108 |
private javax.swing.JSeparator jSeparator1; |
|
109 |
// End of variables declaration |
|
110 |
|
|
111 |
/* |
|
112 |
* (non-Javadoc) |
|
113 |
* @see org.gvsig.publish.gui.publish.IPublishPluginPanel#getModel() |
|
114 |
*/ |
|
115 |
public Object getModel() { |
|
116 |
model.setOgcMetadata((CommonOGCMetadata)commonOgc.getModel()); |
|
117 |
return model; |
|
118 |
} |
|
119 |
/* |
|
120 |
* (non-Javadoc) |
|
121 |
* @see org.gvsig.publish.gui.publish.IPublishPluginPanel#setListener(java.util.EventListener) |
|
122 |
*/ |
|
123 |
public void setListener(EventListener listener) { |
|
124 |
// TODO Auto-generated method stub |
|
125 |
|
|
126 |
} |
|
127 |
/* |
|
128 |
* (non-Javadoc) |
|
129 |
* @see org.gvsig.publish.gui.publish.IPublishPluginPanel#setModel(java.lang.Object) |
|
130 |
*/ |
|
131 |
public void setModel(Object entityModel) { |
|
132 |
// cast to geoserver feature remote resource |
|
133 |
model = (GSFeatureResource)entityModel; |
|
134 |
commonOgc.setModel(model.getOgcMetadata()); |
|
135 |
} |
|
136 |
|
|
137 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GSWFSAdvancedPanel.java | ||
---|---|---|
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.GSWFSService; |
|
48 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
49 |
|
|
50 |
import com.sun.java_cup.internal.shift_action; |
|
51 |
|
|
52 |
public class GSWFSAdvancedPanel extends JPanel implements |
|
53 |
IPublishPluginPanel { |
|
54 |
//Associations |
|
55 |
private GSWFSService model=null; |
|
56 |
/** |
|
57 |
* default constructor |
|
58 |
*/ |
|
59 |
public GSWFSAdvancedPanel() { |
|
60 |
super(); |
|
61 |
initComponents(); |
|
62 |
initLabels(); |
|
63 |
} |
|
64 |
/** |
|
65 |
* Initializes labels for multi-language |
|
66 |
*/ |
|
67 |
private void initLabels() { |
|
68 |
// TODO Auto-generated method stub |
|
69 |
|
|
70 |
} |
|
71 |
private void initComponents() { |
|
72 |
java.awt.GridBagConstraints gridBagConstraints; |
|
73 |
|
|
74 |
serviceLabelLabel = new javax.swing.JLabel(); |
|
75 |
serviceLevelCombo = new javax.swing.JComboBox(); |
|
76 |
jSeparator1 = new javax.swing.JSeparator(); |
|
77 |
infoLabel = new javax.swing.JLabel(); |
|
78 |
|
|
79 |
setLayout(new java.awt.GridBagLayout()); |
|
80 |
|
|
81 |
serviceLabelLabel.setText("service_level"); |
|
82 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
83 |
gridBagConstraints.gridx = 1; |
|
84 |
gridBagConstraints.gridy = 1; |
|
85 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 2); |
|
86 |
add(serviceLabelLabel, gridBagConstraints); |
|
87 |
|
|
88 |
serviceLevelCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Basic", "Transactional", "Complete" })); |
|
89 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
90 |
gridBagConstraints.gridx = 2; |
|
91 |
gridBagConstraints.gridy = 1; |
|
92 |
gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 5); |
|
93 |
add(serviceLevelCombo, gridBagConstraints); |
|
94 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
95 |
gridBagConstraints.gridx = 1; |
|
96 |
gridBagConstraints.gridy = 0; |
|
97 |
gridBagConstraints.gridwidth = 2; |
|
98 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
99 |
gridBagConstraints.weightx = 1.0; |
|
100 |
gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2); |
|
101 |
add(jSeparator1, gridBagConstraints); |
|
102 |
|
|
103 |
infoLabel.setFont(new java.awt.Font("Dialog", 1, 11)); |
|
104 |
infoLabel.setText("advanced"); |
|
105 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
106 |
gridBagConstraints.gridx = 0; |
|
107 |
gridBagConstraints.gridy = 0; |
|
108 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 2); |
|
109 |
add(infoLabel, gridBagConstraints); |
|
110 |
}// </editor-fold> |
|
111 |
|
|
112 |
|
|
113 |
// Variables declaration - do not modify |
|
114 |
private javax.swing.JLabel infoLabel; |
|
115 |
private javax.swing.JSeparator jSeparator1; |
|
116 |
private javax.swing.JLabel serviceLabelLabel; |
|
117 |
private javax.swing.JComboBox serviceLevelCombo; |
|
118 |
// End of variables declaration |
|
119 |
|
|
120 |
|
|
121 |
public Object getModel() { |
|
122 |
model.getConfig().setServiceLevel(getServiceLevelFromCombo(serviceLevelCombo.getSelectedIndex())); |
|
123 |
return model; |
|
124 |
} |
|
125 |
|
|
126 |
public void setListener(EventListener listener) { |
|
127 |
// TODO Auto-generated method stub |
|
128 |
|
|
129 |
} |
|
130 |
|
|
131 |
public void setModel(Object entityModel) { |
|
132 |
// cast to geoserverwfs |
|
133 |
model = (GSWFSService)entityModel; |
|
134 |
serviceLevelCombo.setSelectedIndex(getComboIndexFromServiceLevel(model.getConfig().getServiceLevel())); |
|
135 |
} |
|
136 |
/** |
|
137 |
* |
|
138 |
* @param comboindex 0 --> Basic, 1 --> Transactional, 2 --> Complete |
|
139 |
* @return geoserver integer to specify a service level |
|
140 |
*/ |
|
141 |
private int getServiceLevelFromCombo(int comboindex){ |
|
142 |
//Basic |
|
143 |
if (comboindex == 0){ |
|
144 |
return 1; |
|
145 |
} |
|
146 |
//Transactional |
|
147 |
if (comboindex == 1){ |
|
148 |
return 15; |
|
149 |
} |
|
150 |
//Complete |
|
151 |
if (comboindex == 2){ |
|
152 |
return 31; |
|
153 |
} |
|
154 |
return 0; |
|
155 |
} |
|
156 |
/** |
|
157 |
* |
|
158 |
* @param serviceLevel 1-->Basic, 15-->Transactional, 31-->Complete |
|
159 |
* @return comboindex which represents the serviceLevel parameter |
|
160 |
*/ |
|
161 |
private int getComboIndexFromServiceLevel(int serviceLevel){ |
|
162 |
//Basic |
|
163 |
if (serviceLevel == 1){ |
|
164 |
return 0; |
|
165 |
} |
|
166 |
//Transactional |
|
167 |
if (serviceLevel == 15){ |
|
168 |
return 1; |
|
169 |
} |
|
170 |
//Complete |
|
171 |
if (serviceLevel == 31){ |
|
172 |
return 2; |
|
173 |
} |
|
174 |
return 0; |
|
175 |
} |
|
176 |
|
|
177 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GSFeatureResourceAdvancedPanel.java | ||
---|---|---|
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 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GeoserverBasicPanel.java | ||
---|---|---|
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.awt.event.ActionListener; |
|
44 |
import java.io.File; |
|
45 |
import java.net.MalformedURLException; |
|
46 |
import java.net.URL; |
|
47 |
import java.util.EventListener; |
|
48 |
|
|
49 |
import javax.swing.ImageIcon; |
|
50 |
import javax.swing.JOptionPane; |
|
51 |
import javax.swing.JPanel; |
|
52 |
|
|
53 |
import org.gvsig.publish.PublishExtension; |
|
54 |
import org.gvsig.publish.PublishLogger; |
|
55 |
import org.gvsig.publish.geoserver.model.Geoserver; |
|
56 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
57 |
|
|
58 |
public class GeoserverBasicPanel extends JPanel implements IPublishPluginPanel { |
|
59 |
//Association |
|
60 |
private Geoserver model=null; |
|
61 |
/** |
|
62 |
* Default constructor |
|
63 |
*/ |
|
64 |
public GeoserverBasicPanel() { |
|
65 |
super(); |
|
66 |
initComponents(); |
|
67 |
initIcons(); |
|
68 |
initLabels(); |
|
69 |
} |
|
70 |
/** |
|
71 |
* initialize icons |
|
72 |
*/ |
|
73 |
private void initIcons(){ |
|
74 |
//open dir |
|
75 |
try { |
|
76 |
dirButton.setIcon(new javax.swing.ImageIcon(PublishExtension.class.getClassLoader().getResource("images/publish-fileopen.gif"))); |
|
77 |
}catch( java.lang.NullPointerException e){ |
|
78 |
PublishLogger.getLog().error("ERROR " + getClass().getName() + ":Error loading icons", e); |
|
79 |
} |
|
80 |
//geoserver logo |
|
81 |
try { |
|
82 |
icon.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/publish-geoserver.png"))); |
|
83 |
}catch( java.lang.NullPointerException e){ |
|
84 |
PublishLogger.getLog().error("ERROR " + getClass().getName() + ":Error loading icons", e); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Initializes labels for multi-language |
|
90 |
*/ |
|
91 |
private void initLabels() { |
|
92 |
// TODO Auto-generated method stub |
|
93 |
|
|
94 |
} |
|
95 |
private void initComponents() { |
|
96 |
java.awt.GridBagConstraints gridBagConstraints; |
|
97 |
|
|
98 |
userText = new javax.swing.JTextField(); |
|
99 |
userLabel = new javax.swing.JLabel(); |
|
100 |
passText = new javax.swing.JPasswordField(); |
|
101 |
passLabel = new javax.swing.JLabel(); |
|
102 |
dirText = new javax.swing.JTextField(); |
|
103 |
dirLabel = new javax.swing.JLabel(); |
|
104 |
dirButton = new org.gvsig.gui.beans.swing.JButton(); |
|
105 |
urlText = new javax.swing.JTextField(); |
|
106 |
urlLabel = new javax.swing.JLabel(); |
|
107 |
jSeparator1 = new javax.swing.JSeparator(); |
|
108 |
icon = new javax.swing.JLabel(); |
|
109 |
infoLabel = new javax.swing.JLabel(); |
|
110 |
|
|
111 |
setLayout(new java.awt.GridBagLayout()); |
|
112 |
|
|
113 |
userText.setText("user"); |
|
114 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
115 |
gridBagConstraints.gridx = 2; |
|
116 |
gridBagConstraints.gridy = 3; |
|
117 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
118 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; |
|
119 |
gridBagConstraints.weightx = 1.0; |
|
120 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 5); |
|
121 |
add(userText, gridBagConstraints); |
|
122 |
|
|
123 |
userLabel.setText("user"); |
|
124 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
125 |
gridBagConstraints.gridx = 1; |
|
126 |
gridBagConstraints.gridy = 3; |
|
127 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
|
128 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 2); |
|
129 |
add(userLabel, gridBagConstraints); |
|
130 |
|
|
131 |
passText.setText("jPasswordField1"); |
|
132 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
133 |
gridBagConstraints.gridx = 4; |
|
134 |
gridBagConstraints.gridy = 3; |
|
135 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
136 |
gridBagConstraints.weightx = 1.0; |
|
137 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 5); |
|
138 |
add(passText, gridBagConstraints); |
|
139 |
|
|
140 |
passLabel.setText("pass"); |
|
141 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
142 |
gridBagConstraints.gridx = 3; |
|
143 |
gridBagConstraints.gridy = 3; |
|
144 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
|
145 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 2); |
|
146 |
add(passLabel, gridBagConstraints); |
|
147 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
148 |
gridBagConstraints.gridx = 2; |
|
149 |
gridBagConstraints.gridy = 4; |
|
150 |
gridBagConstraints.gridwidth = 3; |
|
151 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
152 |
gridBagConstraints.weightx = 1.0; |
|
153 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
|
154 |
add(dirText, gridBagConstraints); |
|
155 |
|
|
156 |
dirLabel.setText("dir"); |
|
157 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
158 |
gridBagConstraints.gridx = 1; |
|
159 |
gridBagConstraints.gridy = 4; |
|
160 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
|
161 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 2); |
|
162 |
add(dirLabel, gridBagConstraints); |
|
163 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
164 |
gridBagConstraints.gridx = 5; |
|
165 |
gridBagConstraints.gridy = 4; |
|
166 |
gridBagConstraints.insets = new java.awt.Insets(1, 2, 2, 5); |
|
167 |
add(dirButton, gridBagConstraints); |
|
168 |
|
|
169 |
urlText.setEditable(false); |
|
170 |
urlText.setText("http://"); |
|
171 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
172 |
gridBagConstraints.gridx = 2; |
|
173 |
gridBagConstraints.gridy = 2; |
|
174 |
gridBagConstraints.gridwidth = 3; |
|
175 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
176 |
gridBagConstraints.weightx = 1.0; |
|
177 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 5); |
|
178 |
add(urlText, gridBagConstraints); |
|
179 |
|
|
180 |
urlLabel.setText("url"); |
|
181 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
182 |
gridBagConstraints.gridx = 1; |
|
183 |
gridBagConstraints.gridy = 2; |
|
184 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
|
185 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 2); |
|
186 |
add(urlLabel, gridBagConstraints); |
|
187 |
|
|
188 |
jSeparator1.setName(""); // NOI18N |
|
189 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
190 |
gridBagConstraints.gridx = 1; |
|
191 |
gridBagConstraints.gridy = 1; |
|
192 |
gridBagConstraints.gridwidth = 5; |
|
193 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
194 |
gridBagConstraints.weightx = 1.0; |
|
195 |
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); |
|
196 |
add(jSeparator1, gridBagConstraints); |
|
197 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
198 |
gridBagConstraints.gridx = 0; |
|
199 |
gridBagConstraints.gridy = 0; |
|
200 |
add(icon, gridBagConstraints); |
|
201 |
|
|
202 |
infoLabel.setFont(new java.awt.Font("Dialog", 1, 11)); |
|
203 |
infoLabel.setText("basic_info"); |
|
204 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
205 |
gridBagConstraints.gridx = 0; |
|
206 |
gridBagConstraints.gridy = 1; |
|
207 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 0, 0); |
|
208 |
add(infoLabel, gridBagConstraints); |
|
209 |
}// </editor-fold> |
|
210 |
|
|
211 |
|
|
212 |
// Variables declaration - do not modify |
|
213 |
private org.gvsig.gui.beans.swing.JButton dirButton; |
|
214 |
private javax.swing.JLabel dirLabel; |
|
215 |
private javax.swing.JTextField dirText; |
|
216 |
private javax.swing.JLabel icon; |
|
217 |
private javax.swing.JLabel infoLabel; |
|
218 |
private javax.swing.JSeparator jSeparator1; |
|
219 |
private javax.swing.JLabel passLabel; |
|
220 |
private javax.swing.JPasswordField passText; |
|
221 |
private javax.swing.JLabel urlLabel; |
|
222 |
private javax.swing.JTextField urlText; |
|
223 |
private javax.swing.JLabel userLabel; |
|
224 |
private javax.swing.JTextField userText; |
|
225 |
// End of variables declaration |
|
226 |
|
|
227 |
/** |
|
228 |
* update the model with the GUI |
|
229 |
*/ |
|
230 |
public Object getModel() { |
|
231 |
try { |
|
232 |
model.setServerURL(new URL(urlText.getText())); |
|
233 |
} catch (MalformedURLException e) { |
|
234 |
JOptionPane.showMessageDialog(this, |
|
235 |
"malformed_url", |
|
236 |
"malformed_url", |
|
237 |
JOptionPane.ERROR_MESSAGE); |
|
238 |
} |
|
239 |
model.getConfig().setUser(userText.getText()); |
|
240 |
model.getConfig().setPassword(new String(passText.getPassword())); |
|
241 |
model.setConfigDirectory(new File(dirText.getText())); |
|
242 |
return model; |
|
243 |
} |
|
244 |
/** |
|
245 |
* sets the listener for the filechooser |
|
246 |
*/ |
|
247 |
public void setListener(EventListener listener) { |
|
248 |
dirButton.addActionListener((ActionListener)listener); |
|
249 |
dirButton.setActionCommand(GeoserverController.SELECT_DIR_EVENT); |
|
250 |
} |
|
251 |
/** |
|
252 |
* Fill the GUI with the model |
|
253 |
*/ |
|
254 |
public void setModel(Object entityModel) { |
|
255 |
// cast to Geoserver |
|
256 |
model = (Geoserver)entityModel; |
|
257 |
urlText.setText(model.getServerURL().toString()); |
|
258 |
userText.setText(model.getConfig().getUser()); |
|
259 |
passText.setText(model.getConfig().getPassword()); |
|
260 |
if (model.getConfigDirectory()!=null){ |
|
261 |
dirText.setText(model.getConfigDirectory().getAbsolutePath()); |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GeoserverController.java | ||
---|---|---|
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.awt.event.ActionEvent; |
|
44 |
import java.io.File; |
|
45 |
|
|
46 |
import javax.swing.JFileChooser; |
|
47 |
|
|
48 |
import org.gvsig.publish.geoserver.model.Geoserver; |
|
49 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
50 |
import org.gvsig.publish.gui.wizard.PublishWizardController; |
|
51 |
import org.gvsig.publish.serversmodel.RemoteResource; |
|
52 |
import org.gvsig.publish.serversmodel.Server; |
|
53 |
import org.gvsig.publish.serversmodel.Service; |
|
54 |
/** |
|
55 |
* Geoserver GUI controller. |
|
56 |
* |
|
57 |
* @author jvhigon |
|
58 |
* |
|
59 |
*/ |
|
60 |
public class GeoserverController extends PublishWizardController{ |
|
61 |
//EVENTS |
|
62 |
public final static String SELECT_DIR_EVENT="select_dir_event"; |
|
63 |
|
|
64 |
//Associantions |
|
65 |
private IPublishPluginPanel serverBasicPanel = null; |
|
66 |
private IPublishPluginPanel serverAdvancedPanel = null; |
|
67 |
private IPublishPluginPanel serviceBasicPanel = null; |
|
68 |
private IPublishPluginPanel serviceAdvancedPanel = null; |
|
69 |
private IPublishPluginPanel resourceBasicPanel = null; |
|
70 |
private IPublishPluginPanel resourceAdvancedPanel = null; |
|
71 |
private GSFileChooser dirChooser = null; |
|
72 |
private Geoserver active_server=null; |
|
73 |
/** |
|
74 |
* Default constructor |
|
75 |
*/ |
|
76 |
public GeoserverController() { |
|
77 |
super(); |
|
78 |
serverBasicPanel = new GeoserverBasicPanel(); |
|
79 |
serverAdvancedPanel = new GeoserverAdvancedPanel(); |
|
80 |
serviceBasicPanel = new GSWFSBasicPanel(); |
|
81 |
serviceAdvancedPanel = new GSWFSAdvancedPanel(); |
|
82 |
resourceBasicPanel = new GSFeatureResourceBasicPanel(); |
|
83 |
resourceAdvancedPanel = new GSFeatureResourceAdvancedPanel(); |
|
84 |
dirChooser = new GSFileChooser(); |
|
85 |
//set listener |
|
86 |
serverBasicPanel.setListener(this); |
|
87 |
} |
|
88 |
/* |
|
89 |
* (non-Javadoc) |
|
90 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getRemoteResourceAdvancedPanel(org.gvsig.publish.serversmodel.RemoteResource) |
|
91 |
*/ |
|
92 |
public IPublishPluginPanel getRemoteResourceAdvancedPanel( |
|
93 |
RemoteResource remoteResource) { |
|
94 |
resourceAdvancedPanel.setModel(remoteResource); |
|
95 |
return resourceAdvancedPanel; |
|
96 |
} |
|
97 |
|
|
98 |
/* |
|
99 |
* (non-Javadoc) |
|
100 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getRemoteResourcePanel(org.gvsig.publish.serversmodel.RemoteResource) |
|
101 |
*/ |
|
102 |
public IPublishPluginPanel getRemoteResourcePanel( |
|
103 |
RemoteResource remoteResource) { |
|
104 |
resourceBasicPanel.setModel(remoteResource); |
|
105 |
return resourceBasicPanel; |
|
106 |
} |
|
107 |
|
|
108 |
/* |
|
109 |
* (non-Javadoc) |
|
110 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getServerAdvancedPanel(org.gvsig.publish.serversmodel.Server) |
|
111 |
*/ |
|
112 |
public IPublishPluginPanel getServerAdvancedPanel(Server server) { |
|
113 |
serverAdvancedPanel.setModel(server); |
|
114 |
return serverAdvancedPanel; |
|
115 |
} |
|
116 |
|
|
117 |
/* |
|
118 |
* (non-Javadoc) |
|
119 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getServerPanel(org.gvsig.publish.serversmodel.Server) |
|
120 |
*/ |
|
121 |
public IPublishPluginPanel getServerPanel(Server server) { |
|
122 |
active_server = (Geoserver)server; |
|
123 |
serverBasicPanel.setModel(server); |
|
124 |
return serverBasicPanel; |
|
125 |
} |
|
126 |
|
|
127 |
/* |
|
128 |
* (non-Javadoc) |
|
129 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getServiceAdvancedPanel(org.gvsig.publish.serversmodel.Service) |
|
130 |
*/ |
|
131 |
public IPublishPluginPanel getServiceAdvancedPanel(Service service) { |
|
132 |
serviceAdvancedPanel.setModel(service); |
|
133 |
return serviceAdvancedPanel; |
|
134 |
} |
|
135 |
|
|
136 |
/* |
|
137 |
* (non-Javadoc) |
|
138 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#getServicePanel(org.gvsig.publish.serversmodel.Service) |
|
139 |
*/ |
|
140 |
public IPublishPluginPanel getServicePanel(Service service) { |
|
141 |
serviceBasicPanel.setModel(service); |
|
142 |
return serviceBasicPanel; |
|
143 |
} |
|
144 |
/* |
|
145 |
* (non-Javadoc) |
|
146 |
* @see org.gvsig.publish.gui.wizard.PublishWizardController#actionPerformed(java.awt.event.ActionEvent) |
|
147 |
*/ |
|
148 |
public void actionPerformed(ActionEvent e) { |
|
149 |
super.actionPerformed(e); |
|
150 |
if (e.getActionCommand().equals(SELECT_DIR_EVENT)){ |
|
151 |
//first, update model |
|
152 |
serverBasicPanel.getModel(); |
|
153 |
int returnVal = dirChooser.showSaveDialog((GeoserverBasicPanel)serverBasicPanel); |
|
154 |
if (returnVal == JFileChooser.APPROVE_OPTION){ |
|
155 |
File dirconf = dirChooser.getSelectedFile(); |
|
156 |
active_server.setConfigDirectory(dirconf); |
|
157 |
serverBasicPanel.setModel(active_server); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
|
|
163 |
} |
branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/gui/GeoserverAdvancedPanel.java | ||
---|---|---|
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.Geoserver; |
|
48 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
49 |
|
|
50 |
public class GeoserverAdvancedPanel extends JPanel implements |
|
51 |
IPublishPluginPanel { |
|
52 |
//Association |
|
53 |
private Geoserver model=null; |
|
54 |
|
|
55 |
/** |
|
56 |
* Default constructor |
|
57 |
*/ |
|
58 |
public GeoserverAdvancedPanel() { |
|
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 |
private void initComponents() { |
|
71 |
java.awt.GridBagConstraints gridBagConstraints; |
Also available in: Unified diff