svn-gvsig-desktop / tags / gvSIGv0_6_1RELEASE / applications / appgvSIG / src / com / iver / cit / gvsig / gui / Panels / SaveRasterPropsDialog.java @ 5222
History | View | Annotate | Download (3.97 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 |
import com.iver.andami.PluginServices; |
19 |
|
20 |
/**
|
21 |
* Dialogo para abrir fichero.
|
22 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
23 |
*/
|
24 |
public class SaveRasterPropsDialog extends JDialog { |
25 |
|
26 |
private SaveRasterPropsDialogPanel contentPane = null; |
27 |
private GeoRasterWriter writer=null; |
28 |
private String formato = null; |
29 |
private IProjection currentProjection = null; |
30 |
private PxLayerList layerList = null; |
31 |
private int widthWindow=386; |
32 |
private int heightWindow=300; |
33 |
private String[] properties = null; |
34 |
private SaveRasterDialog parentDialog = null; |
35 |
|
36 |
/**
|
37 |
* Constructor
|
38 |
* @param writer
|
39 |
*/
|
40 |
public SaveRasterPropsDialog(GeoRasterWriter writer) {
|
41 |
super();
|
42 |
super.setModal(true); |
43 |
this.writer = writer;
|
44 |
this.formato = writer.getIdent();
|
45 |
//Obtenemos el tama?o de la ventana del XML generado por el driver
|
46 |
String xml = writer.getXMLPropertiesDialog();
|
47 |
if(xml!=null){ |
48 |
CXMLParser parser = new CXMLParser(xml);
|
49 |
widthWindow = Integer.parseInt(parser.getAttr("window","sizex")); |
50 |
heightWindow = Integer.parseInt(parser.getAttr("window","sizey")); |
51 |
} |
52 |
initialize(); |
53 |
} |
54 |
|
55 |
/**
|
56 |
* Inicializaci?n del dialogo
|
57 |
*
|
58 |
* @return javax.swing.JDialog
|
59 |
*/
|
60 |
private void initialize() { |
61 |
setBounds(0, 0, widthWindow, heightWindow); //Size Ventana |
62 |
setResizable(false);
|
63 |
setName("saveRasterProps");
|
64 |
setTitle(PluginServices.getText(this, "propiedades")); |
65 |
setContentPane(getContentPane()); |
66 |
|
67 |
contentPane.getAcceptButton().setText(PluginServices.getText(this, "aceptar")); |
68 |
contentPane.getCancelButton().setText(PluginServices.getText(this, "cancelar")); |
69 |
|
70 |
contentPane.getAcceptButton().addActionListener(new java.awt.event.ActionListener() {
|
71 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
72 |
acceptButtonActionPerformed(evt); |
73 |
closeJDialog(); |
74 |
} |
75 |
}); |
76 |
contentPane.getCancelButton().addActionListener(new java.awt.event.ActionListener() {
|
77 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
78 |
closeJDialog(); |
79 |
} |
80 |
}); |
81 |
contentPane.getApplyButton().addActionListener(new java.awt.event.ActionListener() {
|
82 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
83 |
acceptButtonActionPerformed(evt); |
84 |
} |
85 |
}); |
86 |
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* Asigna el dialogo padre a una variable.
|
91 |
* @param parentDialog Cuadro de dialogo padre.
|
92 |
*/
|
93 |
public void setParentDialog(SaveRasterDialog parentDialog){ |
94 |
this.parentDialog = parentDialog;
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* Inicializa contenPane
|
99 |
* @return Container
|
100 |
*/
|
101 |
public Container getContentPane() { |
102 |
if (contentPane == null) { |
103 |
contentPane = new SaveRasterPropsDialogPanel(writer);
|
104 |
//contentPane.addAncestorListener(this);
|
105 |
} |
106 |
return contentPane;
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* Asigna la proyecci?n
|
111 |
* @param prj Proyecci?n
|
112 |
*/
|
113 |
|
114 |
public void setProjection(IProjection prj) { |
115 |
this.currentProjection = prj;
|
116 |
} |
117 |
|
118 |
/**
|
119 |
*
|
120 |
* @param layerList
|
121 |
*/
|
122 |
|
123 |
public void setLayerList(PxLayerList layerList){ |
124 |
this.layerList = layerList;
|
125 |
} |
126 |
|
127 |
|
128 |
public void closeJDialog() { |
129 |
this.hide();
|
130 |
} |
131 |
|
132 |
|
133 |
/**
|
134 |
* Cuando se acepta se obtienen las propiedades seleccionadas
|
135 |
* @param e
|
136 |
*/
|
137 |
private void acceptButtonActionPerformed(ActionEvent e) { |
138 |
if(((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties()!=null){ |
139 |
properties = ((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties();
|
140 |
parentDialog.driverProps.setProperties(writer.getDriverName(), properties); |
141 |
} |
142 |
} |
143 |
} |