Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wms / trunk / org.gvsig.raster.wms / org.gvsig.raster.wms.app / org.gvsig.raster.wms.app.wmsclient / src / main / java / org / gvsig / raster / wms / app / wmsclient / infobypoint / MainInfoByPointDialog.java @ 1194

History | View | Annotate | Download (5.16 KB)

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

    
24
import java.awt.BorderLayout;
25
import java.awt.Component;
26
import java.awt.Dimension;
27
import java.util.HashMap;
28

    
29
import javax.swing.ImageIcon;
30
import javax.swing.JEditorPane;
31
import javax.swing.JPanel;
32
import javax.swing.JScrollPane;
33

    
34
import org.gvsig.andami.IconThemeHelper;
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.andami.ui.mdiManager.IWindow;
37
import org.gvsig.andami.ui.mdiManager.WindowInfo;
38
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior;
39
import org.gvsig.raster.swing.RasterSwingLocator;
40
import org.gvsig.raster.swing.infobypoint.InfoByPointDataModel;
41
import org.gvsig.raster.swing.infobypoint.MainInfoByPointPanel;
42
import org.gvsig.raster.swing.pixelinspector.PixelInspector;
43

    
44
/**
45
 * Dialog for the information by point of a raster layer
46
 * @author Nacho Brodin (nachobrodin@gmail.com)
47
 */
48
public class MainInfoByPointDialog extends JPanel implements IWindow {
49
        private static final long               serialVersionUID   = 1L;
50
        private MainInfoByPointPanel            mainPanel          = null;
51
        private JScrollPane                     scroll             = null;
52
        private JPanel                          wmsInfo            = null;
53
        private JEditorPane                     jeditor            = null;
54
        
55
        public MainInfoByPointDialog() {
56
                setLayout(new BorderLayout());
57
                add((Component)getMainPanel(), BorderLayout.WEST);
58
                add((Component)getWMSInfoPanel(), BorderLayout.CENTER);
59
        }
60
        
61
        public MainInfoByPointPanel getMainPanel() {
62
                if(mainPanel == null) { 
63
                        HashMap<String, String> translations = new HashMap<String, String>();
64
                        translations.put("info", PluginServices.getText(this, "info"));
65
                        translations.put("view", PluginServices.getText(this, "view"));
66
                        translations.put("layer_list", PluginServices.getText(this, "layer_list"));
67
                        translations.put("band_values", PluginServices.getText(this, "band_values"));
68
                        translations.put("pixel_point", PluginServices.getText(this, "pixel_point"));
69
                        translations.put("view_point", PluginServices.getText(this, "view_point"));
70
                        translations.put("world_point", PluginServices.getText(this, "world_point"));
71
                        translations.put("bands", PluginServices.getText(this, "bands"));
72
                        translations.put("colors", PluginServices.getText(this, "colors"));
73
                        translations.put("coords", PluginServices.getText(this, "coords"));
74
                        translations.put("lat", PluginServices.getText(this, "lat"));
75
                        translations.put("long", PluginServices.getText(this, "long"));
76
                        translations.put("red", PluginServices.getText(this, "red"));
77
                        translations.put("green", PluginServices.getText(this, "green"));
78
                        translations.put("blue", PluginServices.getText(this, "blue"));
79
                        HashMap<String, ImageIcon> icons = new HashMap<String, ImageIcon>();
80
                        icons.put("forward-icon", IconThemeHelper.getImageIcon("forward-icon"));
81
                        icons.put("backward-icon", IconThemeHelper.getImageIcon("backward-icon"));
82
                        mainPanel = RasterSwingLocator.getSwingManager().createInfoByPointPanel(
83
                                        translations, icons, null);
84
                        ((JPanel)mainPanel).setPreferredSize(new Dimension(230, 0));
85
                }
86
                return mainPanel;
87
        }
88

    
89
        private JPanel getWMSInfoPanel() {
90
                if(wmsInfo == null) {
91
                        wmsInfo = new JPanel();
92
                        wmsInfo.setLayout(new BorderLayout());
93
                        jeditor = new JEditorPane();
94
                        scroll = new JScrollPane(jeditor);
95
                        wmsInfo.add(scroll, BorderLayout.CENTER);
96
                }
97
                return wmsInfo;
98
        }
99

    
100
        public void setWMSInfoText(String text, String type) {
101
                jeditor.setContentType(type);
102
                jeditor.setText(text);
103
        }
104
        
105
        /*
106
         * (non-Javadoc)
107
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
108
         */
109
        public WindowInfo getWindowInfo() {
110
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE);
111
                m_viewinfo.setTitle(PluginServices.getText(this, "WMS InfoByPoint"));
112
                m_viewinfo.setHeight(380);
113
                m_viewinfo.setWidth(500);
114
                return m_viewinfo;
115
        }
116
        
117
        /*
118
         * (non-Javadoc)
119
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowClosed()
120
         */
121
        public void windowClosed() {
122
                CompoundBehavior.setAllControlsBehavior(InfoByWMSPointExtension.oldBehavior);
123
        }
124
        
125
        public Object getWindowProfile() {
126
                return WindowInfo.PROPERTIES_PROFILE;
127
        }
128

    
129
        public InfoByPointDataModel getInfoByPointDataModel() {
130
                return getMainPanel().getInfoByPointDataModel();
131
        }
132
        
133
        public PixelInspector getPixelInspector() {
134
                return getMainPanel().getPixelInspectorPanel();
135
        }
136
}