Revision 4911

View differences:

trunk/extensions/extWFS2/config/text.properties
1 1
feature=Features
2
Fichero=File
3
Valor_azul=Valor Azul
4
Valor_rojo=Valor Rojo
5
Valor_verde=Valor Verde
6
WMSLayer=capaWMS
7
abstract=Resumen
8
add=A?adir
9
ancho_alto=Ancho X Alto
10
anterior=Anterior
11
apply=Aplicar
12
bands=Bandas
13
cancel=Cancelar
14
cannotReproject=No se puede reproyectar este sistema de coordenadas
15
cant_connect=No ha sido posible realizar la conexi?n con el WFS
16
capas=Capas
17
clear=Limpiar
18
conectar=Conectar
19
connect_error=Error conectando
20
coor_geograficas=Coor. Geograficas
21
countries_of_the_world=Afghanistan;Albania;Algeria;American Samoa;Andorra;Angola;Anguilla;Antarctica;Antigua and Barbuda;Argentina;Armenia;Aruba;Ascension Island;Australia;Austria;Azerbaijan;Bahamas;Bahrain;Bangladesh;Barbados;Belarus;Belgium;Belize;Benin;Bermuda;Bhutan;Bolivia;Bosnia and Herzegovina;Botswana;Bouvet Island;Brazil;British Indian Ocean Territory;Brunei;Bulgaria;Burkina Faso;Burundi;Cambodia;Cameroon;Canada;Cape Verde;Cayman Islands;Central African Republic;Chad;Chile;China;Christmas Island;Cocos (Keeling) Islands;Colombia;Comoros;Congo (DRC);Congo;Cook Islands;Costa Rica;C?te d'Ivoire;Croatia;Cuba;Cyprus;Czech Republic;Denmark;Djibouti;Dominica;Dominican Republic;Ecuador;Egypt;El Salvador;Equatorial Guinea;Eritrea;Estonia;Ethiopia;Falkland Islands (Islas Malvinas);Faroe Islands;Fiji Islands;Finland;France;French Guiana;French Polynesia;French Southern and Antarctic Lands;Gabon;Gambia, The;Georgia;Germany;Ghana;Gibraltar;Greece;Greenland;Grenada;Guadeloupe;Guam;Guatemala;Guernsey;Guinea;Guinea-Bissau;Guyana;Haiti;Heard Island and McDonald Islands;Honduras;Hong Kong SAR;Hungary;Iceland;India;Indonesia;Iran;Iraq;Ireland;Isle of Man;Israel;Italy;Jamaica;Japan;Jordan;Jersey;Kazakhstan;Kenya;Kiribati;Korea;Kuwait;Kyrgyzstan;Laos;Latvia;Lebanon;Lesotho;Liberia;Libya;Liechtenstein;Lithuania;Luxembourg;Macao SAR;Macedonia, Former Yugoslav Republic of;Madagascar;Malawi;Malaysia;Maldives;Mali;Malta;Marshall Islands;Martinique;Mauritania;Mauritius;Mayotte;Mexico;Micronesia;Moldova;Monaco;Mongolia;Montserrat;Morocco;Mozambique;Myanmar;Namibia;Nauru;Nepal;Netherlands Antilles;Netherlands, The;New Caledonia;New Zealand;Nicaragua;Niger;Nigeria;Niue;Norfolk Island;North Korea;Northern Mariana Islands;Norway;Oman;Pakistan;Palau;Palestinian Authority;Panama;Papua New Guinea;Paraguay;Peru;Philippines;Pitcairn Islands;Poland;Portugal;Puerto Rico;Qatar;Reunion;Romania;Russia;Rwanda;Samoa;San Marino;S?o Tom? and Pr?ncipe;Saudi Arabia;Senegal;Serbia and Montenegro;Seychelles;Sierra Leone;Singapore;Slovakia;Slovenia;Solomon Islands;Somalia;South Africa;South Georgia and the South Sandwich Islands;Spain;Sri Lanka;St. Helena;St. Kitts and Nevis;St. Lucia;St. Pierre and Miquelon;St. Vincent and the Grenadines;Sudan;Suriname;Svalbard and Jan Mayen;Swaziland;Sweden;Switzerland;Syria;Taiwan;Tajikistan;Tanzania;Thailand;Timor-Leste;Togo;Tokelau;Tonga;Trinidad and Tobago;Tristan da Cunha;Tunisia;Turkey;Turkmenistan;Turks and Caicos Islands;Tuvalu;Uganda;Ukraine;United Arab Emirates;United Kingdom;United States of America;United States Minor Outlying Islands;Uruguay;Uzbekistan;Vanuatu;Vatican City;Venezuela;Vietnam;Virgin Islands;Virgin Islands, British;Wallis and Futuna;Yemen;Zambia;Zimbabwe
22
covered_extension=Extensi?n
23
description=Descripci?n
24
desde=Desde
25
dimension=Dimensi?n
26
dimensiones=Dimensiones
27
eliminar_extremos=Eliminar Extremos
28
estilos=Estilos
29
extents_no_coincidentes=El extent de la imagen seleccionada no coincide con la imagen de origen.
30
fichero_existe=El fichero seleccionado ya existe como banda de la capa
31
fit_WMS_layer=Ajustar capa WMS
32
format=Formato
33
formatos=Formatos
34
from=Desde
35
in=in
36
info=Informaci?n
37
interval=Intervalo
38
intervalo=Intervalo
39
introduzca_intervalo_deseado=Introduzca el intervalo deseado
40
layer_abstract=Resumen
41
layer_name=Nombre de la capa
42
layer_title=T?tulo de la capa
43
lineal_directo=Lineal Directo
44
move_layer_down=Mover abajo
45
move_layer_up=Mover arriba
46
muestra=Muestra
47
multiple_value=Valor m?ltiple
48
multiples_intervalos=M?ltiples Intervalos
49
name=Nombre
50
none_selected=Ninguno seleccionado
51
not_available=No disponible
52
num_bandas=N\u00FAmero de bandas
53
ok=Aceptar
54
opacidad=Opacidad
55
period=Periodo
56
properties=Propiedades
57
propiedades_raster=Propiedades del r\u00E1ster
58
realce=Realce
59
recorte=recorte
60
recorte_colas=Recorte de Colas
61
refresh_capabilities=Refrescar cach?
62
refresh_capabilities_tooltip=Marque esta casilla para sobreescribir los datos anteriores.
63
remove=Quitar
64
seleccionar_srs=Seleccionar SRS
65
select_formats=Seleccionar formatos
66
select_layers=Seleccionar capas
67
selected_dimensions=Dimensiones Seleccionadas
68
selected_layers=Capas seleccionadas
69
selected_themes=Temas seleccionados
70
server=Servidor
71
server_abstract=Sumario
72
server_cant_render_layers=Este servidor no puede renderizar estas capas juntas.\nPruebe a hacer peticiones separadas para cada capa.
73
server_timeout=Alcanzado m?ximo tiempo de espera de respuesta del WMS
74
server_title=T?tulo
75
server_type=Tipo de servidor
76
service_info=Informaci?n del servicio
77
set=Establecer
78
settings=Ajustes
79
settings_editor=Editor de ajustes
80
show_layer_names=Mostrar nombres
81
disagregate_layers=Conservar estructura de capas
82
siguiente=Siguiente
83
sin_realce=Sin Realce
84
single_value=Valor simple
85
style=Estilo
86
tipo_dato=Tipo de Dato
87
to=Hasta
88
transparencia=Transparencia
89
unknown_response_format=Formato de respuesta desconocido
90
usar_rango=Usa un rango
91
valor_pixel=Valor de pixel
92
value=Valor
93
version_conflict=Conflicto de versiones
94
wms_not_queryable=Este servidor no acepta peticiones de este tipo
95
wms_properties=Propiedades WMS
96
wms_server_error=Error del servidor WMS
97
wms_transparency=Transparencia
98
xmax=X m\u00E1xima
99
xmin=X m\u00EDnima
100
ymax=Y m\u00E1xima
101
ymin=Y m\u00EDnima
2
fields=Campos
3
options=Opciones
4
nombre_feature=Nombre de la Feature
5
select_fields=Seleccionar campos de la Feature
6
select_features=Selecciona las Features
7

  
trunk/extensions/extWFS2/config/config.xml
1 1
<?xml version="1.0" encoding="ISO-8859-1"?>
2 2
<plugin-config>
3
	
