Revision 42676 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/DefaultJExporttoServicePanel.java

View differences:

DefaultJExporttoServicePanel.java
43 43
import org.gvsig.exportto.swing.impl.panel.MessagePanel;
44 44
import org.gvsig.exportto.swing.impl.wizard.DefaultWizardContainer;
45 45
import org.gvsig.exportto.swing.impl.wizard.ExportFilterWizard;
46
import org.gvsig.exportto.swing.impl.wizard.ExportTargetProjectionWizard;
46 47
import org.gvsig.exportto.swing.impl.wizard.ExporterSelectionWizard;
47 48
import org.gvsig.exportto.swing.impl.wizard.ExporttoProgressWizard;
48 49
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider;
......
67 68

  
68 69
/**
69 70
 * Default implementation for the {@link JExporttoServicePanel}.
70
 * 
71
 *
71 72
 * @author gvSIG Team
72 73
 * @version $Id$
73 74
 */
......
97 98
    // Wizards used to create the main wizard
98 99
    private ExporterSelectionWizard exporterSelectionWizard = null;
99 100
    private ExportFilterWizard exportFilterWizard = null;
101
    private ExportTargetProjectionWizard exportTargetProjectionWizard  = null;
100 102
    private ExporttoProgressWizard exporttoProgressWizard = null;
101 103

  
102 104
    // Listener for the finish and cancell button
......
113 115
        FLyrVect vlayer,
114 116
        ExporttoServiceFinishAction exporttoServiceFinishAction,
115 117
        int[] providerTypes) {
116
        
118

  
117 119
        this(
118 120
            uimanager,
119 121
            vlayer.getFeatureStore(),
......
122 124
            providerTypes);
123 125
        vectorLayer = vlayer;
124 126
    }
125
    
127

  
126 128
    public DefaultJExporttoServicePanel(DefaultExporttoSwingManager uimanager,
127 129
        FeatureStore featureStore, IProjection projection,
128 130
        ExporttoServiceFinishAction exporttoServiceFinishAction,
......
134 136
        this.providerTypes = providerTypes;
135 137
        this.status = JOptionPane.UNDEFINED_CONDITION;
136 138

  
137
        ImageIcon ii = IconThemeHelper.getImageIcon("wizard-export-to"); 
139
        ImageIcon ii = IconThemeHelper.getImageIcon("wizard-export-to");
138 140
        wizardPanelWithLogo = new WizardPanelWithLogo(ii);
139 141

  
140 142
        // Initialize the wizards
141 143
        exporterSelectionWizard =
142 144
            new ExporterSelectionWizard(this, providerTypes);
145
        exportTargetProjectionWizard = new ExportTargetProjectionWizard(this);
143 146
        exportFilterWizard = new ExportFilterWizard(this);
144 147
        exporttoProgressWizard = new ExporttoProgressWizard(this);
145 148

  
......
165 168
    public FeatureStore getFeatureStore() {
166 169
        return this.featureStore;
167 170
    }
168
    
171

  
169 172
    public void setNextButtonEnabled(boolean isEnabled) {
170 173
        wizardPanelWithLogo.setNextButtonEnabled(isEnabled);
171 174
    }
......
193 196
    public void selectExporttoSwingProvider(
194 197
        ExporttoSwingProviderFactory provider)
195 198
        throws ServiceException {
196
        
199

  
197 200
        if (vectorLayer == null) {
198 201
            exporttoSwingProvider =
199 202
                EXPORTTO_SWING_PROVIDER_MANAGER.createExporttoSwingProvider(
......
213 216
            wizardPanelWithLogo.addOptionPanel(new DefaultWizardContainer(
214 217
                exporttoSwingProvider.getPanelAt(i)));
215 218
        }
219
        exportTargetProjectionWizard.setVectorLayer(vectorLayer);
220
        if (exporttoSwingProvider.needsPanelTargetProjection()){
221
            wizardPanelWithLogo.addOptionPanel(exportTargetProjectionWizard);
222
        }
216 223
        wizardPanelWithLogo.addOptionPanel(exportFilterWizard);
217 224
        wizardPanelWithLogo.addOptionPanel(exporttoProgressWizard);
218 225
    }
......
220 227
    public Dimension getPreferredSize() {
221 228
        return new Dimension(800, 550);
222 229
    }
223
    
230

  
224 231
    public void export() throws DataException, ExporttoServiceException {
225 232
        this.lastWizard();
226 233

  
......
228 235
        FeatureSet featureSet = null;
229 236
        if ( exportFilterWizard.isFullLayerSelected() ) {
230 237
            featureSet = featureStore.getFeatureSet();
231
            
238

  
232 239
        } else if ( exportFilterWizard.isSelectedFeaturesSelected() ) {
233 240
            featureSet = (FeatureSet) featureStore.getSelection();
234
            
241

  
235 242
        } else {
236 243
            Evaluator filter = exportFilterWizard.getFilter();
237 244
            if( filter!=null ) {
......
240 247
                featureSet = featureStore.getFeatureSet(featureQuery);
241 248
            }
242 249
        }
250
        if( exporttoSwingProvider.needsPanelTargetProjection()) {
251
            exporttoSwingProvider.setTargetProjection(exportTargetProjectionWizard.getTargetProjection());
252
        }
243 253

  
244 254
        Export export = new Export(featureSet);
245 255
        export.start();
......
284 294
    private void showError(ExporttoServiceException e) {
285 295
        I18nManager i18nManager = ToolsLocator.getI18nManager();
286 296
        MessagePanel.showMessage(
287
                i18nManager.getTranslation("_Warning"), 
288
                i18nManager.getTranslation("_There_have_been_problems_exporting_data"), 
289
                e, 
297
                i18nManager.getTranslation("_Warning"),
298
                i18nManager.getTranslation("_There_have_been_problems_exporting_data"),
299
                e,
290 300
                e.getFeature()
291 301
        );
292 302
    }

Also available in: Unified diff