当前位置: 首页>>代码示例>>Java>>正文


Java ProgressUtils.runOffEventThreadWithProgressDialog方法代码示例

本文整理汇总了Java中org.netbeans.api.progress.ProgressUtils.runOffEventThreadWithProgressDialog方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressUtils.runOffEventThreadWithProgressDialog方法的具体用法?Java ProgressUtils.runOffEventThreadWithProgressDialog怎么用?Java ProgressUtils.runOffEventThreadWithProgressDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.progress.ProgressUtils的用法示例。


在下文中一共展示了ProgressUtils.runOffEventThreadWithProgressDialog方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAllOpenProducts

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private static void addAllOpenProducts(final FileTableModel tableModel) {
    final ProgressHandleMonitor pm = ProgressHandleMonitor.create("Populating table");
    Runnable operation = () -> {
        final Product[] products = SnapApp.getDefault().getProductManager().getProducts();
        pm.beginTask("Populating table...", products.length);
        for (Product prod : products) {
            final File file = prod.getFileLocation();
            if (file != null && file.exists()) {
                tableModel.addFile(file);
            }
            pm.worked(1);
        }
        pm.done();
    };

    ProgressUtils.runOffEventThreadWithProgressDialog(operation, "Adding Products", pm.getProgressHandle(), true, 50, 1000);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:18,代码来源:ProductSetPanel.java

示例2: onApply

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Override
protected void onApply() {

    BenchmarkExecutor executor = new BenchmarkExecutor();

    //launch processing with a progress bar
    ProgressHandleMonitor pm = ProgressHandleMonitor.create("Running benchmark", executor);

    executor.setProgressHandleMonitor(pm);

    ProgressUtils.runOffEventThreadWithProgressDialog(executor, "Benchmarking....",
                                                      pm.getProgressHandle(),
                                                      true,
                                                      50,
                                                      1000);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:BenchmarkDialog.java

示例3: addProducts

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private static void addProducts(final FileTableModel tableModel, final File[] files) {
    final ProgressHandleMonitor pm = ProgressHandleMonitor.create("Populating table");
    Runnable operation = () -> {
        pm.beginTask("Populating table...", files.length);
        for (File file : files) {
            if (ProductFunctions.isValidProduct(file)) {
                tableModel.addFile(file);
            }
            pm.worked(1);
        }
        pm.done();
    };

    ProgressUtils.runOffEventThreadWithProgressDialog(operation, "Adding Products", pm.getProgressHandle(), true, 50, 1000);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:16,代码来源:ProductSetPanel.java

示例4: updateImages

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private static void updateImages(RasterDataNode rasterDataNode, boolean validMaskPropertyChanged) {

        if (rasterDataNode instanceof VirtualBand) {
            VirtualBand virtualBand = (VirtualBand) rasterDataNode;
            if (virtualBand.hasRasterData()) {
                String title = "Recomputing Raster Data";
                ProgressHandleMonitor pm = ProgressHandleMonitor.create(title);
                Runnable operation = () -> {
                    try {
                        virtualBand.readRasterDataFully(pm);
                    } catch (IOException e) {
                        Dialogs.showError(e.getMessage());
                    }
                };
                ProgressUtils.runOffEventThreadWithProgressDialog(operation, title,
                                                                  pm.getProgressHandle(),
                                                                  true,
                                                                  50,  // time in ms after which wait cursor is shown
                                                                  1000);  // time in ms after which dialog with "Cancel" button is shown
            }
        }

        OpenImageViewAction.updateProductSceneViewImages(new RasterDataNode[]{rasterDataNode}, view -> {
            if (validMaskPropertyChanged) {
                view.updateNoDataImage();
            }
            view.updateImage();
        });
    }
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:30,代码来源:PNNode.java

示例5: createNewClassifier

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
private static void createNewClassifier(final String classifierName, final CBIRSession session) {
    final ProgressHandleMonitor pm = ProgressHandleMonitor.create("Creating classifier");
    Runnable operation = () -> {
        pm.beginTask("Creating classifier...", 100);
        try {
            session.createClassifier(classifierName);
        } catch (Exception e) {
            SnapApp.getDefault().handleError("Failed to create classifier", e);
        } finally {
            pm.done();
        }
    };
    ProgressUtils.runOffEventThreadWithProgressDialog(operation, "Creating classifier", pm.getProgressHandle(), true, 50, 1000);
}
 
开发者ID:bcdev,项目名称:esa-pfa,代码行数:15,代码来源:CBIRControlCentreToolView.java

示例6: onApply

import org.netbeans.api.progress.ProgressUtils; //导入方法依赖的package包/类
@Override
protected void onApply() {
    final Product[] sourceProducts = form.getSourceProducts();
    List<ParameterDescriptor> descriptors = Arrays.stream(operatorDescriptor.getParameterDescriptors())
            .filter(p -> ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE.equals(p.getName()))
            .collect(Collectors.toList());
    String templateContents;
    try {
        //templateContents = ToolAdapterIO.readOperatorTemplate(operatorDescriptor.getName());
        FileTemplate template = operatorDescriptor.getTemplate();
        templateContents = template.getContents();
    } catch (Exception ex) {
        showErrorDialog(String.format("Cannot read operator template [%s]", ex.getMessage()));
        return;
    }
    if (Arrays.stream(sourceProducts).anyMatch(Objects::isNull)) {
        Dialogs.Answer decision = Dialogs.requestDecision("No Product Selected", Bundle.NoSourceProductWarning_Text(), false,
                ToolAdapterOptionsController.PREFERENCE_KEY_SHOW_EMPTY_PRODUCT_WARNING);
        if (decision.equals(Dialogs.Answer.NO)) {
            return;
        }
    }
    if (descriptors.size() == 1 && form.getPropertyValue(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE) == null &&
            templateContents.contains("$" + ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE)) {
        Dialogs.showWarning(Bundle.RequiredTargetProductMissingWarning_Text());
    } else {
        if (!canApply()) {
            displayWarnings();
            AbstractAdapterEditor dialog = AbstractAdapterEditor.createEditorDialog(appContext, getJDialog(), operatorDescriptor, OperationType.FORCED_EDIT);
            final int code = dialog.show();
            if (code == AbstractDialog.ID_OK) {
                onOperatorDescriptorChanged(dialog.getUpdatedOperatorDescriptor());
            }
            dialog.close();
        } else {
            if (validateUserInput()) {
                Map<String, Product> sourceProductMap = new HashMap<>();
                if (sourceProducts.length > 0) {
                    sourceProductMap.put(SOURCE_PRODUCT_FIELD, sourceProducts[0]);
                }
                Operator op = GPF.getDefaultInstance().createOperator(operatorDescriptor.getAlias(), parameterSupport.getParameterMap(), sourceProductMap, null);
                for (Property property : parameterSupport.getPropertySet().getProperties()) {
                    op.setParameter(property.getName(), property.getValue());
                }
                op.setSourceProducts(sourceProducts);
                operatorTask = new OperatorTask(op, ToolAdapterExecutionDialog.this::operatorCompleted);
                ProgressHandle progressHandle = ProgressHandleFactory.createHandle(this.getTitle());
                String progressPattern = operatorDescriptor.getProgressPattern();
                ConsoleConsumer consumer;
                ProgressHandler progressWrapper = new ProgressHandler(progressHandle, progressPattern == null || progressPattern.isEmpty());
                consumer = new ConsoleConsumer(operatorDescriptor.getProgressPattern(),
                        operatorDescriptor.getErrorPattern(),
                        operatorDescriptor.getStepPattern(),
                        progressWrapper,
                        form.console);
                form.console.clear();
                progressWrapper.setConsumer(consumer);
                ((ToolAdapterOp) op).setProgressMonitor(progressWrapper);
                ((ToolAdapterOp) op).setConsumer(consumer);
                ProgressUtils.runOffEventThreadWithProgressDialog(operatorTask, this.getTitle(), progressHandle, true, 1, 1);
            } else {
                if (warnings.size() > 0) {
                    displayWarnings();
                }
            }
        }
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:69,代码来源:ToolAdapterExecutionDialog.java


注:本文中的org.netbeans.api.progress.ProgressUtils.runOffEventThreadWithProgressDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。