protected void updateData() { if (file != null) { data[0] = file.getName(); } else if (entry != null) { data[0] = entry.getName(); data[1] = entry.getProductType(); data[2] = entry.getFirstLineTime().format(); final MetadataElement meta = entry.getMetadata(); if (meta != null) { data[3] = String.valueOf(meta.getAttributeInt(AbstractMetadata.REL_ORBIT, 0)); data[4] = String.valueOf(meta.getAttributeInt(AbstractMetadata.ABS_ORBIT, 0)); } } }
public File[] getSelectedFiles() { final List<File> list = new ArrayList<>(); for (ThumbnailDrawing item : getSelection()) { Quicklook ql = (Quicklook) item.getThumbnail(); for (ProductEntry entry : productEntryList) { if (entry.getQuickLook().equals(ql) && entry.getFile() != null) { list.add(entry.getFile()); } } } return list.toArray(new File[list.size()]); }
@Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { final ProductEntry entry = (ProductEntry) value; if (entry != null) { final String text = String.valueOf(entry.getId()); final JLabel jlabel = (JLabel) super .getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); jlabel.setFont(jlabel.getFont().deriveFont(Font.BOLD)); if(entry.getFile() != null) { jlabel.setToolTipText(entry.getFile().getAbsolutePath()); } return jlabel; } return null; } }
if (entry.getRangeSpacing() > 0 && entry.getAzimuthSpacing() > 0) { pixelSpacing = df.format(entry.getRangeSpacing()) + " x " + df.format(entry.getAzimuthSpacing()) + " m"; final File file = entry.getFile(); final String fileSize = (entry.getFileSizeString() == null) ? "(" + (entry.getFileSize() / (1024 * 1024)) + " MB)" : "(" + entry.getFileSizeString() + ")"; final String dateString = dateFormat.format(entry.getFirstLineTime().getAsDate()); final MetadataElement absRoot = entry.getMetadata(); if (absRoot != null) { final String pol1 = absRoot.getAttributeString(AbstractMetadata.mds1_tx_rx_polar); polStr += ' ' + pol4; } else { polStr = entry.getAcquisitionMode(); // SciHub search result contains polarization mode here entry.getName(), entry.getMission() + " " + entry.getProductType() + " " + entry.getPass() + " " + polStr + " " + dateString + " " + pixelSpacing, }; values = new String[]{ file.getName(), entry.getName(), entry.getMission() + " " + entry.getProductType() + " " + entry.getPass() + " " + polStr, dateString + " " + pixelSpacing, entry.getFileFormat() + " " + fileSize
final File file = entry.getFile(); if (file != null) { text.append("File: " + file.getName() + '\n'); text.append("Product: " + entry.getName() + '\n'); text.append('\n'); text.append("Mission: " + entry.getMission() + '\n'); text.append("Mode: " + entry.getAcquisitionMode() + '\n'); text.append("Type: " + entry.getProductType() + '\n'); final MetadataElement absRoot = entry.getMetadata(); if(absRoot != null) { final String sampleType = absRoot.getAttributeString(AbstractMetadata.SAMPLE_TYPE, AbstractMetadata.NO_METADATA_STRING); text.append(" Track: " + relOrbit); text.append('\n'); text.append("Size: " + getSizeString(entry.getFileSize()) + '\n'); if (!map.isEmpty()) { text.append(map + '\n'); text.append("Date: " + entry.getFirstLineTime() + '\n'); text.append("Size: " + entry.getFileSizeString() + '\n'); long totalSize = 0; for (ProductEntry entry : selections) { totalSize += entry.getFileSize();
public int compare(final Object o1, final Object o2) { if (o1 == null && o2 == null) { return 0; } else if (o1 == null) { return -1; } else if (o2 == null) { return 1; } else if (o1 instanceof ProductEntry && o2 instanceof ProductEntry) { final ProductEntry e1 = (ProductEntry) o1; final ProductEntry e2 = (ProductEntry) o2; if (sortBy.equals(SORT_BY.NAME)) { return e1.getName().compareTo(e2.getName()); } else if (sortBy.equals(SORT_BY.TYPE)) { return e1.getProductType().compareTo(e2.getProductType()); } else if (sortBy.equals(SORT_BY.MISSON)) { return e1.getMission().compareTo(e2.getMission()); } else if (sortBy.equals(SORT_BY.DATE)) { return e1.getFirstLineTime().getAsDate().compareTo(e2.getFirstLineTime().getAsDate()); } else if (sortBy.equals(SORT_BY.FILESIZE)) { final Long size1 = e1.getFileSize(); final Long size2 = e2.getFileSize(); return size1.compareTo(size2); } } return o1.toString().compareTo(o2.toString()); } };
private static File[] findCCDPairs(final ProductDB db, final ProductEntry master, final AOI aoi) { DBQuery dbQuery = aoi.getSlaveDBQuery(); if (dbQuery == null) dbQuery = new DBQuery(); dbQuery.setExcludeDir(new File(aoi.getInputFolder())); dbQuery.setFreeQuery(AbstractMetadata.PRODUCT + " <> '" + master.getName() + "'"); dbQuery.setSelectionRect(master.getGeoBoundary()); try { final ProductEntry[] entries = dbQuery.queryDatabase(db); return ProductEntry.getFileList(getClosestDatePairs(entries, master, aoi)); } catch (Throwable t) { Dialogs.showError("Query database error:"+t.getMessage()); return null; } }
final Map<File, ProductEntry> fileMap = new ConcurrentHashMap<>(entriesInPath.length); for (ProductEntry entry : entriesInPath) { fileMap.put(entry.getFile(), entry); if (options.generateQuicklooks && !existingEntry.quickLookExists()) { final Product sourceProduct = CommonReaders.readProduct(file); if (sourceProduct != null) { existingEntry.dispose(); continue; entry.dispose(); } else if (!file.isDirectory()) { SystemUtils.LOG.warning("No reader for " + file.getAbsolutePath());
final JointSearchDialog dlg = new JointSearchDialog("Joint Search Criteria", selections[0].getMission()); dlg.show(); if (!dlg.IsOK()) { dbQuery.setSelectionRect(selections[0].getGeoBoundary()); Calendar startDate = selections[0].getFirstLineTime().getAsCalendar(); startDate.add(Calendar.DAY_OF_MONTH, -daysMinus); Calendar endDate = selections[0].getFirstLineTime().getAsCalendar(); endDate.add(Calendar.DAY_OF_MONTH, daysPlus); dbQuery.setStartEndDate(startDate, endDate);
private static boolean isFolderProduct(final ProductEntry entry) { final String mission = entry.getMission(); for (String folderMission : folderMissions) { if (mission.equals(folderMission)) return true; } if(entry.getFile() == null) { return false; } final String fileName = entry.getFile().getName().toLowerCase(); for (String ext : folderExt) { if (fileName.endsWith(ext)) return true; } if (mission.equals("ERS1") || mission.equals("ERS2")) { if (!isSingleFile(entry)) // if not .e1 or .e2 return true; } return false; } }
private void createPanel(final File[] productFileList) { final JPanel textPanel = createTextPanel("Instructions", getInstructions()); this.add(textPanel, BorderLayout.NORTH); final WorldMapUI worldMapUI = new WorldMapUI(); this.add(worldMapUI.getWorlMapPane(), BorderLayout.CENTER); final ProductEntry[] productEntryList =ProductEntry.createProductEntryList(productFileList); final GeoPos[][] geoBoundaries = new GeoPos[productEntryList.length][4]; int i = 0; for (ProductEntry entry : productEntryList) { geoBoundaries[i++] = entry.getGeoBoundary(); } worldMapUI.setAdditionalGeoBoundaries(geoBoundaries); } }
private void showRepository(final ProductEntry[] productEntryList) { //System.out.println("ProductLibraryToolView.showRepository: productEntryList " + (productEntryList == null ? "is null" : productEntryList.length) + " " + currentListView.getClass()); if(productEntryList == null) return; currentListView.setProductEntryList(productEntryList); notifySelectionChanged(); final GeoPos[][] geoBoundaries = new GeoPos[productEntryList.length][4]; int i = 0; for (ProductEntry entry : productEntryList) { geoBoundaries[i++] = entry.getGeoBoundary(); } worldMapUI.setAdditionalGeoBoundaries(geoBoundaries); worldMapUI.setSelectedGeoBoundaries(null); }
private static ProductEntry[] getClosestDatePairs(final ProductEntry[] entries, final ProductEntry master, final AOI aoi) { final double masterTime = master.getFirstLineTime().getMJD(); double cutoffTime = masterTime; final DBQuery slaveQuery = aoi.getSlaveDBQuery(); final double entryTime = entry.getFirstLineTime().getMJD(); if (entryTime < cutoffTime) { final double diff = Math.abs(masterTime - entryTime);
@Override public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { try { final ProductEntry entry = (ProductEntry) value; if (entry != null) { final String text = String.valueOf(entry.getId()); final JLabel jlabel = (JLabel) super .getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); jlabel.setFont(jlabel.getFont()); if(entry.getFile() != null) { jlabel.setToolTipText(entry.getFile().getAbsolutePath()); } return jlabel; } } catch (Throwable e) { SystemUtils.LOG.severe("IDCellRenderer: " + e.getMessage()); } return null; } }
public void notifySelectionChanged() { updateStatusLabel(); final ProductEntry[] selections = getSelectedProductEntries(); productLibraryActions.selectionChanged(selections); productLibraryActions.updateContextMenu(selections); dbPane.updateProductSelectionText(selections); if (selections != null) { final GeoPos[][] geoBoundaries = new GeoPos[selections.length][4]; int i = 0; for (ProductEntry entry : selections) { geoBoundaries[i++] = entry.getGeoBoundary(); } worldMapUI.setSelectedGeoBoundaries(geoBoundaries); } else { worldMapUI.setSelectedGeoBoundaries(null); } }
final ProductData.UTC utc = entry.getFirstLineTime(); if(utc == null) { continue;