Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / branches / org.gvsig.raster.tools_dataaccess_refactoring / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / tool / colortable / ui / ColorTableDialog.java @ 2331

History | View | Annotate | Download (3.35 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.tools.app.basic.tool.colortable.ui;
23

    
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26

    
27
import javax.swing.JPanel;
28

    
29
import org.gvsig.andami.PluginServices;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.andami.ui.mdiManager.IWindowListener;
32
import org.gvsig.andami.ui.mdiManager.WindowInfo;
33
import org.gvsig.fmap.dal.coverage.exception.ColorTableException;
34
import org.gvsig.raster.fmap.layers.FLyrRaster;
35
/**
36
* <code>ColorTableDialog</code>. Creaci?n de la ventana de ColorTable para gvSIG.
37
*
38
* @author BorSanZa - Borja S?nchez Zamorano 
39
*/
40
public class ColorTableDialog extends JPanel implements IWindow, IWindowListener {
41
        private static final long serialVersionUID = -5374834293534046986L;
42
        private FLyrRaster layer = null;
43

    
44
        /**
45
         * Panel de recortado de imagen que est? en la libreria raster
46
         */
47
        private ColorTablePanel colorTablePanel = null;
48
        
49
        /**
50
         * Constructor
51
         * @param width Ancho
52
         * @param height Alto
53
         * @throws ColorTableException 
54
         */
55
        public ColorTableDialog(FLyrRaster layer, int width, int height) throws ColorTableException {
56
                this.layer = layer;
57
                setPreferredSize(new Dimension(width, height));
58
                setSize(width, height);
59
                setLayout(new BorderLayout(5, 5));
60
                add(getColorTablePanel(), java.awt.BorderLayout.CENTER);
61
        }
62

    
63
        /**
64
         * Obtiene el panel con el histograma
65
         * @return HistogramPanel
66
         * @throws ColorTableException 
67
         */
68
        private ColorTablePanel getColorTablePanel() throws ColorTableException {
69
                if (colorTablePanel == null) {
70
                        colorTablePanel = new ColorTablePanel(layer, this);
71
                }
72
                return colorTablePanel;
73
        }
74

    
75
        public WindowInfo getWindowInfo() {
76
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
77
                try {
78
                        if(getColorTablePanel().getLayer() != null)
79
                                m_viewinfo.setAdditionalInfo(getColorTablePanel().getLayer().getName());
80
                } catch (ColorTableException e1) {
81
                        //Esta excepci?n ya se ha debido capturar en la carga del dialogo por lo que no deber?a darse
82
                }
83
                m_viewinfo.setTitle(PluginServices.getText(this, "tablas_color"));
84
                m_viewinfo.setHeight(this.getHeight());
85
                m_viewinfo.setWidth(this.getWidth());
86
                return m_viewinfo;
87
        }
88

    
89
        public void windowClosed() {
90
                try {
91
                        getColorTablePanel().windowClosed();
92
                } catch (ColorTableException e1) {
93
                        //Esta excepci?n ya se ha debido capturar en la carga del dialogo por lo que no deber?a darse
94
                }
95
        }
96

    
97
        public void windowActivated() {}
98

    
99
        public Object getWindowProfile() {
100
                return WindowInfo.PROPERTIES_PROFILE;
101
        }
102
}