svn-gvsig-desktop / trunk / extensions / extRasterTools / src / com / iver / cit / gvsig / rasterTools / saveRaster / pruebas3 / SaveRasterPropsDialog.java @ 4446
History | View | Annotate | Download (3.46 KB)
1 |
/*
|
---|---|
2 |
* Creado el 7-marzo-2005
|
3 |
*/
|
4 |
package com.iver.cit.gvsig.rasterTools.saveRaster.pruebas3; |
5 |
|
6 |
import java.awt.Container; |
7 |
import java.awt.event.ActionEvent; |
8 |
|
9 |
import javax.swing.JDialog; |
10 |
|
11 |
import org.cresques.io.CXMLParser; |
12 |
import org.cresques.io.GeoRasterWriter; |
13 |
|
14 |
import com.iver.cit.gvsig.rasterTools.saveRaster.gui.SaveRasterDialog; |
15 |
import com.iver.cit.gvsig.rasterTools.saveRaster.pruebas2.SaveRasterDefaultPanel; |
16 |
|
17 |
|
18 |
/**
|
19 |
* Dialogo para abrir fichero.
|
20 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
21 |
*/
|
22 |
public class SaveRasterPropsDialog extends JDialog { |
23 |
|
24 |
//Ancho y alto ventana de propiedades de salvar a raster
|
25 |
private int widthWindow=386; |
26 |
private int heightWindow=310; |
27 |
|
28 |
private SaveRasterPropsDialogPanel contentPane = null; |
29 |
private GeoRasterWriter writer=null; |
30 |
private String formato = null; |
31 |
private String[] properties = null; |
32 |
private SaveRasterDefaultPanel parentDialog = null; |
33 |
|
34 |
/**
|
35 |
* Constructor
|
36 |
* @param writer
|
37 |
*/
|
38 |
public SaveRasterPropsDialog(GeoRasterWriter writer) {
|
39 |
super();
|
40 |
super.setModal(true); |
41 |
this.writer = writer;
|
42 |
this.formato = writer.getIdent();
|
43 |
//Obtenemos el tama?o de la ventana del XML generado por el driver
|
44 |
String xml = writer.getXMLPropertiesDialog();
|
45 |
if(xml!=null){ |
46 |
CXMLParser parser = new CXMLParser(xml);
|
47 |
widthWindow = Integer.parseInt(parser.getAttr("window","sizex")); |
48 |
heightWindow = Integer.parseInt(parser.getAttr("window","sizey")); |
49 |
} |
50 |
initialize(); |
51 |
} |
52 |
|
53 |
/**
|
54 |
* Inicializaci?n del dialogo
|
55 |
*
|
56 |
* @return javax.swing.JDialog
|
57 |
*/
|
58 |
private void initialize() { |
59 |
setBounds(0, 0, widthWindow, heightWindow); //Size Ventana |
60 |
setResizable(false);
|
61 |
setName("saveRasterProps");
|
62 |
setTitle("Propiedades de "+formato);
|
63 |
setContentPane(getContentPane()); |
64 |
//contentPane.getAcceptButton().setEnabled(false);
|
65 |
contentPane.getAcceptButton().addActionListener(new java.awt.event.ActionListener() {
|
66 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
67 |
acceptButtonActionPerformed(evt); |
68 |
closeJDialog(); |
69 |
} |
70 |
}); |
71 |
contentPane.getCancelButton().addActionListener(new java.awt.event.ActionListener() {
|
72 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
73 |
closeJDialog(); |
74 |
} |
75 |
}); |
76 |
contentPane.getApplyButton().addActionListener(new java.awt.event.ActionListener() {
|
77 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
78 |
acceptButtonActionPerformed(evt); |
79 |
} |
80 |
}); |
81 |
} |
82 |
|
83 |
/**
|
84 |
* Asigna el dialogo padre a una variable.
|
85 |
* @param parentDialog Cuadro de dialogo padre.
|
86 |
*/
|
87 |
public void setParentDialog(SaveRasterDefaultPanel parentDialog){ |
88 |
this.parentDialog = parentDialog;
|
89 |
} |
90 |
|
91 |
/**
|
92 |
* Inicializa contenPane
|
93 |
* @return Container
|
94 |
*/
|
95 |
public Container getContentPane() { |
96 |
if (contentPane == null) { |
97 |
contentPane = new SaveRasterPropsDialogPanel(writer);
|
98 |
} |
99 |
return contentPane;
|
100 |
} |
101 |
|
102 |
public void closeJDialog() { |
103 |
this.hide();
|
104 |
} |
105 |
|
106 |
|
107 |
/**
|
108 |
* Cuando se acepta se obtienen las propiedades seleccionadas
|
109 |
* @param e
|
110 |
*/
|
111 |
private void acceptButtonActionPerformed(ActionEvent e) { |
112 |
if(((SaveRasterPropsDialogPanel)getContentPane()).getListener().getProperties() != null){ |
113 |
properties = ((SaveRasterPropsDialogPanel)getContentPane()).getListener().getProperties(); |
114 |
//Salvamos las propiedades seleccionadas en el DriverProperties
|
115 |
parentDialog.driverProps.setProperties(writer.getIdent(), properties); |
116 |
} |
117 |
} |
118 |
} |