public void addParameterToTable(ToolParameterDescriptor param, int index) { try { operator.getToolParameterDescriptors().add(index, param); PropertyDescriptor propertyDescriptor = ParameterDescriptorFactory.convert(param, new ParameterDescriptorFactory().getSourceProductMap()); propertyDescriptor.setDefaultValue(param.getDefaultValue()); DefaultPropertySetDescriptor propertySetDescriptor = new DefaultPropertySetDescriptor(); propertySetDescriptor.addPropertyDescriptor(propertyDescriptor); PropertyContainer container = PropertyContainer.createMapBacked(new HashMap<>(), propertySetDescriptor); context.getPropertySet().addProperties(container.getProperties()); createDefaultComponent(param, propertyDescriptor); fireTableRowsChanged(); } catch (Exception ex){ logger.warning(ex.getMessage()); } }
SpectralAngleMapperFormModel(SpectralAngleMapperForm parentForm) { this.parentForm = parentForm; container = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("SpectralAngleMapperOp", parameterMap); }
protected void initializeOperatorUI(final String operatorName, final Map<String, Object> parameterMap) { this.operatorName = operatorName; this.paramMap = parameterMap; final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(operatorName); if (operatorSpi == null) { throw new IllegalArgumentException("operator " + operatorName + " not found"); } final ParameterDescriptorFactory descriptorFactory = new ParameterDescriptorFactory(); final OperatorDescriptor operatorDescriptor = operatorSpi.getOperatorDescriptor(); final PropertySetDescriptor propertySetDescriptor; try { propertySetDescriptor = PropertySetDescriptorFactory.createForOperator(operatorDescriptor, descriptorFactory.getSourceProductMap()); } catch (ConversionException e) { throw new IllegalStateException("Not able to init OperatorParameterSupport.", e); } propertySet = PropertyContainer.createMapBacked(paramMap, propertySetDescriptor); if (paramMap.isEmpty()) { try { propertySet.setDefaultValues(); } catch (IllegalStateException e) { // todo - handle exception here e.printStackTrace(); } } }
private PropertySet createPropertySet(AggregatorConfig config) { return PropertyContainer.createMapBacked(new HashMap<>(), config.getClass(), new ParameterDescriptorFactory()); }
private static PropertyContainer createParameterMap(Map<String, Object> map) { ParameterDescriptorFactory parameterDescriptorFactory = new ParameterDescriptorFactory(); final PropertyContainer container = PropertyContainer.createMapBacked(map, PixExOp.class, parameterDescriptorFactory); container.setDefaultValues(); return container; }
Assert.argument(parameterMap != null || propertySet == null, "parameterMap != null || propertySet == null"); this.descriptorFactory = new ParameterDescriptorFactory(); if (operatorDescriptor != null) { try { propertySetDescriptor = PropertySetDescriptorFactory.createForOperator(operatorDescriptor, descriptorFactory.getSourceProductMap()); } catch (ConversionException e) { throw new IllegalStateException("Not able to init OperatorParameterSupport.", e);
Object dirAttr = null; if(oldProp != null) { PropertyDescriptor descriptor = ParameterDescriptorFactory.convert(property, new ParameterDescriptorFactory().getSourceProductMap()); dirAttr = descriptor.getAttribute("directory"); context.getPropertySet().removeProperty(oldProp); descriptor = ParameterDescriptorFactory.convert(property, new ParameterDescriptorFactory().getSourceProductMap()); } catch (Exception ex) { property.setDefaultValue(null); descriptor = ParameterDescriptorFactory.convert(property, new ParameterDescriptorFactory().getSourceProductMap());
private BindingContext createBindingContext() { final PropertyContainer container = PropertyContainer.createObjectBacked(variableItem.variableConfig, new ParameterDescriptorFactory()); final BindingContext context = new BindingContext(container); PropertyDescriptor descriptor = container.getDescriptor(PROPERTY_VARIABLE_NAME); descriptor.setDescription("The name for the source band."); descriptor.setValidator(new VariableNameValidator()); container.setDefaultValues(); return context; }
@Before public void before() { final PropertyContainer pc = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("Mosaic"); bindingContext = new BindingContext(pc); }
propertyDescriptor = ParameterDescriptorFactory.convert(descriptor, new ParameterDescriptorFactory().getSourceProductMap()); } catch (ConversionException ex) { logger.warning(ex.getMessage());
public MetadataPlotSettings() { context = new BindingContext(PropertyContainer.createObjectBacked(this, new ParameterDescriptorFactory())); Property propertyRecordStart = context.getPropertySet().getProperty(PROP_NAME_RECORD_START_INDEX); propertyRecordStart.getDescriptor().setAttribute("stepSize", 1);
@Before public void before() { final PropertyContainer pc = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("Mosaic"); bindingContext = new BindingContext(pc); }
propertySet.removeProperty(property); PropertyDescriptor propertyDescriptor = ParameterDescriptorFactory.convert(this.parameter, new ParameterDescriptorFactory().getSourceProductMap());
if (operatorSpi == null) return; final ParameterDescriptorFactory parameterDescriptorFactory = new ParameterDescriptorFactory(); final PropertyContainer valueContainer = PropertyContainer.createMapBacked(parameterMap, operatorSpi.getOperatorClass(), parameterDescriptorFactory);
S2tbxMosaicFormModel(S2tbxMosaicForm parentForm) { this.parentForm = parentForm; container = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("Multi-size Mosaic", parameterMap); addTransientProperty(PROPERTY_UPDATE_PRODUCT, Product.class); addTransientProperty(PROPERTY_UPDATE_MODE, Boolean.class); addTransientProperty(PROPERTY_SHOW_SOURCE_PRODUCTS, Boolean.class); addTransientProperty(PROPERTY_NATIVE_RESOLUTION, Boolean.class); container.setDefaultValues(); container.setValue(PROPERTY_UPDATE_MODE, false); container.setValue(PROPERTY_SHOW_SOURCE_PRODUCTS, false); container.setValue(PROPERTY_NATIVE_RESOLUTION, true); container.addPropertyChangeListener(PROPERTY_SHOW_SOURCE_PRODUCTS, (PropertyChangeEvent evt)->{ if (Boolean.TRUE.equals(evt.getNewValue())) { final Collection<Product> products = sourceProductMap.values(); worldMapModel.setProducts(products.toArray(new Product[products.size()])); } else { worldMapModel.setProducts(null); } }); }
PropertyDescriptor propertyDescriptor = ParameterDescriptorFactory.convert(this.modifiedParameter, new ParameterDescriptorFactory().getSourceProductMap()); DefaultPropertySetDescriptor propertySetDescriptor = new DefaultPropertySetDescriptor(); propertySetDescriptor.addPropertyDescriptor(propertyDescriptor);
MosaicFormModel(MosaicForm parentForm) { this.parentForm = parentForm; container = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("Mosaic", parameterMap); addTransientProperty(PROPERTY_UPDATE_PRODUCT, Product.class); addTransientProperty(PROPERTY_UPDATE_MODE, Boolean.class); addTransientProperty(PROPERTY_SHOW_SOURCE_PRODUCTS, Boolean.class); container.setDefaultValues(); container.setValue(PROPERTY_UPDATE_MODE, false); container.setValue(PROPERTY_SHOW_SOURCE_PRODUCTS, false); container.addPropertyChangeListener(PROPERTY_SHOW_SOURCE_PRODUCTS, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (Boolean.TRUE.equals(evt.getNewValue())) { final Collection<Product> products = sourceProductMap.values(); worldMapModel.setProducts(products.toArray(new Product[products.size()])); } else { worldMapModel.setProducts(null); } } }); }
PropertyDescriptor propertyDescriptor = ParameterDescriptorFactory.convert(descriptor, new ParameterDescriptorFactory().getSourceProductMap()); if (defaultValue != null) { String defaultValueAsString = ToolParameterEditorDialog.processDefaultValue(defaultValue);
public BinningFormModel() { parameterMap = new HashMap<>(); propertySet = ParameterDescriptorFactory.createMapBackedOperatorPropertyContainer("Binning", parameterMap); hideProperties(); // dynamically init the value set String[] readerFormats = ProductIOPlugInManager.getInstance().getAllProductReaderFormatStrings(); Arrays.sort(readerFormats); PropertyDescriptor descriptor = propertySet.getDescriptor(PROPERTY_KEY_SOURCE_PRODUCT_FORMAT); descriptor.setValueSet(new ValueSet(readerFormats)); // Just for GUI propertySet.addProperty(createTransientProperty(PROPERTY_KEY_GLOBAL, Boolean.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_COMPUTE_REGION, Boolean.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_MANUAL_WKT, Boolean.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_WKT, String.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_BOUNDS, Boolean.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_EAST_BOUND, Double.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_NORTH_BOUND, Double.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_WEST_BOUND, Double.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_SOUTH_BOUND, Double.class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_SOURCE_PRODUCTS, Product[].class)); // temp propertySet.addProperty(createTransientProperty(PROPERTY_KEY_CONTEXT_SOURCE_PRODUCT, Product.class)); // temp propertySet.setDefaultValues(); propertySet.getProperty(PROPERTY_KEY_REGION).addPropertyChangeListener(evt -> { Geometry newGeometry = (Geometry) evt.getNewValue(); propertySet.setValue(PROPERTY_KEY_MANUAL_WKT, true); propertySet.setValue(PROPERTY_KEY_WKT, newGeometry.toText()); }); }