root / trunk / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / properties / dialog / PropertiesRasterRegistrableDialog.java @ 13277
History | View | Annotate | Download (3.69 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 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
30 |
/**
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
32 |
*/
|
33 |
public class PropertiesRasterRegistrableDialog extends JPanel implements IWindow{ |
34 |
private static final long serialVersionUID = -2920327107654323732L; |
35 |
private RegistrableTabPanel registrable = null; |
36 |
private ButtonsPanel buttons = null; |
37 |
private TreeMap params = new TreeMap(); |
38 |
/**
|
39 |
* Nombre de la capa. Usado para destruir la ventana al eliminar la capa
|
40 |
*/
|
41 |
private String layerName = null; |
42 |
|
43 |
/**
|
44 |
* Constructor para el cuadro de propiedades
|
45 |
* @param lyrName Nombre de la capa
|
46 |
*/
|
47 |
public PropertiesRasterRegistrableDialog(FLayer lyr, String lyrName) { |
48 |
this.layerName = lyrName;
|
49 |
registrable = new RegistrableTabPanel(lyr);
|
50 |
buttons = new ButtonsPanel();
|
51 |
new PropertiesRasterListener(this); |
52 |
initialize(); |
53 |
} |
54 |
|
55 |
private void initialize() { |
56 |
this.setLayout(new BorderLayout()); |
57 |
add(registrable, BorderLayout.CENTER);
|
58 |
add(buttons, BorderLayout.SOUTH);
|
59 |
} |
60 |
|
61 |
/**
|
62 |
* Add params to register panels. Each extension knows the name and the class
|
63 |
* to its parameters. This method provide a generic way to register this.
|
64 |
* @param key Parameter name
|
65 |
* @param value parameter's value
|
66 |
*/
|
67 |
public void setParam(String key, Object value) { |
68 |
params.put(key, value); |
69 |
} |
70 |
|
71 |
/**
|
72 |
* Get a parameter registered by the user of this class. Each extension knows
|
73 |
* the name and the class to its parameters. This method provide a generic way
|
74 |
* to recover this.
|
75 |
* @param key Parameter name
|
76 |
* @return parameter's value
|
77 |
*/
|
78 |
public Object getParam(String key) { |
79 |
return params.get(key);
|
80 |
} |
81 |
|
82 |
/*
|
83 |
* (non-Javadoc)
|
84 |
* @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
|
85 |
*/
|
86 |
public WindowInfo getWindowInfo() {
|
87 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
|
88 |
if(layerName != null) |
89 |
m_viewinfo.setAdditionalInfo(layerName); |
90 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_raster")); |
91 |
m_viewinfo.setWidth(500);
|
92 |
m_viewinfo.setHeight(310);
|
93 |
return m_viewinfo;
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* Get buttons panel
|
98 |
* @return ButtonsPanel
|
99 |
*/
|
100 |
public ButtonsPanel getButtonsPanel() {
|
101 |
return this.buttons; |
102 |
} |
103 |
|
104 |
/**
|
105 |
* Get registrable panel
|
106 |
* @return RegistrableTabPanel
|
107 |
*/
|
108 |
public RegistrableTabPanel getRegistrablePanel() {
|
109 |
return this.registrable; |
110 |
} |
111 |
|
112 |
/**
|
113 |
* Acciones a ejecutar cuando se cancela
|
114 |
*/
|
115 |
public void close() { |
116 |
try {
|
117 |
PluginServices.getMDIManager().closeWindow(PropertiesRasterRegistrableDialog.this); |
118 |
} catch (ArrayIndexOutOfBoundsException e) { |
119 |
// Si la ventana no se puede eliminar no hacemos nada
|
120 |
} |
121 |
} |
122 |
} |