svn-gvsig-desktop / branches / gvSIG_03_raster / applications / appgvSIG / src / com / iver / cit / gvsig / gui / Panels / SaveRasterPropsDialog.java @ 1930
History | View | Annotate | Download (3.79 KB)
1 |
/*
|
---|---|
2 |
* Creado el 7-marzo-2005
|
3 |
*/
|
4 |
package com.iver.cit.gvsig.gui.Panels; |
5 |
|
6 |
import java.awt.Container; |
7 |
import java.awt.event.ActionEvent; |
8 |
|
9 |
import javax.swing.JDialog; |
10 |
|
11 |
import org.cresques.cts.IProjection; |
12 |
import org.cresques.io.CXMLParser; |
13 |
import org.cresques.io.GeoRasterWriter; |
14 |
import org.cresques.px.PxLayerList; |
15 |
import org.cresques.ui.raster.SavePropsSetupPanel; |
16 |
import org.cresques.ui.raster.SaveRasterPropsDialogPanel; |
17 |
|
18 |
/**
|
19 |
* Dialogo para abrir fichero.
|
20 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
21 |
*/
|
22 |
public class SaveRasterPropsDialog extends JDialog { |
23 |
|
24 |
private SaveRasterPropsDialogPanel contentPane = null; |
25 |
private GeoRasterWriter writer=null; |
26 |
private String formato = null; |
27 |
private IProjection currentProjection = null; |
28 |
private PxLayerList layerList = null; |
29 |
private int widthWindow=386; |
30 |
private int heightWindow=300; |
31 |
private String[] properties = null; |
32 |
private SaveRasterDialog 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(SaveRasterDialog 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 |
//contentPane.addAncestorListener(this);
|
99 |
} |
100 |
return contentPane;
|
101 |
} |
102 |
|
103 |
/**
|
104 |
* Asigna la proyecci?n
|
105 |
* @param prj Proyecci?n
|
106 |
*/
|
107 |
|
108 |
public void setProjection(IProjection prj) { |
109 |
this.currentProjection = prj;
|
110 |
} |
111 |
|
112 |
/**
|
113 |
*
|
114 |
* @param layerList
|
115 |
*/
|
116 |
|
117 |
public void setLayerList(PxLayerList layerList){ |
118 |
this.layerList = layerList;
|
119 |
} |
120 |
|
121 |
|
122 |
public void closeJDialog() { |
123 |
this.hide();
|
124 |
} |
125 |
|
126 |
|
127 |
/**
|
128 |
* Cuando se acepta se obtienen las propiedades seleccionadas
|
129 |
* @param e
|
130 |
*/
|
131 |
private void acceptButtonActionPerformed(ActionEvent e) { |
132 |
if(((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties()!=null){ |
133 |
properties = ((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties();
|
134 |
parentDialog.driverProps.setProperties(writer.getDriverName(), properties); |
135 |
} |
136 |
} |
137 |
} |