/** * 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 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; }
/** * Method called before actually showing the form, in which additional * initialisation may occur. */ public void prepareShow() { if (ioParamPanel != null) { ioParamPanel.initSourceProductSelectors(); } }
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(); } }
/** * Method called before hiding the form, in which additional * cleanup may be performed. */ public void prepareHide() { if (ioParamPanel != null) { ioParamPanel.releaseSourceProductSelectors(); } }
Map<String,Product> getSourceProductMap() { return ioParametersPanel.createSourceProductsMap(); } }
void prepareHide() { ioParametersPanel.releaseSourceProductSelectors(); }
@Override protected Product createTargetProduct() throws Exception { final HashMap<String, Product> sourceProducts = ioParametersPanel.createSourceProductsMap(); targetProduct = GPF.createProduct(operatorName, parameterSupport.getParameterMap(), sourceProducts); return targetProduct; }
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()); }
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); }
@Override public void hide() { ioParametersPanel.releaseSourceProductSelectors(); super.hide(); }
void prepareShow() { ioParametersPanel.initSourceProductSelectors(); }
@Override protected Product createTargetProduct() throws Exception { final HashMap<String, Product> sourceProducts = ioParametersPanel.createSourceProductsMap(); return GPF.createProduct(operatorName, parameterSupport.getParameterMap(), sourceProducts); }
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()); } }
ioParametersPanel = new DefaultIOParametersPanel(getAppContext(), operatorDescriptor, getTargetProductSelector(), targetProductSelectorDisplay); final ArrayList<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); final PropertySet propertySet = parameterSupport.getPropertySet(); bindingContext = new BindingContext(propertySet);
@Override public void hide() { productChangedHandler.releaseProduct(); ioParametersPanel.releaseSourceProductSelectors(); super.hide(); }
@Override public int show() { this.ioParametersPanel.initSourceProductSelectors(); if (this.form == null) { initForm(); if (getJDialog().getJMenuBar() == null) { OperatorMenu operatorMenu = createDefaultMenuBar(); getJDialog().setJMenuBar(operatorMenu.createDefaultMenu()); } } setContent(this.form); return super.show(); }
@Override protected Product createTargetProduct() throws Exception { HashMap<String, Product> sourceProducts = this.ioParametersPanel.createSourceProductsMap(); return GPF.createProduct(this.operatorName, this.parameterSupport.getParameterMap(), sourceProducts); }
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 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); }