4 3
	<depends plugin-name="com.iver.cit.gvsig" />
5 4
	<libraries library-dir="./lib"/>
5
	<resourceBundle name="text"/>
6 6
	<extensions>
7 7
		<extension class-name="com.iver.cit.gvsig.wfs.WFSClientExtension"
8 8
			description="Support to access WFS"
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/layers/WFSLayerNode.java
1 1
package com.iver.cit.gvsig.fmap.layers;
2

  
3
import java.util.Hashtable;
4
import java.util.Vector;
5

  
2 6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3 7
 *
4 8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
......
43 47
 *
44 48
 * $Id$
45 49
 * $Log$
46
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
50
 * Revision 1.2  2006-04-20 16:38:24  jorpiell
51
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
52
 *
53
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
47 54
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
48 55
 *
49 56
 *
......
54 61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
55 62
 */
56 63
public class WFSLayerNode {
57
	private String name;
58
	private String description;
59

  
64
	private String	name = null;
65
	private String	title = null;
66
	private String	_abstract = null;
67
	private Vector keykords = new Vector();
68
	private String defaultSRS = null;
69
	private Vector otherSRS = new Vector();
70
	private String noSRS = null;
71
	private Vector operations = new Vector();
72
	private String outputFormat = null;
73
	private String wgs84BoundingBox = null;
74
	private Vector metadataURL = new Vector();
75
	private Hashtable fields = new Hashtable();
76
	
60 77
	/**
61
	 * @return Returns the description.
78
	 * @return Returns the fields.
62 79
	 */
63
	public String getDescription() {
64
		return description;
80
	public Hashtable getFields() {
81
		return fields;
65 82
	}
66

  
67 83
	/**
84
	 * @param fields The fields to set.
85
	 */
86
	public void setFields(Hashtable fields) {
87
		this.fields = fields;
88
	}
89
	/**
90
	 * 
91
	 */
92
	public String toString(){
93
		String str;
94
		if (getName()==null)
95
			str = getTitle();
96
		else
97
			str = "["+getName()+"] "+getTitle();
98
		return str;
99
	}
100
	/**
101
	 * @return Returns the _abstract.
102
	 */
103
	public String getAbstract() {
104
		return _abstract;
105
	}
106
	/**
107
	 * @param _abstract The _abstract to set.
108
	 */
109
	public void setAbstract(String _abstract) {
110
		this._abstract = _abstract;
111
	}
112
	/**
68 113
	 * @return Returns the name.
69 114
	 */
70 115
	public String getName() {
71 116
		return name;
72 117
	}
118
	/**
119
	 * @param name The name to set.
120
	 */
121
	public void setName(String name) {
122
		this.name = name;
123
	}
124
	/**
125
	 * @return Returns the title.
126
	 */
127
	public String getTitle() {
128
		return title;
129
	}
130
	/**
131
	 * @param title The title to set.
132
	 */
133
	public void setTitle(String title) {
134
		this.title = title;
135
	}
73 136
	
74

  
137
	
138
	
75 139
}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/WFSDriver.java
48 48
 *
49 49
 * $Id$
50 50
 * $Log$
51
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
51
 * Revision 1.2  2006-04-20 16:38:24  jorpiell
52
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
53
 *
54
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
52 55
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
53 56
 *
54 57
 *
......
66 69
	 */
67 70
	public void getCapabilities(URL server) throws WFSException;
68 71
	
72
	/**
73
	 * Obtiene la informacion asociada a una feature particular.
74
	 * Esta informaci?n puede ser un conjunto de campos o un
75
	 * esquema que los contiene. No devuleve nada. Simplemente
76
	 * actualiza la lista de features.
77
	 * @param featureType
78
	 * Nombre de la featurea a buscar
79
	 * @throws WFSException
80
	 */
81
	public void describeFeatureType(String featureType)throws WFSException;
69 82
	
70 83
	
71 84

  
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/wfs/FMapWFSDriver.java
5 5
import java.net.URL;
6 6
import java.util.Hashtable;
7 7
import java.util.Iterator;
8
import java.util.Set;
8 9
import java.util.Vector;
9 10

  
10 11
import org.gvsig.remoteClient.wfs.WFSClient;
12
import org.gvsig.remoteClient.wfs.WFSFeature;
11 13
import org.gvsig.remoteClient.wfs.WFSProtocolHandler.ServiceInformation;
12 14

  
13 15
import com.iver.cit.gvsig.fmap.DriverException;
......
60 62
 *
61 63
 * $Id$
62 64
 * $Log$
63
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
65
 * Revision 1.2  2006-04-20 16:38:24  jorpiell
66
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
67
 *
68
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
64 69
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
65 70
 *
66 71
 *
......
70 75
 */
71 76
public class FMapWFSDriver implements WFSDriver{
72 77
	private WFSClient client;
73
    private WFSLayerNode fmapRootLayer;
78
    private WFSLayerNode[] featuresList;
79
    private Hashtable features; 
74 80
	
75 81
	/*
76 82
	 *  (non-Javadoc)
......
82 88
				getClient(server).connect();
83 89
			} catch (Exception e) {			
84 90
				throw new WFSException(e);
85
			}
86
		
87
	}
88
	
91
			}		
92
	}	
89 93
    
90 94
	/**
91 95
	 * Devuelve WFSClient a partir de su URL.
......
103 107
		if (client == null) {
104 108
			client = new WFSClient(url.toString());
105 109
		}
106

  
107 110
		return client;
108 111
	}
109 112
	
......
132 135
	}
133 136
	
134 137
	/**
138
	 * Returns an array of WFSLayerNode's with the descriptors of 
139
	 * all features (retrieved using the getCapabilities operation)
140
	 * @return WFSLayerNode[]
141
	 */
142
	public WFSLayerNode[] getLayerList(){
143
		if (features == null) {
144
			features = new Hashtable();
145
			Hashtable wfsFeatures  = client.getFeatures();
146
				
147
			Iterator keys = wfsFeatures.keySet().iterator();
148
			featuresList = new WFSLayerNode[wfsFeatures.size()];
149
			
150
			for (int i=0 ; i<wfsFeatures.size() ; i++){
151
				WFSLayerNode lyr = new WFSLayerNode();
152
				WFSFeature feature = (WFSFeature)wfsFeatures.get(keys.next());
153
				
154
				lyr.setName(feature.getName());
155
				lyr.setTitle(feature.getTitle());
156
				lyr.setAbstract(feature.getAbstract());
157
				lyr.setFields(feature.getFields());
158
				
159
				featuresList[i] = lyr;
160
				features.put(lyr.getName(), lyr);
161
			}			
162
		}		
163
		return featuresList;
164
	}
165
	
166
	/**
167
	 * Returns all the feature information retrieved using a 
168
	 * describeFeatureTypeOpearion
169
	 * @param layerName
170
	 * Feature name
171
	 * @return
172
	 */
173
	public WFSLayerNode getLayerInfo(String layerName){
174
		WFSLayerNode lyr = (WFSLayerNode)features.get(layerName);
175
		if (lyr.getFields().size() == 0){
176
			try {
177
				describeFeatureType(layerName);
178
				WFSFeature feature = (WFSFeature) client.getFeatures().get(layerName);
179
				lyr.setFields(feature.getFields());
180
			} catch (WFSException e) {
181
				// The feature doesn't has fields
182
				e.printStackTrace();
183
			}
184
		}
185
		return lyr;
186
	}
187
	
188
	
189
	/**
135 190
     * @return The title of the service offered by the WMS server.
136 191
     */
137 192
    public String getServiceTitle() {
......
168 223
    }
169 224
    
170 225
    /**
171
     * Returns the feature list
172
     * @return Features vector
173
     */
174
    public Vector getFeatures(){
175
    	return client.getFeatures();
176
    }
177
    
178
    /**
179 226
     * 
180 227
     * @return the host
181 228
     */
......
189 236
    public String getVersion() {
190 237
        return client.getVersion();
191 238
    }
239

  
240
    /*
241
     *  (non-Javadoc)
242
     * @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#describeFeatureType(java.lang.String)
243
     */
244
	public void describeFeatureType(String featureType) throws WFSException {
245
		client.describeFeatureType(null,featureType);				
246
	}
192 247
	
193 248
	
194 249
}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/InfoPanel.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import javax.swing.JEditorPane;
4
import javax.swing.JPanel;
5
import javax.swing.JScrollPane;
6

  
7
import com.iver.andami.PluginServices;
8
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
9
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
56
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class InfoPanel extends JPanel {
64
	 private final String bgColor0 = "\"#FEEDD6\""; // light salmon
65
	    private final String bgColor1 = "\"#EAEAEA\""; // light grey
66
	    private final String bgColor2 = "\"#F2FEFF\""; // light blue
67
	    private final String bgColor3 = "\"#FBFFE1\""; // light yellow
68
	    
69
	    private final String service_title       = PluginServices.getText(this, "service_info");
70
	    private final String server              = PluginServices.getText(this, "server");
71
	    private final String server_type         = PluginServices.getText(this, "server_type");
72
	    private final String server_abstract     = PluginServices.getText(this, "server_abstract");
73
	    private final String server_title        = PluginServices.getText(this, "server_title");
74
	    private final String layers_title        = PluginServices.getText(this, "selected_layers");
75
	    private final String layer_title         = PluginServices.getText(this, "layer_title");
76
	    private final String layer_abstract      = PluginServices.getText(this, "layer_abstract");
77
	    private final String selected_parameters = PluginServices.getText(this, "selected_parameters");
78
	    private final String time_title               = PluginServices.getText(this, "time");
79
	    private final String format_title        = PluginServices.getText(this, "format");
80
	    private final String srs_title           = "CRS";
81
	    private final String properties			 = PluginServices.getText(this, "properties");
82
	    private final String layer_name			 = PluginServices.getText(this, "name");
83
		private JEditorPane editor = null;
84
	    
85
	    
86
	    /**
87
	     * Creates a new instance of InfoPanel with double buffer and null layout
88
	     *
89
	     */
90
		public InfoPanel() {
91
			super();
92
	        setLayout(null);
93
	        JScrollPane src = new JScrollPane();
94
	        src.setBounds(5, 5, 455, 375);
95
	        add(src, null);
96
	        src.setViewportView(getEditor());
97
		}
98

  
99
	    /**
100
	     * This method initializes tblInfo  
101
	     *  
102
	     * @return javax.swing.JTable   
103
	     */    
104
	    private JEditorPane getEditor() {
105
	        if (editor == null) {
106
	            editor = new JEditorPane();
107
	            editor.setEditable(false);
108
	        }
109
	        return editor;
110
	    }
111

  
112
	    
113
	    /**
114
	     * Fills the text pane with a data table describing the service and the
115
	     * selected settings.
116
	     * 
117
	     * @param WCSWizardData dataSource: connection info
118
	     * @param WCSLayer layer: the selected layer
119
	     * @param String time: the time value.
120
	     * @param String format: the format value
121
	     * @param String crs: the CRS value
122
	     * @param String parameters: comma-separated key-value string containing the values for the parameters
123
	     */
124
	    
125
	    public void refresh(WFSWizardData dataSource) {
126
	        
127
	       	String server_text = dataSource.getHost();
128
	        String server_type_text = dataSource.getServerType();
129
	        String server_title_text = dataSource.getTitle(); 
130
	        String server_abstract_text = dataSource.getAbstract();
131
	        String font = "Arial";
132
        
133
	        if (server_text == null) 
134
	            server_text = "-";
135
	        if (server_type_text == null)
136
	            server_type_text = "-";
137
	        if (server_title_text == null)
138
	            server_title_text = "-";
139
	        if (server_abstract_text == null)
140
	            server_abstract_text = "-";
141
//	        
142
//	        if (format == null)
143
//	            format = PluginServices.getText(this, "none_selected");
144
//	        if (crs == null)
145
//	            crs = PluginServices.getText(this, "none_selected");
146
//	        
147
	        String layers_html = "";
148
//	        if (layer!=null) {
149
//	            String layer_name_text = layer.getName();
150
////	            String time_text = (time==null) ? PluginServices.getText(this, "not_available") : time;//((FMapWMSStyle) selectedStyles.get(i)).title;
151
//	            String layer_abstract_text = layer.getDescription();
152
	            //String layer_title_text = layer.getTitle();
153
	        
154
//	            if (layer_name_text ==null)
155
//	            	layer_name_text = "-";
156
////	            if (time_text==null)
157
////	            	time_text = "-";
158
//	            if (layer_abstract_text==null)
159
//	            	layer_abstract_text = "-";
160
//	            if (layer_title_text == null)
161
//	            	layer_title_text = "-";
162
//	            String layer_html =
163
//	            	"  <tr valign=\"top\">" +
164
//	                "     <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_name+"</b></font></td>" +
165
//	                "     <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_name_text+"</font></td>" +
166
//	                "  </tr>" +
167
////	                "  <tr valign=\"top\">" +
168
////	                "     <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" +
169
////	                "     <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" +
170
////	                "  </tr>" +
171
//	                "  <tr valign=\"top\">" +
172
//	                "     <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" +
173
//	                "     <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" +
174
//	                "  </tr>" +
175
////	                "  <tr valign=\"top\">" +
176
////	                "     <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+time_title+"</b></font></td>" +
177
////	                "     <td bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+time_text+"</font></td>" +
178
////	                "  </tr>" +
179
//	                "  <tr>" +
180
//	                "  </tr>";
181
//	            layers_html += layer_html;
182
//	        }
183
//	        if (!layers_html.equals(""))
184
//	            layers_html =
185
//	                "  <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
186
//	                "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" +
187
//	                "  </tr>" + layers_html;
188
//	        String parameter_html = "";
189
//	        if (parameters!=null) {
190
//	        	boolean swap = false;
191
//	        	String[] myParameters = parameters.split("&");
192
//	        	for (int i = 0; i < myParameters.length; i++) {
193
//	        		String color = swap ? bgColor0 : bgColor1;
194
//	        		String[] parameter = myParameters[i].split("=");
195
//	        		parameter_html +=
196
//	        			"  <tr valign=\"top\" bgcolor="+color+">" +
197
//	        			"    <td width=\"120\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><b>"+parameter[0]+"</b></td>" +
198
//	        			"    <td width=\"322\" height=\"18\">"+parameter[1]+"</td>" +
199
//	        			"  </tr>";
200
//	        		swap = !swap;
201
//	        	}
202
//	        	parameter_html += 
203
//	        		"  <tr>" +
204
//	        		"  </tr>";
205
//	        }	
206
//	        if (!parameter_html.equals(""))
207
//	        	parameter_html = 
208
//	        		"  <tr valign=\"top\">" +
209
//	        		"    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+selected_parameters+"</font></b></td>" +
210
//	        		"  </tr>" + parameter_html;
211
//	        
212
//	        String format_html = 
213
//	        	"  <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
214
//	            "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+properties+"</font></b></td>" +
215
//	            "  </tr>" + 
216
//	            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
217
//	            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+format_title+"</b></font></td>" +
218
//	            "    <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+format+"</font></td>" +
219
//	            "  </tr>" +
220
//	            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
221
//	            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+srs_title+"</font></b></td>" +
222
//	            "    <td><font face=\""+font+"\" size=\"3\">"+crs+"</font></td>" +
223
//	            "  </tr>";
224
//	            
225
	        String html = 
226
	            "<html>" +
227
	            "<body>" +
228
	            "<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" +
229
	            "  <tr valign=\"top\" bgcolor=\"#FFFFFF\">" +
230
	            "    <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" +
231
	            "  </tr>" +
232
	            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
233
	            "    <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" +
234
	            "    <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" +
235
	            "  </tr>" +
236
	            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
237
	            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" +
238
	            "    <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" +
239
	            "  </tr>" +
240
	            "  <tr valign=\"top\" bgcolor="+bgColor0+">" +
241
	            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" +
242
	            "    <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" +
243
	            "  </tr>" +
244
	            "  <tr valign=\"top\" bgcolor="+bgColor1+">" +
245
	            "    <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" +
246
	            "    <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" +
247
	            "  </tr>" +
248
	            
249
	            "  <tr>" +
250
	            "  </tr>" +
251
//	            layers_html +
252
//	            parameter_html +
253
//	            format_html +
254
	            "</table>" +
255
	            "</body>" +
256
	            "</html>";
257
	        
258
	        getEditor().setContentType("text/html");
259
	        getEditor().setText(html);
260
	    }
261
}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/LayerTree.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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 Ib??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

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.1  2006-04-19 12:50:16  jorpiell
47
* Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
48
*
49
* Revision 1.6  2006/03/27 15:10:06  jaume
50
* images moved to libUI, and some code clean up
51
*
52
* Revision 1.5  2006/03/21 17:49:04  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.4  2006/02/28 15:25:14  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.2.2.4  2006/02/17 12:57:34  jaume
59
* oculta/eXconde los nombres de las capas y adem?s corrige el error de selecci?n de varios styles si hay alguna capa seleccionada repetida
60
*
61
* Revision 1.2.2.3  2006/01/31 16:25:24  jaume
62
* correcciones de bugs
63
*
64
* Revision 1.3  2006/01/26 16:07:14  jaume
65
* *** empty log message ***
66
*
67
* Revision 1.2.2.1  2006/01/26 12:59:32  jaume
68
* 0.5
69
*
70
* Revision 1.2  2006/01/24 14:36:33  jaume
71
* This is the new version
72
*
73
* Revision 1.1.2.1  2006/01/17 12:56:03  jaume
74
* *** empty log message ***
75
*
76
*
77
*/
78
/**
79
 * 
80
 */
81
package com.iver.cit.gvsig.gui.panels;
82

  
83
import java.awt.Component;
84

  
85
import javax.swing.JToolTip;
86
import javax.swing.JTree;
87
import javax.swing.ToolTipManager;
88
import javax.swing.tree.DefaultTreeCellRenderer;
89

  
90
import org.gvsig.gui.beans.controls.MultiLineToolTip;
91

  
92
import com.iver.andami.PluginServices;
93
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
94

  
95
/**
96
 * LayerTree extends the standard JTree class to allow use custom tooltips.
97
 * It is just JTree containing WMSLayerNode at its nodes.
98
 * 
99
 * @author jaume
100
 *
101
 */
102
public class LayerTree extends JTree {
103
	public boolean showLayerNames = false;
104
	private int count = 0;
105
	public LayerTree(){
106
        super();
107
        ToolTipManager.sharedInstance().registerComponent(this);
108
        ToolTipManager.sharedInstance().setDismissDelay(60*1000);
109
        setCellRenderer(new MyRenderer());
110
    }
111

  
112
    /**
113
     * Layer tree specific renderer allowing to show multiple line
114
     * tooltips 
115
     * @author jaume
116
     *
117
     */
118
    private class MyRenderer extends DefaultTreeCellRenderer {
119
       
120
        
121
       public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
122
            super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
123
            if (value instanceof WFSLayerNode){
124
                WFSLayerNode layer = (WFSLayerNode) value;
125
                
126
//                String myLatLonTxt = layer.getLatLonBox();
127
//                if (myLatLonTxt == null)
128
//                    myLatLonTxt = "-";
129
//                
130
                String myAbstract = layer.getDescription();
131
                
132
                if (myAbstract == null)
133
                    myAbstract = "-";
134
                else 
135
                    myAbstract = format(myAbstract.trim(), 100);
136
                
137
                String text =
138
                    PluginServices.getText(this, "abstract") + ":\n" + myAbstract +
139
                    "\n\n";
140
//                    PluginServices.getText(this, "covered_extension") + ":\n" + myLatLonTxt;
141
                
142
                setToolTipText(text);
143
                
144
                if (!showLayerNames) {
145
                	if (layer.getName() != null || layer.getName() == "") {
146
                		text = layer.toString();
147
                		text = text.substring(text.indexOf(']')+2, text.length());
148
                		setText(text);
149
                	}
150
                }
151
                
152
//                Dimension sz  = getPreferredSize();
153
//                sz.setSize((sz.getWidth()+50) - (3*count), sz.getHeight());
154
//                setPreferredSize(sz);
155
//                count++;
156
                
157
            } else {
158
                setToolTipText(null);
159
            }
160
            return this;
161
        }
162
    }
163
    
164
    
165
    /**
166
     * Cuts the message text to force its lines to be shorter or equal to 
167
     * lineLength.
168
     * @param message, the message.
169
     * @param lineLength, the max line length in number of characters.
170
     * @return the formated message.
171
     */
172
    public static String format(String message, int lineLength){
173
        if (message.length() <= lineLength) return message;
174
        String[] lines = message.split("\n");
175
        String theMessage = "";
176
        for (int i = 0; i < lines.length; i++) {
177
            String line = lines[i].trim();
178
            if (line.length()<lineLength)
179
                theMessage += line+"\n";
180
            else {
181
                String[] chunks = line.split(" ");
182
                String newLine = "";
183
                for (int j = 0; j < chunks.length; j++) {
184
                    int currentLength = newLine.length();
185
                    chunks[j] = chunks[j].trim();
186
                    if (chunks[j].length()==0)
187
                        continue;
188
                    if ((currentLength + chunks[j].length() + " ".length()) <= lineLength)
189
                        newLine += chunks[j] + " ";
190
                    else {
191
                        newLine += "\n"+chunks[j]+" ";
192
                        theMessage += newLine;
193
                        newLine = "";
194
                    }
195
                }
196
            }
197
        }
198
        return theMessage;
199
    }
200
    
201
    public JToolTip createToolTip() {
202
    	MultiLineToolTip tip = new MultiLineToolTip();
203
    	tip.setComponent(this);
204
    	return tip;
205
    }
206
}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSParamsPanel.java
63 63
 *
