Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / properties / dialog / PropertiesRasterRegistrableDialog.java @ 12425

History | View | Annotate | Download (3.54 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 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
package org.gvsig.raster.gui.properties.dialog;
20

    
21
import java.awt.BorderLayout;
22
import java.util.TreeMap;
23

    
24
import javax.swing.JPanel;
25

    
26
import com.iver.andami.PluginServices;
27
import com.iver.andami.ui.mdiManager.IWindow;
28
import com.iver.andami.ui.mdiManager.WindowInfo;
29
/**
30
 * @author Nacho Brodin (nachobrodin@gmail.com)
31
 */
32
public class PropertiesRasterRegistrableDialog extends JPanel implements IWindow{
33
        private static final long   serialVersionUID = -2920327107654323732L;
34
        private RegistrableTabPanel registrable      = null;
35
        private ButtonsPanel        buttons          = null;
36
        private TreeMap             params           = new TreeMap();
37
        /**
38
         * Nombre de la capa. Usado para destruir la ventana al eliminar la capa
39
         */
40
        private String                                layerName                 = null;
41

    
42
        public PropertiesRasterRegistrableDialog(String lyrName) {
43
                this.layerName = lyrName;
44
                registrable = new RegistrableTabPanel();
45
                buttons = new ButtonsPanel();
46
                new PropertiesRasterListener(this);
47
                initialize();
48
        }
49

    
50
        private void initialize() {
51
                this.setLayout(new BorderLayout());
52
                add(registrable, BorderLayout.CENTER);
53
                add(buttons, BorderLayout.SOUTH);
54
        }
55

    
56
        /**
57
         * Add params to register panels. Each extension knows the name and the class
58
         * to its parameters. This method provide a generic way to register this.
59
         * @param key Parameter name
60
         * @param value parameter's value
61
         */
62
        public void setParam(String key, Object value) {
63
                params.put(key, value);
64
        }
65

    
66
        /**
67
         * Get a parameter registered by the user of this class. Each extension knows
68
         * the name and the class to its parameters. This method provide a generic way
69
         * to recover this.
70
         * @param key Parameter name
71
         * @return parameter's value
72
         */
73
        public Object getParam(String key) {
74
                return params.get(key);
75
        }
76

    
77
        /*
78
         *  (non-Javadoc)
79
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
80
         */
81
        public WindowInfo getWindowInfo() {
82
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
83
                if(layerName != null)
84
                        m_viewinfo.setAdditionalInfo(layerName);
85
                m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_raster"));
86
                m_viewinfo.setWidth(500);
87
                m_viewinfo.setHeight(310);
88
                return m_viewinfo;
89
        }
90

    
91
        /**
92
         * Get buttons panel
93
         * @return ButtonsPanel
94
         */
95
        public ButtonsPanel getButtonsPanel() {
96
                return this.buttons;
97
        }
98

    
99
        /**
100
         * Get registrable panel
101
         * @return RegistrableTabPanel
102
         */
103
        public RegistrableTabPanel getRegistrablePanel() {
104
                return this.registrable;
105
        }
106

    
107
        /**
108
         * Acciones a ejecutar cuando se cancela
109
         */
110
        public void close() {
111
                try {
112
                        PluginServices.getMDIManager().closeWindow(PropertiesRasterRegistrableDialog.this);
113
                } catch (ArrayIndexOutOfBoundsException e) {
114
                        // Si la ventana no se puede eliminar no hacemos nada
115
                }
116
        }
117
}