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


Java Service.setOnCancelled方法代码示例

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


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

示例1: handleDownloadButtonAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleDownloadButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents(null));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents(null);
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:20,代码来源:MenuController.java

示例2: handleDownloadArticleButtonAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleDownloadArticleButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents("ARTICLE"));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents("ARTICLE");
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:20,代码来源:MenuController.java

示例3: handleDownloadTutorialButtonAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleDownloadTutorialButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents("TUTORIAL"));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents("TUTORIAL");
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:20,代码来源:MenuController.java

示例4: handleDownloadOpinionButtonAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleDownloadOpinionButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents("OPINION"));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents("OPINION");
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:20,代码来源:MenuController.java

示例5: handleUploadButtonAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleUploadButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.upload.content.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.upload.content.failed.text"));

            alert.showAndWait();
        });
        loginTask.setOnSucceeded(t -> uploadContents());
        loginTask.start();
    }else{
        uploadContents();
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:19,代码来源:MenuController.java

示例6: handleSelectFileAction

import javafx.concurrent.Service; //导入方法依赖的package包/类
@FXML private void handleSelectFileAction(){
    if(! zdsUtils.isAuthenticated()){
        Service<Void> loginTask = menuManager.handleLoginButtonAction(null);
        loginTask.setOnSucceeded(t -> selectAndUploadImage());
        loginTask.setOnCancelled(t -> {
            menuManager.getHBottomBox().getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });
        loginTask.start();
    }else{
        selectAndUploadImage();
    }
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:19,代码来源:ImageInputDialog.java

示例7: registerListeners

import javafx.concurrent.Service; //导入方法依赖的package包/类
/**
 * Registers a listener on the service to update the completableFuture.
 * @param service The service.
 * @param completableFuture	The future.
 * @param <T> The expected type.
 */
public static <T> void registerListeners(Service<T> service,
		CompletableFuture<T> completableFuture) {
	service.setOnSucceeded(e -> completableFuture.complete(service.getValue()));
	service.setOnFailed(e ->
		completableFuture.completeExceptionally(service.getException()));
	service.setOnCancelled(e -> completableFuture.cancel(true));
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:14,代码来源:LoadServiceTestUtils.java


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