svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extDalTransform / src / main / java / org / gvsig / daltransform / swing / impl / DefaultDataTransformWizard.java @ 35605
History | View | Annotate | Download (5.29 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.daltransform.swing.impl; |
29 |
|
30 |
import java.util.List; |
31 |
|
32 |
import org.gvsig.andami.PluginServices; |
33 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
34 |
import org.gvsig.andami.ui.wizard.WizardAndami; |
35 |
import org.gvsig.daltransform.swing.DataTransformGui; |
36 |
import org.gvsig.daltransform.swing.DataTransformWizard; |
37 |
import org.gvsig.daltransform.swing.DataTransformWizardPanel; |
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
39 |
import org.gvsig.fmap.mapcontext.MapContext; |
40 |
|
41 |
|
42 |
/**
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
44 |
*/
|
45 |
public class DefaultDataTransformWizard extends WizardAndami implements DataTransformWizard{ |
46 |
/**
|
47 |
*
|
48 |
*/
|
49 |
private static final long serialVersionUID = 8346790424453722486L; |
50 |
private List<DataTransformWizardPanel> transformWizardPanels = null; |
51 |
//The three default panels
|
52 |
private LoadLayerWizardPanel loadLayerWizardPanel = null; |
53 |
private SelectDataStoreWizardPanel selectDataStoreWizardPanel = null; |
54 |
private SelectTransformWizardPanel selectTransformWizardPanel = null; |
55 |
//If the wizard has to use a concrete transformation
|
56 |
private DataTransformGui dataTransformGui = null; |
57 |
private int PANELS_TO_REFRESH = 2; |
58 |
|
59 |
/**
|
60 |
* @param wizard
|
61 |
*/
|
62 |
public DefaultDataTransformWizard() {
|
63 |
super(PluginServices.getIconTheme().get("feature-transform")); |
64 |
loadLayerWizardPanel = new LoadLayerWizardPanel();
|
65 |
selectDataStoreWizardPanel = new SelectDataStoreWizardPanel();
|
66 |
selectTransformWizardPanel = new SelectTransformWizardPanel();
|
67 |
initialize(); |
68 |
setSize(selectTransformWizardPanel.getMaxHeight(), |
69 |
selectTransformWizardPanel.getMaxWidth()); |
70 |
} |
71 |
|
72 |
private void initialize() { |
73 |
getWizardComponents().getFinishButton().setEnabled(false);
|
74 |
getWindowInfo().setTitle(PluginServices.getText(this, "transform_wizard")); |
75 |
addDataTransformWizardPanel(selectTransformWizardPanel); |
76 |
addDataTransformWizardPanel(selectDataStoreWizardPanel); |
77 |
getWizardComponents().setFinishAction(new DataTransformSelectionAction(this)); |
78 |
} |
79 |
|
80 |
/*
|
81 |
* (non-Javadoc)
|
82 |
* @see org.gvsig.app.daltransform.gui.DataTransformWizard#setApplicable(boolean)
|
83 |
*/
|
84 |
public void setApplicable(boolean isEnabled) { |
85 |
getWizardComponents().getNextButton().setEnabled(isEnabled); |
86 |
} |
87 |
|
88 |
/* (non-Javadoc)
|
89 |
* @see org.gvsig.app.daltransform.DataTransformWizard#getDataTransformGui()
|
90 |
*/
|
91 |
public DataTransformGui getDataTransformGui() {
|
92 |
if (dataTransformGui == null){ |
93 |
return selectTransformWizardPanel.getFeatureTransformGui();
|
94 |
}else{
|
95 |
return dataTransformGui;
|
96 |
} |
97 |
} |
98 |
|
99 |
/* (non-Javadoc)
|
100 |
* @see org.gvsig.app.daltransform.DataTransformWizard#setDataTransformGui(org.gvsig.app.daltransform.DataTransformGui)
|
101 |
*/
|
102 |
public void updateGui() { |
103 |
//Remove all the panels
|
104 |
for (int i=getWizardComponents().getWizardPanelList().size()-1 ; i>=PANELS_TO_REFRESH ; i--){ |
105 |
getWizardComponents().removeWizardPanel(i); |
106 |
} |
107 |
//Add new panels
|
108 |
transformWizardPanels = getDataTransformGui().createPanels(); |
109 |
for (int i=0 ; i<transformWizardPanels.size() ; i++){ |
110 |
addDataTransformWizardPanel(transformWizardPanels.get(i)); |
111 |
} |
112 |
addDataTransformWizardPanel(loadLayerWizardPanel); |
113 |
} |
114 |
|
115 |
public void addDataTransformWizardPanel(DataTransformWizardPanel dataTransformWizardPanel){ |
116 |
dataTransformWizardPanel.setDataTransformWizard(this);
|
117 |
getWizardComponents().addWizardPanel( |
118 |
new DataTransformWizardContainer(getWizardComponents(), dataTransformWizardPanel));
|
119 |
} |
120 |
|
121 |
/* (non-Javadoc)
|
122 |
* @see org.gvsig.app.daltransform.DataTransformWizard#getFeatureStore()
|
123 |
*/
|
124 |
public FeatureStore getFeatureStore() {
|
125 |
return selectDataStoreWizardPanel.getFeatureStore();
|
126 |
} |
127 |
|
128 |
/* (non-Javadoc)
|
129 |
* @see org.gvsig.app.daltransform.DataTransformWizard#isFeatureStoreLayer()
|
130 |
*/
|
131 |
public boolean isFeatureStoreLayer() { |
132 |
return selectDataStoreWizardPanel.isFeatureStoreLayer();
|
133 |
} |
134 |
|
135 |
public boolean isLayerLoaded(){ |
136 |
return loadLayerWizardPanel.isLayerLoaded();
|
137 |
} |
138 |
|
139 |
public MapContext getMapContext(){
|
140 |
return loadLayerWizardPanel.getMapContext();
|
141 |
} |
142 |
|
143 |
/* (non-Javadoc)
|
144 |
* @see org.gvsig.app.daltransform.gui.DataTransformWizard#getWindow()
|
145 |
*/
|
146 |
public IWindow getWindow() {
|
147 |
return this; |
148 |
} |
149 |
|
150 |
/* (non-Javadoc)
|
151 |
* @see org.gvsig.app.daltransform.gui.DataTransformWizard#setDataTransformGui(org.gvsig.app.daltransform.gui.DataTransformGui)
|
152 |
*/
|
153 |
public void setDataTransformGui(DataTransformGui dataTransformGui) { |
154 |
this.dataTransformGui = dataTransformGui;
|
155 |
PANELS_TO_REFRESH = 1;
|
156 |
getWizardComponents().removeWizardPanel(0);
|
157 |
} |
158 |
} |
159 |
|