/** * Gets the target (destination) product file * * @return The target product file */ public File getTargetProductFile() { return targetProductSelector.getModel().getProductFile(); }
public File getTargetFile() { return targetProductSelector.getModel().getProductFile(); }
@Override public void updateParameters() { if (targetProductSelector.getModel().getProductName() != null) { paramMap.put("divisionBy", divisionBy.getSelectedItem()); paramMap.put("numberOfTiles", numberOfTiles.getSelectedItem()); paramMap.put("pixelSizeX", Integer.parseInt(pixelSizeX.getText())); paramMap.put("pixelSizeY", Integer.parseInt(pixelSizeY.getText())); paramMap.put("file", targetProductSelector.getModel().getProductFile()); paramMap.put("formatName", targetProductSelector.getModel().getFormatName()); } }
@Override public File getProductFile() { if (!ENVISAT_FORMAT_NAME.equals(getFormatName())) { return super.getProductFile(); } final String productName = getProductName(); return new File(getProductDir(), FileUtils.ensureExtension(productName, ".N1")); }
@Override public void updateParameters() { if (targetProductSelector.getModel().getProductName() != null) { paramMap.put("file", targetProductSelector.getModel().getProductFile()); paramMap.put("formatName", targetProductSelector.getModel().getFormatName()); } } }
private void showSaveInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>{0}<br>" + "Total time spend for processing: {1}", formatFile(productFile), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveInfo"); }
private void updateParameterMap(Map<String, Object> parameters) { parameters.put("variableConfigs", formModel.getVariableConfigs()); parameters.put("aggregatorConfigs", formModel.getAggregatorConfigs()); parameters.put("outputFile", getTargetProductSelector().getModel().getProductFile().getPath()); parameters.put("maskExpr", formModel.getMaskExpr()); parameters.put("region", formModel.getRegion()); parameters.put("numRows", formModel.getNumRows()); parameters.put("superSampling", formModel.getSuperSampling()); parameters.put("sourceProductFormat", formModel.getSourceProductFormat()); parameters.put("sourceProductPaths", formModel.getSourceProductPaths()); BinningOp.TimeFilterMethod method = formModel.getTimeFilterMethod(); parameters.put("timeFilterMethod", method); if (method == BinningOp.TimeFilterMethod.SPATIOTEMPORAL_DATA_DAY) { parameters.put("minDataHour", formModel.getMinDataHour()); parameters.put("startDateTime", formModel.getStartDateTime()); parameters.put("periodDuration", formModel.getPeriodDuration()); } else if (method == BinningOp.TimeFilterMethod.TIME_RANGE) { parameters.put("startDateTime", formModel.getStartDateTime()); parameters.put("periodDuration", formModel.getPeriodDuration()); } }
private void showSaveInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>{0}<br>" + "Total time spend for processing: {1}", formatFile(productFile), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveInfo"); }
private void showSaveInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); String message = MessageFormat.format( "<html>The target product has been successfully written to<br>{0}<br>" + "Total time spend for processing: {1}", formatFile(productFile), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveInfo"); }
@Override public UIValidation validateParameters() { final String productName = targetProductSelector.getModel().getProductName(); if (productName == null || productName.isEmpty()) return new UIValidation(UIValidation.State.ERROR, "productName not specified"); final File file = targetProductSelector.getModel().getProductFile(); if (file == null) return new UIValidation(UIValidation.State.ERROR, "Target file not specified"); final String productDir = targetProductSelector.getModel().getProductDir().getAbsolutePath(); SnapApp.getDefault().getPreferences().put(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, productDir); return new UIValidation(UIValidation.State.OK, ""); }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
File targetFile = this.model.getProductFile(); String formatName = this.model.getFormatName(); GPF.writeProduct(operatorTargetProduct, targetFile, formatName, false, false, ProgressMonitor.NULL);
@Test public void testSetGetDirectory() { final File directory = new File("Gallien"); model.setProductDir(directory); assertEquals(directory, model.getProductDir()); model.setProductName("Obelix"); assertEquals(new File("Gallien", "Obelix.dim"), model.getProductFile()); // other format model.setFormatName(writerPlugIn.getFormatNames()[0]); assertEquals(new File("Gallien", "Obelix.x"), model.getProductFile()); }
@Override protected void onApply() { if (!canApply()) { return; } TargetProductSelectorModel model = targetProductSelector.getModel(); String productDirPath = model.getProductDir().getAbsolutePath(); appContext.getPreferences().setPropertyString(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, productDirPath); Product targetProduct = null; try { long t0 = System.currentTimeMillis(); targetProduct = createTargetProduct(); createTargetProductTime = System.currentTimeMillis() - t0; } catch (Throwable t) { handleInitialisationError(t); return; } if (targetProduct == null) { throw new NullPointerException("The target product is null."); } targetProduct.setName(model.getProductName()); targetProduct.setFileLocation(model.getProductFile()); GRMProductWriterSwingWorker worker = new GRMProductWriterSwingWorker(targetProduct); worker.executeWithBlocking(); // start the thread }
File productFile = targetProductSelector.getModel().getProductFile(); if (productFile.exists()) { String message = MessageFormat.format(
targetProduct.setFileLocation(targetProductSelector.getModel().getProductFile()); final ProgressMonitorSwingWorker worker = new ProductWriterSwingWorker(targetProduct); worker.executeWithBlocking();
targetProduct.setFileLocation(targetProductSelector.getModel().getProductFile()); final ProgressMonitorSwingWorker worker = new ProductWriterWorker(targetProduct);
WriteOp writeOp = new WriteOp(targetProduct, model.getProductFile(), model.getFormatName()); writeOp.setDeleteOutputOnFailure(true); writeOp.setWriteEntireTileRows(true);