@Override public IParametersEditor createConfigurationEditor (String configId, IFilter existingFilter) { FilterConfiguration fc = configMap.get(configId); if ( fc == null ) return null; IFilter filter = instantiateFilter(fc, existingFilter); // Get the default parameters object IParameters params = filter.getParameters(); if ( params == null ) { return null; // This filter does not have parameters } return createParametersEditor(params.getClass().getName()); }
/** * Gets the parameters for a given custom filter configuration. This * default implementation gets the custom data from a file located * in the current directory at the time the method is called. */ @Override public IParameters getCustomParameters (FilterConfiguration config, IFilter existingFilter) { // Instantiate a filter (or re-use one) IFilter filter = instantiateFilter(config, existingFilter); // Get the default parameters object IParameters params = filter.getParameters(); if ( params == null ) { return null; // This filter does not have parameters } // Load the provided parameter file // In this implementation the file is stored in a given directory if (config.parametersLocation != null) { File file = new File(customParmsDir + config.parametersLocation); params.load(Util.URItoURL(file.toURI()), false); } else if (config.parameters != null) { params.fromString(config.parameters.toString()); } return params; }
@Override public IParameters getParameters (FilterConfiguration config, IFilter existingFilter) { IFilter filter = instantiateFilter(config, existingFilter); IParameters params = filter.getParameters(); // No parameters for this filter if ( params == null ) { return null; } // Default parameters if ( config.parametersLocation == null && config.parameters == null ) { return params; } if ( config.custom ) { params = getCustomParameters(config, filter); } else if (config.parametersLocation != null) { // Note that we cannot assume the parameters are the same // if we re-used an existing filter, as we cannot compare the // configuration identifiers URL url = filter.getClass().getResource(config.parametersLocation); params.load(url, false); } else if (config.parameters != null) { params.fromString(config.parameters.toString()); } return params; }
IFilter filter = instantiateFilter(fc, existingFilter);
IFilter filter = instantiateFilter(baseConfig, null); IParameters baseParams = getParameters(baseConfig, filter); if ( baseParams == null ) { // Filter without parameters