/** * Fetches the list of products selected in UI * * @return The list of selected products to be used as input source */ public Product[] getSourceProducts() { List<Product> sourceProducts = new ArrayList<>(); if (ioParamPanel != null){ ArrayList<SourceProductSelector> sourceProductSelectorList = ioParamPanel.getSourceProductSelectorList(); sourceProducts.addAll(sourceProductSelectorList.stream().map(SourceProductSelector::getSelectedProduct).collect(Collectors.toList())); } return sourceProducts.toArray(new Product[sourceProducts.size()]); }
private void initForm() { form = new JTabbedPane(); form.add("I/O Parameters", ioParametersPanel); form.add("Resampling Parameters", new JScrollPane(createParametersPanel())); reactToSourceProductChange(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct()); }
/** * Returns the selected product. * * @return the selected product */ private Product getSelectedProduct() { DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); return sourceProductSelectorList.get(0).getSelectedProduct(); }
/** * Returns the selected product. * * @return the selected product */ private Product getSelectedProduct() { DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); return sourceProductSelectorList.get(0).getSelectedProduct(); }
private void updateReferenceBandTargetWidthAndHeight() { if (referenceBandNameBox.getSelectedItem() != null) { final String bandName = referenceBandNameBox.getSelectedItem().toString(); final Band band = ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct().getBand(bandName); referenceBandTargetWidthLabel.setText("" + band.getRasterWidth()); referenceBandTargetHeightLabel.setText("" + band.getRasterHeight()); } }
/** * Returns the selected product. * * @return the selected product */ private Product getSelectedProduct() { DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); return sourceProductSelectorList.get(0).getSelectedProduct(); }
public ReflectanceTargetProductDialog(String operatorName, AppContext appContext, String title, String helpID, boolean targetProductSelectorDisplay) { super(operatorName, appContext, title, helpID, targetProductSelectorDisplay); DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); if (!sourceProductSelectorList.isEmpty()) { SelectionChangeListener listener = new SelectionChangeListener() { public void selectionChanged(SelectionChangeEvent event) { processSelectedProduct(); } public void selectionContextChanged(SelectionChangeEvent event) { } }; sourceProductSelectorList.get(0).addSelectionChangeListener(listener); } }
public CoregistrationTargetProductDialog(String operatorName, AppContext appContext, String title, String helpID, boolean targetProductSelectorDisplay) { super(operatorName, appContext, title, helpID, targetProductSelectorDisplay); DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); if (!sourceProductSelectorList.isEmpty()) { //sourceProductSelectorList.get(MASTER_PRODUCT_ID).addSelectionChangeListener(new ProductListSelectionChangeListener(MASTER_PRODUCT_ID, PROPERTY_MASTER_SOURCE_BAND)); //sourceProductSelectorList.get(SLAVE_PRODUCT_ID).addSelectionChangeListener(new ProductListSelectionChangeListener(SLAVE_PRODUCT_ID, PROPERTY_SLAVE_SOURCE_BAND)); SelectionChangeListener listener = new SelectionChangeListener() { @Override public void selectionChanged(SelectionChangeEvent event) { processSelectedProducts(); } @Override public void selectionContextChanged(SelectionChangeEvent event) { } }; //sourceProductSelectorList.get(MASTER_PRODUCT_ID).addSelectionChangeListener(listener); sourceProductSelectorList.get(SLAVE_PRODUCT_ID).addSelectionChangeListener(listener); } }
private void updateTargetResolutionTargetWidthAndHeight() { final Product selectedProduct = ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct(); final RasterDataNode node = getAnyRasterDataNode(selectedProduct); int targetWidth = 0; int targetHeight = 0; if (node != null) { final int resolution = Integer.parseInt(resolutionSpinner.getValue().toString()); final double nodeResolution = node.getImageToModelTransform().getScaleX(); targetWidth = (int) (node.getRasterWidth() * (nodeResolution / resolution)); targetHeight = (int) (node.getRasterHeight() * (nodeResolution / resolution)); } targetResolutionTargetWidthLabel.setText("" + targetWidth); targetResolutionTargetHeightLabel.setText("" + targetHeight); }
private DefaultIOParametersPanel createIOParamTab() { final DefaultIOParametersPanel ioPanel = new DefaultIOParametersPanel(appContext, operatorDescriptor, targetProductSelector, !operatorDescriptor.isHandlingOutputName()); final ArrayList<SourceProductSelector> sourceProductSelectorList = ioPanel.getSourceProductSelectorList(); if (!sourceProductSelectorList.isEmpty()) { final SourceProductSelector sourceProductSelector = sourceProductSelectorList.get(0); sourceProductSelector.addSelectionChangeListener(new SourceProductChangeListener()); } return ioPanel; }
private void initForm() { form = new JTabbedPane(); //only add ioParametersPanel if there are input or target products if(ioParametersPanel.getTargetProductSelectorDisplay() || ioParametersPanel.getSourceProductSelectorList().size() > 0) { form.add("I/O Parameters", ioParametersPanel); } else { //if there is no ioParametersPanel, the size of the form could be too small form.setPreferredSize(new Dimension(400, 300)); } if (bindingContext.getPropertySet().getProperties().length > 0) { final PropertyPane parametersPane = new PropertyPane(bindingContext); final JPanel parametersPanel = parametersPane.createPanel(); parametersPanel.setBorder(new EmptyBorder(4, 4, 4, 4)); form.add("Processing Parameters", new JScrollPane(parametersPanel)); updateSourceProduct(); } }
private void init(){ ioParametersPanel = new DefaultIOParametersPanel(appContext, operatorDescriptor, targetProductSelector, true); ArrayList<SourceProductSelector> sourceProductSelectorList = this.ioParametersPanel.getSourceProductSelectorList(); parametersPanel = new SpectralAngleMapperParametersPanel(this, appContext, samModel); thresholdPanel = new SpectralAngleMapperThresholdPanel(samModel); SelectionChangeListener currentListenerProduct = new SelectionChangeListener() { public void selectionChanged(SelectionChangeEvent event) { Product product = sourceProductSelectorList.get(CURRENT_PRODUCT).getSelectedProduct(); parametersPanel.updateBands(product); } public void selectionContextChanged(SelectionChangeEvent event) { } }; sourceProductSelectorList.get(CURRENT_PRODUCT).addSelectionChangeListener(currentListenerProduct); }
private void addParameters() { final PropertySet propertySet = parameterSupport.getPropertySet(); final List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList();
public GenericRegionMergingTargetProductDialog(String operatorName, AppContext appContext, String title, String helpID, boolean targetProductSelectorDisplay) { super(operatorName, appContext, title, helpID, targetProductSelectorDisplay); DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); if (!sourceProductSelectorList.isEmpty()) { SelectionChangeListener listener = new SelectionChangeListener() { public void selectionChanged(SelectionChangeEvent event) { processSelectedProduct(); } public void selectionContextChanged(SelectionChangeEvent event) { } }; sourceProductSelectorList.get(0).addSelectionChangeListener(listener); } BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet(); propertySet.getProperty(PROPERTY_MEGING_COST_CRITERION).addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { updateEnabledState(); } }); }
final ArrayList<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); final PropertySet propertySet = parameterSupport.getPropertySet(); bindingContext = new BindingContext(propertySet);
final ArrayList<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); final PropertySet propertySet = parameterSupport.getPropertySet(); bindingContext = new BindingContext(propertySet);
public ForestCoverChangeTargetProductDialog(String operatorName, AppContext appContext, String title, String helpID) { super(appContext, title, ID_APPLY_CLOSE, helpID); this.operatorName = operatorName; this.targetProductNameSuffix = ""; final TargetProductSelector selector = getTargetProductSelector(); selector.getModel().setSaveToFileSelected(false); selector.getSaveToFileCheckBox().setEnabled(true); processAnnotationsRec(ForestCoverChangeOp.class); this.operatorDescriptor = new OperatorDescriptorClass( this.parameterDescriptors.toArray(new ParameterDescriptor[0]), this.sourceProductDescriptors.toArray(new SourceProductDescriptor[0])); this.ioParametersPanel = new DefaultIOParametersPanel(getAppContext(), this.operatorDescriptor, getTargetProductSelector(), true); this.parameterSupport = new OperatorParameterSupport(this.operatorDescriptor); ArrayList<SourceProductSelector> sourceProductSelectorList = this.ioParametersPanel.getSourceProductSelectorList(); PropertySet propertySet = this.parameterSupport.getPropertySet(); this.bindingContext = new BindingContext(propertySet); SelectionChangeListener currentListenerProduct = new SelectionChangeListener() { public void selectionChanged(SelectionChangeEvent event) { Product product = sourceProductSelectorList.get(CURRENT_PRODUCT).getSelectedProduct(); if (product != null) { updateTargetProductName(product); } } public void selectionContextChanged(SelectionChangeEvent event) { } }; sourceProductSelectorList.get(CURRENT_PRODUCT).addSelectionChangeListener(currentListenerProduct); }
/** * Sets values according to the selected product. */ private void processSelectedProducts(int productId, String propertyName) { DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); Product selectedProduct = sourceProductSelectorList.get(productId).getSelectedProduct(); try { if (selectedProduct != null) { //String bands = String.join(",", selectedProduct.getBandGroup().getNodeNames()); BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet(); //PrivilegedAccessor.invokeMethod((DefaultSingleTargetProductDialog)this, "updateValueSet", new Object[]{selectedProduct, propertySet.getDescriptor(propertyName)}); Method m = PrivilegedAccessor.getMethod((DefaultSingleTargetProductDialog) this, "updateValueSet", new Class[]{PropertyDescriptor.class, Product.class}); m.invoke(null, new Object[]{propertySet.getDescriptor(propertyName), selectedProduct}); //propertySet.getDescriptor(propertyName)//.getDescriptor().setValueSet(ValueSet.parseValueSet(bands, String.class)); } } catch (Exception ex) { throw new OperatorException("Could not update band list as parameter: " + ex.getMessage()); } //update also the target product name according to slave if (productId != SLAVE_PRODUCT_ID) { selectedProduct = sourceProductSelectorList.get(SLAVE_PRODUCT_ID).getSelectedProduct(); } if (selectedProduct != null) { TargetProductSelectorModel targetProductSelectorModel = getTargetProductSelector().getModel(); targetProductSelectorModel.setProductName(selectedProduct.getName() + getTargetProductNameSuffix()); } }
private void processSelectedProducts() { DefaultIOParametersPanel ioParametersPanel = getDefaultIOParametersPanel(); List<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet();
final ArrayList<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); final PropertySet propertySet = parameterSupport.getPropertySet(); bindingContext = new BindingContext(propertySet);