svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / enhanced / ui / EnhancedDialog.java @ 19307
History | View | Annotate | Download (4.11 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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.rastertools.enhanced.ui; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.Dimension; |
23 |
import java.util.ArrayList; |
24 |
|
25 |
import javax.swing.JPanel; |
26 |
|
27 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
28 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
29 |
import org.gvsig.raster.beans.previewbase.PreviewBasePanel; |
30 |
import org.gvsig.raster.beans.previewbase.PreviewFiltering; |
31 |
|
32 |
import com.iver.andami.PluginServices; |
33 |
import com.iver.andami.ui.mdiManager.IWindow; |
34 |
import com.iver.andami.ui.mdiManager.IWindowListener; |
35 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
36 |
/**
|
37 |
* Dialogo para el realce por expansi?n del contraste
|
38 |
*
|
39 |
* 19/02/2008
|
40 |
* @author Nacho Brodin nachobrodin@gmail.com
|
41 |
*/
|
42 |
public class EnhancedDialog extends JPanel implements IWindow, IWindowListener { |
43 |
private static final long serialVersionUID = -5374834293534046986L; |
44 |
|
45 |
private PreviewBasePanel enhancedPanel = null; |
46 |
private GraphicsPanel graphicsPanel = null; |
47 |
private FLyrRasterSE lyr = null; |
48 |
private PreviewFiltering filteredPreview = null; |
49 |
private SelectorsPanel controlsPanel = null; |
50 |
|
51 |
/**
|
52 |
* Constructor
|
53 |
* @param lyr Capa raster sobre la que se opera
|
54 |
* @param lyrs Lista de capas cargadas en el TOC
|
55 |
* @param width Ancho
|
56 |
* @param height Alto
|
57 |
*/
|
58 |
public EnhancedDialog(FLyrRasterSE lyr, ArrayList lyrs, int width, int height) { |
59 |
this.setPreferredSize(new Dimension(width, height)); |
60 |
this.setSize(width, height);
|
61 |
this.setLayout(new BorderLayout(5, 5)); |
62 |
|
63 |
graphicsPanel = new GraphicsPanel(lyr);
|
64 |
filteredPreview = new PreviewFiltering();
|
65 |
controlsPanel = new SelectorsPanel(lyr, lyrs);
|
66 |
|
67 |
this.lyr = lyr;
|
68 |
this.add(getPreviewBasePanel(), java.awt.BorderLayout.CENTER);
|
69 |
|
70 |
EnhancedListener listener = new EnhancedListener(controlsPanel, graphicsPanel, getPreviewBasePanel(), this, filteredPreview); |
71 |
graphicsPanel.setListener(listener); |
72 |
|
73 |
getPreviewBasePanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(listener); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* Obtiene el panel con el histograma
|
78 |
* @return HistogramPanel
|
79 |
*/
|
80 |
public PreviewBasePanel getPreviewBasePanel() {
|
81 |
if (enhancedPanel == null) { |
82 |
ArrayList list = new ArrayList(); |
83 |
list.add(graphicsPanel); |
84 |
enhancedPanel = new PreviewBasePanel(list, controlsPanel, null, filteredPreview, lyr); |
85 |
} |
86 |
return enhancedPanel;
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* Acciones a ejecutar cuando se cancela
|
91 |
*/
|
92 |
public void close() { |
93 |
try {
|
94 |
PluginServices.getMDIManager().closeWindow(this);
|
95 |
} catch (ArrayIndexOutOfBoundsException e) { |
96 |
//Si la ventana no se puede eliminar no hacemos nada
|
97 |
} |
98 |
} |
99 |
|
100 |
/*
|
101 |
* (non-Javadoc)
|
102 |
* @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
|
103 |
*/
|
104 |
public WindowInfo getWindowInfo() {
|
105 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
|
106 |
if(getPreviewBasePanel().getLayer() != null) |
107 |
m_viewinfo.setAdditionalInfo(getPreviewBasePanel().getLayer().getName()); |
108 |
m_viewinfo.setTitle(PluginServices.getText(this, "enhanced")); |
109 |
m_viewinfo.setHeight(this.getHeight());
|
110 |
m_viewinfo.setWidth(this.getWidth());
|
111 |
return m_viewinfo;
|
112 |
} |
113 |
|
114 |
/*
|
115 |
* (non-Javadoc)
|
116 |
* @see com.iver.andami.ui.mdiManager.IWindowListener#windowClosed()
|
117 |
*/
|
118 |
public void windowClosed() { |
119 |
|
120 |
} |
121 |
|
122 |
public void windowActivated() {} |
123 |
} |