Revision 7271 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/infobypoint/MainInfoByPointDialog.java

View differences:

MainInfoByPointDialog.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.wms.app.wmsclient.infobypoint;
23 23

  
......
69 69
	private JScrollPane                     scroll             = null;
70 70
	private JPanel                          wmsInfo            = null;
71 71
	private JEditorPane                     jeditor            = null;
72
	private XMLViewer                       dlgXML             = null; 
72
	private XMLViewer                       dlgXML             = null;
73 73
	private XMLItem                         item               = null;
74 74
	private XMLContent                      xmlContent         = null;
75
	
75

  
76 76
	public class StringXMLItem extends TextXMLContent implements XMLItem {
77 77
		FLayer layer;
78
		
78

  
79 79
		public StringXMLItem(String text, FLayer lyr) {
80 80
			super(text);
81 81
			this.layer = lyr;
82 82
		}
83
		
83

  
84 84
		public FLayer getLayer(){
85 85
			return this.layer;
86 86
		}
......
141 141
			}
142 142
		}
143 143
	}
144
	
144

  
145 145
	public MainInfoByPointDialog() {
146 146
		setLayout(new BorderLayout());
147 147
		add((Component)getMainPanel(), BorderLayout.WEST);
148 148
		add((Component)getWMSInfoPanel(), BorderLayout.CENTER);
149 149
	}
150
	
150

  
151 151
	public MainInfoByPointPanel getMainPanel() {
152
		if(mainPanel == null) { 
152
		if(mainPanel == null) {
153 153
			HashMap<String, String> translations = new HashMap<String, String>();
154 154
			translations.put("info", PluginServices.getText(this, "info"));
155 155
			translations.put("view", PluginServices.getText(this, "view"));
......
188 188
		}
189 189
		return wmsInfo;
190 190
	}
191
	
191

  
192 192
	private JPanel getWMSXMLInfoPanel(String text) throws SAXException {
193 193
		if(wmsInfo == null) {
194 194
			wmsInfo = new JPanel();
......
218 218
			TreePath path = new TreePath(treeModel.getPathToRoot(n));
219 219
			dlgXML.getXmlTree().expandPath(path);
220 220
			//dlgXML.getXmlTree().setSelectionPath(path);
221
			
221

  
222 222
			wmsInfo.add(scroll, BorderLayout.CENTER);
223 223
		}
224 224
		return wmsInfo;
......
234 234
			}
235 235
			HTMLEditorKit kit = new HTMLEditorKit();
236 236
			jeditor.setEditorKit(kit);
237
			
237

  
238 238
			text = removeLabelBlock(text, "style");
239 239
			text = removeLabelBlock(text, "meta");
240
			
240

  
241 241
			StyleSheet s = kit.getStyleSheet();
242 242
			s.addRule("body {font-family:verdana; margin: 15px; }");
243 243
			s.addRule("caption {background-color:#FBFFE1;font-style:normal;color:black}");
......
261 261
			} catch (SAXException e) {
262 262
				LoggerFactory.getLogger(MainInfoByPointDialog.class).debug("", e);
263 263
			}
264
		} else { //if(type.equals("text/plain")) {
265
            if(jeditor == null) {
266
                wmsInfo = null;
267
                dlgXML = null;
268
                remove(1);
269
                add((Component)getWMSInfoPanel(), BorderLayout.CENTER);
270
            }
271
            jeditor.setText(text);
264 272
		}
265 273
	}
266
	
274

  
267 275
	/**
268 276
	 * Removes a label from the text
269 277
	 * @param text
......
278 286
		}
279 287
		return text;
280 288
	}
281
	
289

  
282 290
	public WindowInfo getWindowInfo() {
283 291
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE);
284 292
		m_viewinfo.setTitle(PluginServices.getText(this, "WMS InfoByPoint"));
......
286 294
		m_viewinfo.setWidth(700);
287 295
		return m_viewinfo;
288 296
	}
289
	
297

  
290 298
	public void windowClosed() {
291 299
		CompoundBehavior.setAllControlsBehavior(InfoByWMSPointExtension.oldBehavior);
292 300
	}
293
	
301

  
294 302
	public Object getWindowProfile() {
295 303
		return WindowInfo.PROPERTIES_PROFILE;
296 304
	}
......
298 306
	public InfoByPointDataModel getInfoByPointDataModel() {
299 307
		return getMainPanel().getInfoByPointDataModel();
300 308
	}
301
	
309

  
302 310
	public PixelInspector getPixelInspector() {
303 311
		return getMainPanel().getPixelInspectorPanel();
304 312
	}

Also available in: Unified diff