本文整理汇总了Java中org.esa.snap.ui.UIUtils.setRootFrameWaitCursor方法的典型用法代码示例。如果您正苦于以下问题:Java UIUtils.setRootFrameWaitCursor方法的具体用法?Java UIUtils.setRootFrameWaitCursor怎么用?Java UIUtils.setRootFrameWaitCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.esa.snap.ui.UIUtils
的用法示例。
在下文中一共展示了UIUtils.setRootFrameWaitCursor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportVectorDataNode
import org.esa.snap.ui.UIUtils; //导入方法依赖的package包/类
/**
* Performs the actual "export Mask Pixels" command.
*/
private void exportVectorDataNode() {
SnapApp snapApp = SnapApp.getDefault();
if (vectorDataNode.getFeatureCollection().isEmpty()) {
Dialogs.showInformation(Bundle.CTL_ExportGeometryAction_DialogTitle(),
"The selected geometry is empty. Nothing to export.", null);
return;
}
final File file = promptForFile(vectorDataNode.getName());
if (file == null) {
return;
}
final SwingWorker<Exception, Object> swingWorker = new ExportVectorNodeSwingWorker(snapApp, vectorDataNode, file);
UIUtils.setRootFrameWaitCursor(snapApp.getMainFrame());
snapApp.setStatusBarMessage("Exporting Geometry...");
swingWorker.execute();
}
示例2: doInBackground
import org.esa.snap.ui.UIUtils; //导入方法依赖的package包/类
@Override
protected Object doInBackground(ProgressMonitor pm) throws Exception {
UIUtils.setRootFrameWaitCursor(ImageInfoEditor2.this);
if (parentForm.getFormModel().isValid()) {
final RasterDataNode[] rasters = parentForm.getFormModel().getRasters();
try {
pm.beginTask("Computing statistics", rasters.length);
for (RasterDataNode raster : rasters) {
raster.getStx(true, SubProgressMonitor.create(pm, 1));
}
} finally {
pm.done();
}
}
return null;
}
示例3: createProductSceneImageHSV
import org.esa.snap.ui.UIUtils; //导入方法依赖的package包/类
private static ProductSceneImage createProductSceneImageHSV(final String name, final Product product,
final String[] hsvExpressions,
final ProgressMonitor pm) throws Exception {
UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame());
Band[] rgbBands = null;
boolean errorOccured = false;
ProductSceneImage productSceneImage = null;
try {
pm.beginTask("Creating HSV image...", 2);
final String[] rgbaExpressions = convertHSVToRGBExpressions(hsvExpressions);
rgbBands = OpenRGBImageViewAction.allocateRgbBands(product, rgbaExpressions);
productSceneImage = new ProductSceneImage(name,
rgbBands[0],
rgbBands[1],
rgbBands[2],
SnapApp.getDefault().getPreferencesPropertyMap(),
SubProgressMonitor.create(pm, 1));
productSceneImage.initVectorDataCollectionLayer();
productSceneImage.initMaskCollectionLayer();
} catch (Exception e) {
errorOccured = true;
throw e;
} finally {
pm.done();
if (rgbBands != null) {
OpenRGBImageViewAction.releaseRgbBands(rgbBands, errorOccured);
}
}
return productSceneImage;
}
示例4: openProductSceneView
import org.esa.snap.ui.UIUtils; //导入方法依赖的package包/类
private void openProductSceneView(RasterDataNode rasterDataNode) {
SnapApp snapApp = SnapApp.getDefault();
snapApp.setStatusBarMessage("Opening image view...");
UIUtils.setRootFrameWaitCursor(snapApp.getMainFrame());
String progressMonitorTitle = MessageFormat.format("Creating image for ''{0}''", rasterDataNode.getName());
ProductSceneView existingView = getProductSceneView(rasterDataNode);
SwingWorker worker = new ProgressMonitorSwingWorker<ProductSceneImage, Object>(snapApp.getMainFrame(), progressMonitorTitle) {
@Override
public void done() {
UIUtils.setRootFrameDefaultCursor(snapApp.getMainFrame());
snapApp.setStatusBarMessage("");
try {
ProductSceneImage sceneImage = get();
UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(sceneImage.getProduct());
ProductSceneView view = new ProductSceneView(sceneImage, undoManager);
// get the preferences: SnapApp.getInstance().getPreferences()
// add the view (as listener) to it
openDocumentWindow(view);
} catch (Exception e) {
snapApp.handleError(MessageFormat.format("Failed to open image view.\n\n{0}", e.getMessage()), e);
}
}
@Override
protected ProductSceneImage doInBackground(com.bc.ceres.core.ProgressMonitor pm) throws Exception {
try {
return createProductSceneImage(rasterDataNode, existingView, pm);
} finally {
if (pm.isCanceled()) {
rasterDataNode.unloadRasterData();
}
}
}
};
worker.execute();
}
示例5: attachPixelGeoCoding
import org.esa.snap.ui.UIUtils; //导入方法依赖的package包/类
private static void attachPixelGeoCoding(final Product product) {
final SnapApp snapApp = SnapApp.getDefault();
final Window mainFrame = snapApp.getMainFrame();
String dialogTitle = Bundle.CTL_AttachPixelGeoCodingDialogTitle();
final PixelGeoCodingSetupDialog setupDialog = new PixelGeoCodingSetupDialog(mainFrame,
dialogTitle,
HELP_ID,
product);
if (setupDialog.show() != ModalDialog.ID_OK) {
return;
}
final Band lonBand = setupDialog.getSelectedLonBand();
final Band latBand = setupDialog.getSelectedLatBand();
final int searchRadius = setupDialog.getSearchRadius();
final String validMask = setupDialog.getValidMask();
final String msgPattern = "New Pixel Geo-Coding: lon = ''{0}'' ; lat = ''{1}'' ; radius=''{2}'' ; mask=''{3}''";
snapApp.getLogger().log(Level.INFO, MessageFormat.format(msgPattern,
lonBand.getName(), latBand.getName(),
searchRadius, validMask));
final long requiredBytes = PixelGeoCoding.getRequiredMemory(product, validMask != null);
final long requiredMegas = requiredBytes / (1024 * 1024);
final long freeMegas = Runtime.getRuntime().freeMemory() / (1024 * 1024);
if (freeMegas < requiredMegas) {
final String message = MessageFormat.format("This operation requires to load at least {0} M\n" +
"of additional data into memory.\n\n" +
"Do you really want to continue?",
requiredMegas);
final Dialogs.Answer answer = Dialogs.requestDecision(dialogTitle, message, false, "load_latlon_band_data");
if (answer != Dialogs.Answer.YES) {
return;
}
}
UIUtils.setRootFrameWaitCursor(mainFrame);
final ProgressMonitorSwingWorker<Void, Void> swingWorker = new ProgressMonitorSwingWorker<Void, Void>(mainFrame, dialogTitle) {
@Override
protected Void doInBackground(ProgressMonitor pm) throws Exception {
final BasicPixelGeoCoding pixelGeoCoding = GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, validMask, searchRadius, pm);
product.setSceneGeoCoding(pixelGeoCoding);
UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(product);
if (undoManager != null) {
undoManager.addEdit(new UndoableAttachGeoCoding<>(product, pixelGeoCoding));
}
return null;
}
@Override
public void done() {
try {
get();
Dialogs.showInformation(dialogTitle, "Pixel geo-coding has been attached.", null);
} catch (Exception e) {
Throwable cause = e;
if (e instanceof ExecutionException) {
cause = e.getCause();
}
String msg = "An internal error occurred:\n" + e.getMessage();
if (cause instanceof IOException) {
msg = "An I/O error occurred:\n" + e.getMessage();
}
Dialogs.showError(dialogTitle, msg);
} finally {
UIUtils.setRootFrameDefaultCursor(mainFrame);
}
}
};
swingWorker.executeWithBlocking();
}