Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublish / src / org / gvsig / publish / gui / ogcMetadata / OGCServiceMetadataPanel.java @ 19900

History | View | Annotate | Download (4.58 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.gui.ogcMetadata;
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.gui.publish.IPublishPluginPanel;
51
import org.gvsig.publish.ogcmetadata.IOGCServiceMetadata;
52

    
53
import com.iver.andami.PluginServices;
54

    
55
public class OGCServiceMetadataPanel extends JPanel implements IPublishPluginPanel {
56
                /**
57
         * 
58
         */
59
        private static final long serialVersionUID = -5653327425351006165L;
60
                /*
61
                 * model
62
                 */
63
                private IOGCServiceMetadata model_servicewms = null;
64
                
65
                /**
66
                 * Constructor
67
                 */
68
            public OGCServiceMetadataPanel() {
69
                initComponents();
70
                initLabels();
71
            }
72
            private void initLabels(){
73
                    setBorder(javax.swing.BorderFactory.createTitledBorder(PluginServices.getText(this,"service_wms111")));
74
                    onlineresourceLabel.setText(PluginServices.getText(this,"online_resource"));
75
            }
76
            private void initComponents() {
77
                java.awt.GridBagConstraints gridBagConstraints;
78

    
79
                onlineresourceLabel = new javax.swing.JLabel();
80
                onlinreresourceField = new javax.swing.JTextField();
81

    
82
                setBorder(javax.swing.BorderFactory.createTitledBorder("Service WMS 1.1.1"));
83
                setLayout(new java.awt.GridBagLayout());
84

    
85
                onlineresourceLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
86
                onlineresourceLabel.setText("online resource");
87
                gridBagConstraints = new java.awt.GridBagConstraints();
88
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
89
                add(onlineresourceLabel, gridBagConstraints);
90

    
91
                onlinreresourceField.setEditable(false);
92
                onlinreresourceField.setText("http://");
93
                onlinreresourceField.addMouseListener(new java.awt.event.MouseAdapter() {
94
                    public void mouseClicked(java.awt.event.MouseEvent evt) {
95
                        onlinreresourceFieldMouseClicked(evt);
96
                    }
97
                });
98
                gridBagConstraints = new java.awt.GridBagConstraints();
99
                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100
                gridBagConstraints.weightx = 1.0;
101
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
102
                add(onlinreresourceField, gridBagConstraints);
103
            }// </editor-fold>
104

    
105
            private void onlinreresourceFieldMouseClicked(java.awt.event.MouseEvent evt) {                                                  
106
                   if (evt.getClickCount() == 3) {
107
                    onlinreresourceField.setEditable(true);
108
                   }
109
            }                                                 
110
            
111
            
112
            // Variables declaration - do not modify
113
            private javax.swing.JLabel onlineresourceLabel;
114
            private javax.swing.JTextField onlinreresourceField;
115
            // End of variables declaration
116
            
117
        public Object getModel() {
118
                URL url=null;
119
                try {
120
                        url = new URL(onlinreresourceField.getText());
121
                } catch (MalformedURLException e) {
122
                        JOptionPane.showMessageDialog(this,"malformed_url","ServiceWMS111Panel",JOptionPane.ERROR_MESSAGE);
123
                }
124
                model_servicewms.setOnlineResource(url);
125
                return model_servicewms;
126
        }
127

    
128
        public void setListener(EventListener listener) {
129
                // TODO Auto-generated method stub
130

    
131
        }
132

    
133
        public void setModel(Object entityModel) {
134
                //cast to ServiceWMS111Metadata
135
                model_servicewms = (IOGCServiceMetadata)entityModel;
136
                onlinreresourceField.setText(model_servicewms.getOnlineResource().toString());
137
        }
138

    
139
}