Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / Panels / SaveRasterPropsDialog.java @ 4236

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
         * Asigna el dialogo padre a una variable.
90
         * @param parentDialog        Cuadro de dialogo padre.
91
         */
92
        public void setParentDialog(SaveRasterDialog parentDialog){
93
                this.parentDialog = parentDialog;
94
        }
95
        
96
        /**
97
         * Inicializa contenPane        
98
         * @return Container        
99
         */    
100
        public Container getContentPane() {
101
                if (contentPane == null) {
102
                        contentPane = new SaveRasterPropsDialogPanel(writer); 
103
                        //contentPane.addAncestorListener(this);
104
                }
105
                return contentPane;
106
        }
107
        
108
        /**
109
         * Asigna la proyecci?n
110
         * @param prj Proyecci?n
111
         */
112
        
113
        public void setProjection(IProjection prj) {
114
                this.currentProjection = prj;
115
        }
116
        
117
        /**
118
         * 
119
         * @param layerList
120
         */
121
        
122
        public void setLayerList(PxLayerList layerList){
123
                this.layerList = layerList;
124
        }
125
        
126
                
127
        public void closeJDialog() {
128
                this.hide();
129
        }
130
        
131
        
132
        /**
133
         * Cuando se acepta se obtienen las propiedades seleccionadas
134
         * @param e
135
         */
136
    private void acceptButtonActionPerformed(ActionEvent e) {
137
            if(((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties()!=null){            
138
                    properties = ((SavePropsSetupPanel)((SaveRasterPropsDialogPanel)this.getContentPane()).getContentPanel()).getProperties();
139
                    parentDialog.driverProps.setProperties(writer.getDriverName(), properties);
140
            }        
141
    }
142
}