64 64
 * $Id$
65 65
 * $Log$
66
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
66
 * Revision 1.2  2006-04-20 16:38:24  jorpiell
67
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
68
 *
69
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
67 70
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
68 71
 *
69 72
 *
......
75 78
		
76 79
	private JTabbedPane jTabbedPane = null;  //  @jve:decl-index=0:visual-constraint="37,30"
77 80
	private WFSSelectFeaturePanel featurePanel = null;
81
	private WFSSelectFieldsPanel fieldsPanel = null;
82
	private WFSOptionsPanel optionsPanel = null;
78 83
	private WFSWizardData data;
79 84
	private WizardListenerSupport listenerSupport;
80 85
	public	static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wcs-wizard" );
81
	private InfoPanel infoPanel;
86
	private WFSInfoPanel infoPanel;
87
	private int indInfo;
88
	private int indFeature;
89
	private int indFields;
90
	private int indOptions;
82 91

  
83 92
	/**
84 93
	 * This method initializes jTabbedPane	
......
149 158
			jTabbedPane = new JTabbedPane();
150 159
			jTabbedPane.setSize(476, 422);
151 160
			jTabbedPane.addTab(PluginServices.getText(this, "info"), null, getInfoPanel());
152
			jTabbedPane.addTab(PluginServices.getText(this, "feature"), null, getPanelCovertures(), null);
161
			jTabbedPane.addTab(PluginServices.getText(this, "feature"), null, getPanelFeatures(), null);
162
			jTabbedPane.addTab(PluginServices.getText(this, "fields"),null, getPanelFields(), null);
163
			indFields = jTabbedPane.getTabCount()-1;
164
			jTabbedPane.setEnabledAt(indFields, false);
165
			jTabbedPane.addTab(PluginServices.getText(this, "options"),null, getOptionsPanel(), null);
153 166
		}
154 167
		return jTabbedPane;
155 168
	}
156 169
	
157
	private InfoPanel getInfoPanel() {
170
	private WFSInfoPanel getInfoPanel() {
158 171
		if (infoPanel==null) {
159
			infoPanel = new InfoPanel();
172
			infoPanel = new WFSInfoPanel();
160 173
			infoPanel.addFocusListener(new FocusListener() {
161 174
				public void focusGained(java.awt.event.FocusEvent e) {
162
					refreshInfo();
175
//					refreshInfo();
163 176
				}
164 177

  
165 178
				public void focusLost(FocusEvent e) {
......
169 182
		}
170 183
		return infoPanel;
171 184
	}
172
	/**
173
	 * Fires a notification to this wizard listeners telling them if the
174
	 * configuration is fair enough to send a GetCoverage request.
175
	 * @param b
176
	 */
