/** * Constructs an product manager with an empty list of products. */ public ProductManager() { productList = new ProductNodeList<Product>(); productNodeNameChangeListener = new ProductNodeNameChangeListener(); }
/** * Constructs a node group for the given owner. * * @param owner The owner of the group. * @param name The group name. * @param takingOverNodeOwnership If {@code true}, child nodes will have this group as owner after adding. */ public ProductNodeGroup(ProductNode owner, String name, boolean takingOverNodeOwnership) { super(name, ""); this.nodeList = new ProductNodeList<T>(); this.takingOverNodeOwnership = takingOverNodeOwnership; setOwner(owner); }
/** * Creates a subset of this list using the given filter. * * @param filter the product node filter to be used, if <code>null</code> a clone of this list is created * * @return the subset */ public ProductNodeList<T> createSubset(ProductNodeFilter<T> filter) { ProductNodeList<T> list = new ProductNodeList<T>(); for (int i = 0; i < size(); i++) { T node = getAt(i); if (filter.accept(node)) { list.add(node); } } return list; }
private void openBandArithmeticDialog(final VisatApp visatApp, final String helpId) { final Product[] prods = visatApp.getProductManager().getProducts(); final ProductNodeList<Product> products = new ProductNodeList<Product>(); for (Product prod : prods) { products.add(prod); } BandMathsDialog bandMathsDialog = new BandMathsDialog(visatApp, visatApp.getSelectedProduct(), products, helpId); bandMathsDialog.show(); } }
final ProductNodeList<MetadataElement> metadataElementBackup = new ProductNodeList<>(); if (!saveProductHeaders) { String[] headerNames = new String[]{
private boolean openProductSubsetDialog(Product product) { _subsetProduct = null; boolean approve = false; if (product != null) { VisatApp visatApp = VisatApp.getApp(); JFrame mainFrame = visatApp.getMainFrame(); ProductSubsetDialog productSubsetDialog = new ProductSubsetDialog(mainFrame, product); if (productSubsetDialog.show() == ProductSubsetDialog.ID_OK) { ProductNodeList<Product> products = new ProductNodeList<Product>(); products.add(product); NewProductDialog newProductDialog = new NewProductDialog(visatApp.getMainFrame(), products, 0, true); newProductDialog.setSubsetDef(productSubsetDialog.getProductSubsetDef()); if (newProductDialog.show() == NewProductDialog.ID_OK) { _subsetProduct = newProductDialog.getResultProduct(); approve = _subsetProduct != null; if (!approve && newProductDialog.getException() != null) { visatApp.showErrorDialog("The product subset could not be created:\n" + newProductDialog.getException().getMessage()); } } } } return approve; } }
private Product newProductImpl() { if (getProductManager().getProductCount() == 0) { return null; } final ProductNodeList<Product> products = new ProductNodeList<>(); products.copyInto(getProductManager().getProducts()); final Product selectedProduct = getSelectedProduct(); if (selectedProduct == null) { return null; } final int selectedSourceIndex = products.indexOf(selectedProduct); final NewProductDialog dialog = new NewProductDialog(getMainFrame(), products, selectedSourceIndex, false); if (dialog.show() != NewProductDialog.ID_OK) { return null; } final Product product = dialog.getResultProduct(); if (product != null) { addProduct(product); updateState(); } else if (dialog.getException() != null) { showErrorDialog("The product subset could not be created:\n" + dialog.getException().getMessage()); } return product; }
@Override protected void setUp() { _nodeList = new ProductNodeList<MetadataAttribute>(); _attribute1 = new MetadataAttribute("attribute1", ProductData.createInstance(ProductData.TYPE_INT32), true); _attribute2 = new MetadataAttribute("attribute2", ProductData.createInstance(ProductData.TYPE_INT32), true); _attribute3 = new MetadataAttribute("attribute3", ProductData.createInstance(ProductData.TYPE_INT32), true); _attribute4 = new MetadataAttribute("attribute4", ProductData.createInstance(ProductData.TYPE_INT32), true); }