Statistics
| Revision:

gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.app / org.gvsig.geoprocess.app.mainplugin / src / main / java / org / gvsig / geoprocess / gui / AlgorithmOutputPanel.java @ 218

History | View | Annotate | Download (3.04 KB)

1
/*
2
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2010 Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 */
21
package org.gvsig.geoprocess.gui;
22

    
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25

    
26
import javax.swing.JPanel;
27

    
28
import es.unex.sextante.core.GeoAlgorithm;
29

    
30
import org.gvsig.fmap.dal.DataServerExplorer;
31
import org.gvsig.fmap.dal.NewDataStoreParameters;
32
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
33
import org.gvsig.fmap.mapcontrol.dal.swing.datastore.DataStoreParametersCreationPanel;
34
import org.gvsig.fmap.mapcontrol.dal.swing.datastore.DefaultDataStoreParametersCreationPanel;
35
import org.gvsig.geoprocess.lib.sextante.dataObjects.OutputParameters;
36

    
37
/**
38
 * 
39
 * @author Nacho Brodin (nachobrodin@gmail.com)
40
 */
41
public class AlgorithmOutputPanel extends JPanel{
42

    
43
    private static final long serialVersionUID = -7028024211190671537L;
44

    
45
    private DataStoreParametersCreationPanel dataStoreCreationPanel = null;
46

    
47
    public AlgorithmOutputPanel() {
48
        super();
49
        initGUI();
50
    }
51

    
52
    public void init(GeoAlgorithm algorithm) {
53
        //m_Algorithm = algorithm;
54
        initGUI();
55
    }
56

    
57
    private void initGUI() {
58
        GridBagLayout gbl = new GridBagLayout();
59
        this.setLayout(gbl);
60

    
61
        GridBagConstraints gbc = new GridBagConstraints();
62
        gbc.fill = GridBagConstraints.HORIZONTAL;
63
        gbc.weightx = 1.0;
64
        gbc.gridx = 0;
65
        gbc.gridy = 0;      
66
        this.add(getDataStoreCreationPanel(), gbc);                
67
    }
68

    
69
    /**
70
     * Gets a ComboBox
71
     * @return
72
     */
73
    public DataStoreParametersCreationPanel getDataStoreCreationPanel() {
74
        if(dataStoreCreationPanel == null) {
75
            dataStoreCreationPanel = new DefaultDataStoreParametersCreationPanel();                         
76
        }
77
        return dataStoreCreationPanel;
78
    }
79

    
80
    public Object getOutputParameters() {
81
        NewDataStoreParameters newDataStoreParameters = 
82
            getDataStoreCreationPanel().getDataStoreParameters();
83
        DataServerExplorer dataServerExplorer =
84
            getDataStoreCreationPanel().getDataServerExplorer();
85
        if ((newDataStoreParameters != null) && (dataServerExplorer != null)){            
86
            return new OutputParameters((NewFeatureStoreParameters)newDataStoreParameters,
87
                dataServerExplorer);
88
        }else{
89
            return null;
90
        }
91
    }
92
}