177
	private void fireWizardComplete(boolean b){
178
		listenerSupport.callStateChanged(b);
179
		callStateChanged(b);
180
	}
181

  
182
	/**
183
	 * Refreshes the info shown in the info tab.
184
	 */
185
	public void refreshInfo() {
186
		infoPanel.refresh(data);
187
		
188
	}
189 185
	
190 186
	/**
191 187
	 * 
192
	 * @return the features list
188
	 * @return the selected list
193 189
	 */
194
	private Object getLstFeatures() {
195
		return featurePanel.getLstSelectedLayers();
190
	private Object getSelectedFeature() {
191
		return featurePanel.getSelectedFeature();
196 192
	}	
197 193
	
198 194
	
199 195
	/**
200
	 * This method initializes panelCovertures	
196
	 * This method initializes panelFeatures	
201 197
	 * 	
202 198
	 * @return javax.swing.JPanel	
203 199
	 */    
204
	private JPanel getPanelCovertures() {
200
	private JPanel getPanelFeatures() {
205 201
		if (featurePanel == null) {
206
			featurePanel = new WFSSelectFeaturePanel();
202
			featurePanel = new WFSSelectFeaturePanel(this);
207 203
			featurePanel.setLayout(null);
208 204
		}
209 205
		return featurePanel;
210 206
	}
207
	
211 208
	/**
209
	 * This method initializes fieldsPanel	
210
	 * 	
211
	 * @return javax.swing.JPanel	
212
	 */    
213
	private JPanel getPanelFields(){
214
		if (fieldsPanel == null) {
215
			fieldsPanel = new WFSSelectFieldsPanel();
216
			fieldsPanel.setLayout(null);
217
		}
218
		return fieldsPanel;
219
	}
220
	
221
	
222
	
223
	/**
224
	 * This method initializes fieldsPanel	
225
	 * 	
226
	 * @return javax.swing.JPanel	
227
	 */    
228
	private JPanel getOptionsPanel(){
229
		if (optionsPanel == null) {
230
			optionsPanel = new WFSOptionsPanel();
231
			optionsPanel.setLayout(null);
232
		}
233
		return optionsPanel;
234
	}
235
	
236
	/**
212 237
	 * Verifies that the selected parameters are enough to request the coverage
213 238
	 * to the server.
214 239
	 * 
......
248 273
	}
249 274
	
250 275
	/**
251
	 * Refreshes the wizard components data each time a coverage is selected.
276
	 * Refreshes the wizard components data each time a feature
277
	 * is selected.
252 278
	 * 
253
	 * Actualiza los datos de los componentes del wizard cada vez que se selecciona
254
	 * una cobertura diferente.
279
	 * Actualiza los datos de los componentes del wizard cada vez 
280
	 * que se selecciona una feature diferente.
281
	 * 
282
	 * @param feature
283
	 * Selected feature
255 284
	 */
256
	public void refreshData(){
257
//		String coverageName = getCurrentCoverageName();
258
//		cleanupWizard();
259
//		if (coverageName != null){
260
//			WFSLayer lyr = data.getLayer(coverageName);
261
//			getTxtName().setText(lyr.getTitle());
262
//			
263
//			// CRS
264
//			getLstCRSs().clearSelection();
265
//			getLstCRSs().setListData(lyr.getSRSs().toArray());
266
//
267
//			// Formats
268
//			getLstFormats().clearSelection();
269
//			getLstFormats().setListData(lyr.getFormats().toArray());
270
//			
271
//			// InterpolationMethods
272
//			boolean b = lyr.getInterpolationMethods() != null;
273
//			cmbInterpolationMethods.removeAllItems();
274
//			if (b) {
275
//				ArrayList im = lyr.getInterpolationMethods();
276
//				for (int i = 0; i < im.size(); i++) 					
277
//					cmbInterpolationMethods.addItem(im.get(i));
278
//			}
279
//			getChkUseInterpolationMethod().setEnabled(b);
280
//			getCmbInterpolationMethods().setEnabled(b);
281
//			
282
//			// Time
283
//			getLstTimes().removeAll();
284
//			ArrayList list = lyr.getTimePositions();
285
//			b = !(list == null || list.isEmpty());
286
//			if (b) 
287
//				getLstTimes().setListData(list.toArray());
288
//			jTabbedPane.setEnabledAt(indTime, b);
289
//	
290
//			// Parameters
291
//			cmbParam.removeAllItems();
292
//			list = lyr.getParameterList();
293
//			b = !(list == null || list.isEmpty());
294
//			if (b) {
295
//				for (int i = 0; i < list.size(); i++) 
296
//					cmbParam.addItem(list.get(i));
297
//				getSingleParamValuesList().setListData(
298
//						((FMapWCSParameter) cmbParam.getSelectedItem()).getValueList().toArray()
299
//						);
300
//			}
301
//			jTabbedPane.setEnabledAt(indParameter, b);
302
//			fireWizardComplete(isCorretlyConfigured());
303
//		}		
285
	public void refreshData(WFSLayerNode feature){
286
		infoPanel.refresh(data,feature);
287
		feature = (WFSLayerNode)data.getFeatureInfo(feature.getName());
288
		fieldsPanel.setFields(feature);
289
		jTabbedPane.setEnabledAt(indFields,true);		
304 290
	}
305 291

  
306 292
	/**
......
312 298
	 */
313 299
	public void setWizardData(WFSWizardData data) {
314 300
		this.data = data;
315
		featurePanel.setFeatures(data);
316
		refreshInfo();
301
		featurePanel.setWizardData(data);
302
		infoPanel.refresh(data,null);
317 303
	}
318 304
	
319 305
	/**
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectFieldsPanel.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import javax.swing.ImageIcon;
4
import javax.swing.JButton;
5
import javax.swing.JCheckBox;
6
import javax.swing.JPanel;
7
import javax.swing.JScrollPane;
8
import javax.swing.JTextField;
9

  
10
import com.iver.andami.PluginServices;
11
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
12
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
13
import javax.swing.JList;
14
import java.awt.Dimension;
15
import java.util.ArrayList;
16
import java.util.Hashtable;
17

  
18
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
19
 *
20
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
21
 *
22
 * This program is free software; you can redistribute it and/or
23
 * modify it under the terms of the GNU General Public License
24
 * as published by the Free Software Foundation; either version 2
25
 * of the License, or (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
35
 *
36
 * For more information, contact:
37
 *
38
 *  Generalitat Valenciana
39
 *   Conselleria d'Infraestructures i Transport
40
 *   Av. Blasco Ib??ez, 50
41
 *   46010 VALENCIA
42
 *   SPAIN
43
 *
44
 *      +34 963862235
45
 *   gvsig@gva.es
46
 *      www.gvsig.gva.es
47
 *
48
 *    or
49
 *
50
 *   IVER T.I. S.A
51
 *   Salamanca 50
52
 *   46005 Valencia
53
 *   Spain
54
 *
55
 *   +34 963163400
56
 *   dac@iver.es
57
 */
58
/* CVS MESSAGES:
59
 *
60
 * $Id$
61
 * $Log$
62
 * Revision 1.1  2006-04-20 16:38:24  jorpiell
63
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
64
 *
65
 *
66
 */
67
/**
68
 * This panel shows the feature fields list
69
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
70
 */
71
public class WFSSelectFieldsPanel extends JPanel {
72
	private static final long serialVersionUID = 3073243334672620143L;
73
	private JButton btnAddTime = null;
74
	private JButton btnDelTime = null;
75
	private JScrollPane jScrollPane3 = null;
76
	private JScrollPane jScrollPane4 = null;
77
	private JList lstFeatures = null;
78
	private JList lstSelectedFeatures = null; 
79
	
80
	public WFSSelectFieldsPanel(){
81
		super();
82
		initialize();
83
	}
84
	
85
	public void initialize(){
86
		this.setLayout(null);
87
		this.setBounds(5, 17, 464, 374);
88
		this.setBorder(javax.swing.BorderFactory.createTitledBorder(
89
				null, PluginServices.getText(this, "select_fields"),
90
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
91
				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
92
		this.add(getBtnAddTime(), null);
93
		this.add(getBtnDelTime(), null);
94
		this.add(getJScrollPane3(), null);
95
		this.add(getJScrollPane4(), null);
96
	}
97
	
98
	/**
99
	 * This method initializes jButton2	
100
	 * 	
101
	 * @return javax.swing.JButton	
102
	 */    
103
	public JButton getBtnAddTime() {
104
		if (btnAddTime == null) {
105
			btnAddTime = new JButton();
106
			btnAddTime.setBounds(241, 175, 50, 20);
107
			btnAddTime.setText(">");
108
			btnAddTime.addActionListener(
109
				new java.awt.event.ActionListener() {
110
					public void actionPerformed(java.awt.event.ActionEvent e) {
111
						addFeature();
112
					}
113
				});
114
		}
115
		return btnAddTime;
116
	}
117
	
118
	/**
119
	 * This method initializes btnDelTemps	
120
	 * 	
121
	 * @return javax.swing.JButton	
122
	 */    
123
	public JButton getBtnDelTime() {
124
		if (btnDelTime == null) {
125
			btnDelTime = new JButton();
126
			btnDelTime.setText("<");
127
			btnDelTime.setBounds(181, 175, 50, 20);
128
			btnDelTime.addActionListener(
129
				new java.awt.event.ActionListener() {
130
					public void actionPerformed(java.awt.event.ActionEvent e) {
131
						delFeature();
132
					}
133
				});
134
		}
135
		return btnDelTime;
136
	}
137
	
138
	/**
139
	 * This method initializes jScrollPane3	
140
	 * 	
141
	 * @return javax.swing.JScrollPane	
142
	 */    
143
	private JScrollPane getJScrollPane3() {
144
		if (jScrollPane3 == null) {
145
			jScrollPane3 = new JScrollPane();
146
			jScrollPane3.setBounds(10, 30, 158, 334);
147
			jScrollPane3.setViewportView(getLstFeatures());
148
		}
149
		return jScrollPane3;
150
	}
151
	
152
	/**
153
	 * This method initializes jScrollPane4	
154
	 * 	
155
	 * @return javax.swing.JScrollPane	
156
	 */    
157
	private JScrollPane getJScrollPane4() {
158
		if (jScrollPane4 == null) {
159
			jScrollPane4 = new JScrollPane();
160
			jScrollPane4.setBounds(304, 30, 158, 334);
161
			jScrollPane4.setViewportView(getLstSelectedFeatures());
162
		}
163
		return jScrollPane4;
164
	}
165
	
166
	/**
167
	 * This method initializes lstTemps	
168
	 * 	
169
	 * @return javax.swing.JList	
170
	 */    
171
	public JList getLstFeatures() {
172
		if (lstFeatures == null) {
173
			lstFeatures = new JList();
174
		}
175
		return lstFeatures;
176
	}
177
	
178
	/**
179
	 * This method initializes lstSelectedFeatures	
180
	 * 	
181
	 * @return javax.swing.JList	
182
	 */    
183
	public JList getLstSelectedFeatures() {
184
		if (lstSelectedFeatures == null) {
185
			lstSelectedFeatures = new JList();
186
			lstSelectedFeatures.addListSelectionListener(new javax.swing.event.ListSelectionListener() { 
187
				public void valueChanged(javax.swing.event.ListSelectionEvent e) {
188
//					lstSelectedFeatures.callStateChanged(isCorretlyConfigured());
189
				}
190
			});
191
		}
192
		return lstSelectedFeatures;
193
	}
194
	
195
	/**
196
	 * 
197
	 * @param feature
198
	 */
199
	public void setFields(WFSLayerNode feature){
200
		this.getLstSelectedFeatures().setListData(new Object[0]);
201
		Hashtable fields = feature.getFields();
202
		this.getLstFeatures().setListData(fields.values().toArray());	
203
	}
204
	
205
	/**
206
	 * Adds the selected items from the time list to the selected 
207
	 * features list.
208
	 */
209
	public void addFeature(){
210
		ArrayList times = new ArrayList();
211
		for (int i = 0; i < getLstSelectedFeatures()
212
				.getModel().getSize(); i++) {
213
			times.add(getLstSelectedFeatures().getModel()
214
					.getElementAt(i));
215
		}
216

  
217
		Object[] obj = getLstFeatures().getSelectedValues();
218
		for (int i = 0; i < obj.length; i++) {
219
			if (!times.contains(obj[i]))
220
				times.add(obj[i]);
221
		}
222
		getLstSelectedFeatures()
223
				.setListData(times.toArray());		
224

  
225
	}
226
	
227
	/**
228
	 * Removes the selected items from the selected features list.
229
	 */
230
	public void delFeature(){
231
		ArrayList features = new ArrayList();
232
		Object[] obj = getLstSelectedFeatures()
233
				.getSelectedValues();
234
		for (int i = 0; i < getLstSelectedFeatures()
235
				.getModel().getSize(); i++)
236
			features.add(getLstSelectedFeatures().getModel()
237
					.getElementAt(i));
238

  
239
		for (int j = 0; j < obj.length; j++)
240
			if (features.contains(obj[j]))
241
				features.remove(obj[j]);
242
		obj = new Object[features.size()];
243
		for (int i = 0; i < obj.length; i++) {
244
			obj[i] = features.get(i);
245
		}
246
		getLstSelectedFeatures()
247
				.setListData(features.toArray());		
248
	}
249
	
250

  
251
}
0 252

  
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/LayerList.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import java.awt.Component;
4
import java.awt.Dimension;
5

  
6
import javax.swing.DefaultListCellRenderer;
7
import javax.swing.JList;
8

  
9
import com.iver.andami.PluginServices;
10
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
11

  
12 1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
13 2
 *
14
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
15 4
 *
16 5
 * This program is free software; you can redistribute it and/or
17 6
 * modify it under the terms of the GNU General Public License
......
49 38
 *   +34 963163400
50 39
 *   dac@iver.es
51 40
 */
52
/* CVS MESSAGES:
53
 *
54
 * $Id$
55
 * $Log$
56
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
57
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
58
 *
59
 *
60
 */
41
package com.iver.cit.gvsig.gui.panels;
42

  
43
import java.awt.Component;
44
import java.awt.Dimension;
45

  
46
import javax.swing.DefaultListCellRenderer;
47
import javax.swing.JList;
48

  
49
import com.iver.andami.PluginServices;
50
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
51

  
61 52
/**
62
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
53
 * Class implementing a JList component adapted to the WCSLayer needs, such as a
54
 * multiline tooltip.
55
 * 
56
 * @author jaume dominguez faus - jaume.dominguez@iver.es
57
 * 
63 58
 */
64 59
public class LayerList extends JList {
65 60
	/**
......
81 76
		 * 
82 77
		 */
83 78
		private static final long serialVersionUID = -330306573320034784L;
84
		
85 79

  
86 80
		public Component getListCellRendererComponent(JList list, Object value,
87 81
				int index, boolean isSelected, boolean cellHasFocus) {
......
98 92
						setText(text);
99 93
					}
100 94
				}
101
				String myAbstract = layer.getDescription();
95
				String myAbstract = layer.getAbstract();
102 96
//				String myLonLatTxt = layer.getLonLatEnvelope();
103 97

  
104 98
                if (myAbstract == null)
......
107 101
                    myAbstract = format(myAbstract.trim(), 100);
108 102
				String text = PluginServices.getText(this, "abstract") + ":\n"
109 103
						+ myAbstract + "\n\n"
110
						+ PluginServices.getText(this, "covered_extension")
111
						;
112
						//						+ ":\n" + myLonLatTxt;
104
						+ PluginServices.getText(this, "covered_extension");
105
//						+ ":\n" + myLonLatTxt;
113 106

  
114 107
				setToolTipText(text);
115 108

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff