@Override public Component getListCellRendererComponent(JList list, Product value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); label.setText(value.getDisplayName()); return label; }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final Component cellRendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (cellRendererComponent instanceof JLabel) { final JLabel label = (JLabel) cellRendererComponent; if (value instanceof Product) { final Product product = (Product) value; label.setText(product.getDisplayName()); } else { label.setText(" "); } } return cellRendererComponent; } }
private String getProductNodeDisplayName() { if (raster != null) { return raster.getDisplayName(); } else { if (product != null) { return product.getDisplayName(); } else { return ""; } } }
private String getDisplayName(Product rasterDataNode) { return multipleProducts ? rasterDataNode.getDisplayName() : rasterDataNode.getName(); }
private static String[] getCompatibleProducts(final Product destProduct) { final List<String> prodList = new ArrayList<>(); final Product[] products = SnapApp.getDefault().getProductManager().getProducts(); for (Product p : products) { if (p != destProduct && p.getSceneRasterWidth() == destProduct.getSceneRasterWidth() && p.getSceneRasterHeight() == destProduct.getSceneRasterHeight()) { prodList.add(p.getDisplayName()); } } return prodList.toArray(new String[prodList.size()]); }
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { JComboBox box = (JComboBox) e.getSource(); Object comp = box.getUI().getAccessibleChild(box, 0); if (!(comp instanceof JPopupMenu)) { return; } JComponent scrollPane = (JComponent) ((JPopupMenu) comp).getComponent(0); Dimension size = new Dimension(); size.width = scrollPane.getPreferredSize().width; final int boxItemCount = box.getModel().getSize(); for (int i = 0; i < boxItemCount; i++) { final JLabel label = new JLabel(); Object elementAt = box.getModel().getElementAt(i); if (elementAt != null && elementAt instanceof Product) { label.setText(((Product) elementAt).getDisplayName()); } size.width = Math.max(label.getPreferredSize().width, size.width); } size.height = scrollPane.getPreferredSize().height; scrollPane.setPreferredSize(size); scrollPane.setMaximumSize(size); }
private static Product[] getCompatibleProducts(final Product targetProduct, final Product[] productsList) { final List<Product> compatibleProducts = new ArrayList<>(1); compatibleProducts.add(targetProduct); final float geolocationEps = 180; Debug.trace("BandMathsDialog.geolocationEps = " + geolocationEps); Debug.trace("BandMathsDialog.getCompatibleProducts:"); Debug.trace(" comparing: " + targetProduct.getName()); if (productsList != null) { for (final Product product : productsList) { if (targetProduct != product) { Debug.trace(" with: " + product.getDisplayName()); final boolean isCompatibleProduct = targetProduct.isCompatibleProduct(product, geolocationEps); Debug.trace(" result: " + isCompatibleProduct); if (isCompatibleProduct) { compatibleProducts.add(product); } } } } return compatibleProducts.toArray(new Product[compatibleProducts.size()]); }
private Product[] getCompatibleProducts() { if (targetProduct == null) { return null; } final Vector<Product> compatibleProducts = new Vector<>(); compatibleProducts.add(targetProduct); final float geolocationEps = 180; Debug.trace("BandArithmetikDialog.geolocationEps = " + geolocationEps); Debug.trace("BandArithmetikDialog.getCompatibleProducts:"); Debug.trace(" comparing: " + targetProduct.getName()); for (int i = 0; i < productsList.size(); i++) { final Product product = productsList.getAt(i); if (targetProduct != product) { Debug.trace(" with: " + product.getDisplayName()); final boolean compatibleProduct = targetProduct.isCompatibleProduct(product, geolocationEps); Debug.trace(" result: " + compatibleProduct); if (compatibleProduct) { compatibleProducts.add(product); } } } return compatibleProducts.toArray(new Product[compatibleProducts.size()]); }
for (Product targetProduct : allProducts) { if (targetProduct != sourceProduct) { panel.add(new JLabel(targetProduct.getDisplayName()));
private void setImage(final Product product, final Quicklook quicklook) { final BufferedImage img; if(quicklook != null && (quicklook.hasImage() || quicklook.hasCachedImage())) { img = quicklook.getImage(ProgressMonitor.NULL); } else { img = noDataImage; } if(currentProduct == product && imgPanel.getImage() == img) { return; } currentProduct = product; nameLabel.setText(product.getDisplayName()); imgPanel.setImage(img); updateButtons(); }
productNameComboBox.setToolTipText(product.getFileLocation().getPath()); } else { productNameComboBox.setToolTipText(product.getDisplayName());
private JPanel createInfoPanel() { final JLabel parentProductLabel = new JLabel(_currentProduct.getDisplayName()); final JLabel widthValueLabel = new JLabel("" + _currentProduct.getSceneRasterWidth() + " pixel"); final JLabel heightValueLabel = new JLabel("" + _currentProduct.getSceneRasterHeight() + " pixel");
"Do you want to save it now?\n\n" + "Note: If you select 'No', the session cannot be saved.", product.getDisplayName()); "Note: It is recommended to save the product in order to \n" + "fully restore the session later.", product.getDisplayName());
private Boolean exportProduct(Product exportProduct, File newFile, String formatName) { SnapApp.getDefault().setStatusBarMessage(MessageFormat.format("Exporting product ''{0}'' to {1}...", exportProduct.getDisplayName(), newFile)); WriteProductOperation operation = new WriteProductOperation(exportProduct, newFile, formatName, false); ProgressUtils.runOffEventThreadWithProgressDialog(operation, getDisplayName(), operation.getProgressHandle(), true, 50, 1000); SnapApp.getDefault().setStatusBarMessage(""); return operation.getStatus(); }
compatibleNodeLists.add(new CompatibleNodeList(selectedProduct.getDisplayName(), compatibleNodes)); collectCompatibleRasterDataNodes(modelCRS, product.getTiePointGrids(), compatibleNodes); if (!compatibleNodes.isEmpty()) { compatibleNodeLists.add(new CompatibleNodeList(product.getDisplayName(), compatibleNodes));
static Boolean saveProduct(Product product) { Assert.notNull(product.getFileLocation()); final File file = product.getFileLocation(); if (file.isFile() && !file.canWrite()) { Dialogs.showWarning(Bundle.CTL_SaveProductActionName(), MessageFormat.format("The product\n" + "''{0}''\n" + "exists and cannot be overwritten, because it is read only.\n" + "Please choose another file or remove the write protection.", file.getPath()), null); return false; } SnapApp.getDefault().setStatusBarMessage(MessageFormat.format("Writing product ''{0}'' to {1}...", product.getDisplayName(), file)); boolean incremental = true; WriteProductOperation operation = new WriteProductOperation(product, incremental); BaseProgressUtils.runOffEventThreadWithProgressDialog(operation, Bundle.CTL_SaveProductActionName(), operation.getProgressHandle(), true, 50, 1000); SnapApp.getDefault().setStatusBarMessage(""); return operation.getStatus(); }
private void updateMainFrameTitle(ProductNode node) { String title; if (node != null) { Product product = node.getProduct(); if (product != null) { if (node == product) { title = String.format("%s - [%s]", product.getDisplayName(), getProductPath(product)); } else { title = String.format("%s - [%s] - [%s]", node.getDisplayName(), product.getName(), getProductPath(product)); } } else { title = node.getDisplayName(); } title = appendTitleSuffix(title); } else { title = getEmptyTitle(); } getMainFrame().setTitle(title); }
private PNode(Product product, PContent group) { super(product, group); this.group = group; group.node = this; setDisplayName(product.getDisplayName()); setShortDescription(product.getDescription()); setIconBaseWithExtension("org/esa/snap/rcp/icons/RsProduct16.gif"); Preferences preferences = SnapApp.getDefault().getPreferences(); preferences.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, this, preferences)); }
private static Band createBandCopy(Product targetProduct, Mask mask) { String bandName = ProductUtils.getAvailableNodeName("mask_" + mask.getName(), targetProduct.getBandGroup()); String maskName = ProductUtils.getAvailableNodeName(mask.getName(), targetProduct.getMaskGroup()); int dataType = mask.getDataType(); Band band = targetProduct.addBand(bandName, dataType); String description = mask.getDescription() + " (from " + mask.getProduct().getDisplayName() + ")"; targetProduct.addMask(maskName, bandName, description, mask.getImageColor(), mask.getImageTransparency()); return band; }
if (prod.getDisplayName().equals(srcProductName)) { srcProduct = prod; break;