public DefaultAppContext(String applicationName) { this(applicationName, new JFrame(applicationName), new ProductManager(), new PropertyMap()); }
ProductManager restoreProducts(URI rootURI, ProgressMonitor pm, ProblemSolver problemSolver, List<Exception> problems) throws CanceledException { ProductManager productManager = new ProductManager(); try { pm.beginTask("Restoring products", productRefs.length); for (ProductRef productRef : productRefs) { try { Product product; File productFile = new File(rootURI.resolve(productRef.uri)); if (productFile.exists()) { product = ProductIO.readProduct(productFile); } else { product = problemSolver.solveProductNotFound(productRef.refNo, productFile); if (product == null) { throw new IOException("Product [" + productRef.refNo + "] not found."); } } product.setRefNo(productRef.refNo); productManager.addProduct(product); } catch (IOException e) { problems.add(e); } finally { pm.worked(1); } } } finally { pm.done(); } return productManager; }
@Before public void setupTest() { productManager = new ProductManager(); treeModel = new ProductTreeModel(productManager); }
private MyAppContext(Product[] originalProducts) { propertyMap = new PropertyMap(); productManager = new ProductManager(); for (Product originalProduct : originalProducts) { productManager.addProduct(originalProduct); } }
/** * Initializytion for the tests. */ @Override protected void setUp() { _productManager = new ProductManager(); _product1 = new Product("product1", _prodName, _sceneWidth, _sceneHeight); _product2 = new Product("product2", _prodName, _sceneWidth, _sceneHeight); _product3 = new Product("product3", _prodName, _sceneWidth, _sceneHeight); }
@BeforeClass public static void setupClass() { final Product product = createTestProduct("P", "T"); addVirtualBand(product, "V", ProductData.TYPE_INT32, "42"); productManager = new ProductManager(); productManager.addProduct(product); }
@Before public void setup() { Product product = new Product("P", "T", 10, 10); product.setFileLocation(new File(String.format("out/%s.dim", product.getName()))); band = new VirtualBand("V", ProductData.TYPE_INT32, 10, 10, "42"); product.addBand(band); productManager = new ProductManager(); productManager.addProduct(product); }
ProductManager productManager = new ProductManager(); for (Product product : products) { productManager.addProduct(product);
propertyMapChangeListeners = new ArrayList<>(4); productNodeListener = createProductNodeListener(); productManager = new ProductManager(); productManager.addListener(new ProductManager.Listener() { @Override
@Before public void setup() { p = new Product("P", "T", 1, 1); v = new VirtualBand("V", ProductData.TYPE_INT8, 1, 1, "1"); p.addBand(v); q = new Product("Q", "T", 1, 1); w = new VirtualBand("W", ProductData.TYPE_INT8, 1, 1, "0"); q.addBand(w); final ProductManager pm = new ProductManager(); pm.addProduct(p); pm.addProduct(q); final String expression = "$1.V == $2.W"; final MultiLevelModel multiLevelModel = ImageManager.getMultiLevelModel(v); image = new VirtualBandMultiLevelImage(new AbstractMultiLevelSource(multiLevelModel) { @Override public RenderedImage createImage(int level) { return VirtualBandOpImage.createMask(expression, p, ResolutionLevel.create(getModel(), level)); } }, expression, p); }
@Override protected void setUp() throws Exception { final ProductManager pm = new ProductManager(); final Product a = new Product("A", "AT", 17, 11); final Product b = new Product("B", "BT", 19, 67); a.addBand(new VirtualBand("a", ProductData.TYPE_INT32, 17, 11, "2")); b.addBand(new VirtualBand("b", ProductData.TYPE_INT32, 19, 67, "4")); pm.addProduct(a); pm.addProduct(b); final Converter<RasterDataNode, RasterRef> rasterConverter = new Converter<RasterDataNode, RasterRef>() { @Override public RasterRef getR(RasterDataNode raster) { return new RasterRef(raster.getProduct().getRefNo(), raster.getName()); } @Override public RasterDataNode getT(RasterRef rasterRef) { return getProduct(rasterRef.refNo).getRasterDataNode(rasterRef.rasterName); } private Product getProduct(int refNo) { for (Product product : pm.getProducts()) { if (refNo == product.getRefNo()) { return product; } } return null; } }; DefaultContext.getInstance().setConverter(RasterDataNode.class, RasterRef.class, rasterConverter); }