root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / histogram / ui / HistogramDialog.java @ 11033
History | View | Annotate | Download (3.04 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.histogram.ui; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.event.ActionEvent; |
23 |
import java.awt.event.ActionListener; |
24 |
|
25 |
import javax.swing.JPanel; |
26 |
|
27 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
28 |
import org.gvsig.raster.util.IHistogramable; |
29 |
|
30 |
import com.iver.andami.PluginServices; |
31 |
import com.iver.andami.ui.mdiManager.IWindow; |
32 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
33 |
/**
|
34 |
* <code>HistogramDialog</code>. Creaci?n de la ventana para gvSIG.
|
35 |
*
|
36 |
* @version 20/03/2007
|
37 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
38 |
* @author Borja Sanchez Zamorano (borja.sanchez@iver.es)
|
39 |
*/
|
40 |
public class HistogramDialog extends JPanel implements IWindow, ActionListener { |
41 |
private static final long serialVersionUID = 7362459094802955247L; |
42 |
private HistogramPanel histogramPanel = null; |
43 |
|
44 |
public HistogramDialog(int width, int height){ |
45 |
this.setSize(width, height);
|
46 |
this.setLayout(new BorderLayout(5, 5)); |
47 |
|
48 |
this.add(getHistogramPanel(), java.awt.BorderLayout.CENTER);
|
49 |
} |
50 |
|
51 |
/**
|
52 |
* Obtiene el panel con el histograma
|
53 |
* @return HistogramPanel
|
54 |
*/
|
55 |
public HistogramPanel getHistogramPanel(){
|
56 |
if(histogramPanel == null){ |
57 |
histogramPanel = new HistogramPanel();
|
58 |
histogramPanel.getButtonsPanel().addActionListener(this);
|
59 |
} |
60 |
return histogramPanel;
|
61 |
} |
62 |
|
63 |
public WindowInfo getWindowInfo() {
|
64 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
|
65 |
m_viewinfo.setTitle(PluginServices.getText(this, "histograma")); |
66 |
m_viewinfo.setHeight(this.getHeight());
|
67 |
m_viewinfo.setWidth(this.getWidth());
|
68 |
return m_viewinfo;
|
69 |
} |
70 |
|
71 |
/**
|
72 |
* Acciones a ejecutar cuando se cancela
|
73 |
*/
|
74 |
public void close() { |
75 |
try {
|
76 |
PluginServices.getMDIManager().closeWindow(this);
|
77 |
} catch (ArrayIndexOutOfBoundsException e) { |
78 |
//Si la ventana no se puede eliminar no hacemos nada
|
79 |
} |
80 |
} |
81 |
|
82 |
public void actionPerformed(ActionEvent e) { |
83 |
// TODO: ARQUITECTURA: Este close deberia ir en un listener
|
84 |
if (e.getActionCommand().compareTo(ButtonsPanel.BUTTON_CLOSE + "") == 0){ |
85 |
close(); |
86 |
} |
87 |
} |
88 |
|
89 |
public void clearSources() { |
90 |
getHistogramPanel().clearSources(); |
91 |
} |
92 |
|
93 |
public void setHistogramableSource(IHistogramable lyr, String name) { |
94 |
getHistogramPanel().setHistogramableSource(lyr, name); |
95 |
} |
96 |
} |