Revision 41553 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/panel/ExportFilterPanel.java

View differences:

ExportFilterPanel.java
234 234
    }
235 235
    
236 236
    public void checkPanel(boolean save)  throws NotContinueWizardException {
237
        I18nManager i18nManager = ToolsLocator.getI18nManager();
238
        String expresion = this.getFilterExpresion();
239
        if( expresion == null ) {
240
            throw new NotContinueWizardException(
241
                    i18nManager.getTranslation("_The_expresion_is_empty_Check_other_option_or_enter_a_expresion"), 
242
                    this, true
243
            );
244
        }
245
        Evaluator filter = this.getFilter();
246
        if( filter == null ) {
247
            throw new NotContinueWizardException(
248
                    i18nManager.getTranslation("_Problems_compiling_the_expesion_Check_the_sintax_Remember_use_SQL_expresion_sintax"), 
249
                    this, true
250
            );
251
        }
252
        DynObjectManager dynobjmanager = ToolsLocator.getDynObjectManager();
253
        try {
254
            DynObject values = dynobjmanager.createDynObject(this.store.getDefaultFeatureType());
255
            filter.evaluate(new Data(values));
256
        } catch (EvaluatorException ex) {
257
            throw new NotContinueWizardException(
258
                    i18nManager.getTranslation("_Check_the_sintax_Remember_use_SQL_expresion_sintax")
259
                    + "\n"
260
                    + ex.getCause().getMessage(), 
261
                    this, true
262
            );
263
        } catch (DataException ex) {
264
            logger.warn("Can't test expresion",ex);
265
            throw new NotContinueWizardException(
266
                    i18nManager.getTranslation("_Problems_to_create_a_data_set_to_test_the_expresion_See_register_for_more_information"), 
267
                    this, true
268
            );
269
        }
270
        if( save ) {
271
            String filterName = this.getFilterName();
272
            if( filterName!=null ) {
273
                ExporttoManager manager = ExporttoLocator.getManager();
274
                manager.addFilter(filterName, expresion);
237
        if( this.rdbFilteredRows.isSelected() ) {
238
            I18nManager i18nManager = ToolsLocator.getI18nManager();
239
            String expresion = this.getFilterExpresion();
240
            if( expresion == null ) {
241
                throw new NotContinueWizardException(
242
                        i18nManager.getTranslation("_The_expresion_is_empty_Check_other_option_or_enter_a_expresion"), 
243
                        this, true
244
                );
275 245
            }
246
            Evaluator filter = this.getFilter();
247
            if( filter == null ) {
248
                throw new NotContinueWizardException(
249
                        i18nManager.getTranslation("_Problems_compiling_the_expesion_Check_the_sintax_Remember_use_SQL_expresion_sintax"), 
250
                        this, true
251
                );
252
            }
253
            DynObjectManager dynobjmanager = ToolsLocator.getDynObjectManager();
254
            try {
255
                DynObject values = dynobjmanager.createDynObject(this.store.getDefaultFeatureType());
256
                filter.evaluate(new Data(values));
257
            } catch (EvaluatorException ex) {
258
                throw new NotContinueWizardException(
259
                        i18nManager.getTranslation("_Check_the_sintax_Remember_use_SQL_expresion_sintax")
260
                        + "\n"
261
                        + ex.getCause().getMessage(), 
262
                        this, true
263
                );
264
            } catch (DataException ex) {
265
                logger.warn("Can't test expresion",ex);
266
                throw new NotContinueWizardException(
267
                        i18nManager.getTranslation("_Problems_to_create_a_data_set_to_test_the_expresion_See_register_for_more_information"), 
268
                        this, true
269
                );
270
            }
271
            if( save ) {
272
                String filterName = this.getFilterName();
273
                if( filterName!=null ) {
274
                    ExporttoManager manager = ExporttoLocator.getManager();
275
                    manager.addFilter(filterName, expresion);
276
                }
277
            }
276 278
        }
277 279
    }
278 280

  

Also available in: Unified diff