java类javafx.scene.control.Alert.AlertType的实例源码

SignatureController.java 文件源码 项目:dss-demonstrations 阅读 44 收藏 0 点赞 0 评论 0
private void save(DSSDocument signedDocument) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setInitialFileName(signedDocument.getName());
    MimeType mimeType = signedDocument.getMimeType();
    ExtensionFilter extFilter = new ExtensionFilter(mimeType.getMimeTypeString(), "*." + MimeType.getExtension(mimeType));
    fileChooser.getExtensionFilters().add(extFilter);
    File fileToSave = fileChooser.showSaveDialog(stage);

    if (fileToSave != null) {
        try {
            FileOutputStream fos = new FileOutputStream(fileToSave);
            Utils.copy(signedDocument.openStream(), fos);
            Utils.closeQuietly(fos);
        } catch (Exception e) {
            Alert alert = new Alert(AlertType.ERROR, "Unable to save file : " + e.getMessage(), ButtonType.CLOSE);
            alert.showAndWait();
            return;
        }
    }
}
GameShelf.java 文件源码 项目:Virtual-Game-Shelf 阅读 42 收藏 0 点赞 0 评论 0
public static void displayDeleteGameAlert() {
    int index = -1;

    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setHeaderText(null);
    alert.setContentText("Are you sure you want to delete the selected games?");

    ButtonType deleteGame = new ButtonType("Delete Game(s)");
    ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(deleteGame, buttonTypeCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == deleteGame){
        for (String g : selectedGamesString) {
            index = getGameIndex(g);
            gameList.getGameList().remove(index);
        }

        refreshGameList();
        deleteButton.setDisable(true);
    }
    else {
        // ... user chose CANCEL or closed the dialog
    }
}
MainWindowController.java 文件源码 项目:mountieLibrary 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Process the transaction when a student check-out a book.
 * @param event The even that triggered this function.
 * @throws IOException IOException In case a file cannot be loaded.
 * @throws SQLException The even that triggered this function
 */
@FXML public void processCheckOutButtonPressed(ActionEvent event) 
        throws IOException, SQLException
{
    BooksIssued transaction = new BooksIssued(Long.valueOf(isbnCheckOutTF.getText()),
            Integer.valueOf(iDCheckOutTF.getText()));
    int success = transaction.processCheckOutTransaction();

    if(success == 1){
        displayAlert(Alert.AlertType.INFORMATION,"Receipt" , 
            ("Transaction ID: " + transaction.getTransID() + "\n\nStudent ID: " + 
            transaction.getCardID() + "\nIssue Date: " + transaction.getIssueDate() +
            "\nDue Date: " + transaction.getDueDate()), "1");

        Books book = new Books(Long.valueOf(isbnCheckOutTF.getText()),
            Integer.valueOf(copiesCheckOutTF.getText()));
        book.decreasedCopies();
        clearCheckOutForm();
        resultsTableView.getItems().clear(); //clear table data to show new one.
    }
    else{
        displayAlert(Alert.AlertType.WARNING,"Error" , 
            ("Error adding student"), "6");
    }
}
MemberPane.java 文件源码 项目:titanium 阅读 39 收藏 0 点赞 0 评论 0
private void removeMemberAction(Event e) {
    MemberView selected = memberTable.selectionModelProperty().get().getSelectedItem();

    if (selected != null) { 
        Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to transfert " + organization.getName() + "'s ownership to "+ selected.getUsername() + " ?\n");
        Optional<ButtonType> result = conf.showAndWait();

        if (result.isPresent() && result.get().equals(ButtonType.OK))  {
            try {
                organization.removeMember(selected.getId());
            } catch (JSONException | WebApiException | IOException | HttpException e1) {
                ErrorUtils.getAlertFromException(e1).show();
                forceUpdateMemberList();
                e1.printStackTrace();
            }
        }
    }
}
MemberPane.java 文件源码 项目:titanium 阅读 36 收藏 0 点赞 0 评论 0
private void transferOwnershipAction(Event e) {
    MemberView selected = memberTable.selectionModelProperty().get().getSelectedItem();

    if (selected != null) {  
        Alert conf = ErrorUtils.newAlert(AlertType.CONFIRMATION, "Transfer ownership confirmation",
                "Do you really want to transfer " + organization.getName() + "'s ownership to "+ selected.getUsername() + " ?",
                "This action is definitive, be careful.");
        Optional<ButtonType> result = conf.showAndWait();

        if (result.isPresent() && result.get().equals(ButtonType.OK))  {
            try {
                organization.transfertOwnership(selected.getId());
                eos.close();
            } catch (JSONException | WebApiException | IOException | HttpException e1) {
                ErrorUtils.getAlertFromException(e1).show();
                e1.printStackTrace();
            }
        }
    }



}
OrganizationManagerStage.java 文件源码 项目:titanium 阅读 36 收藏 0 点赞 0 评论 0
private void removeAction(Event e) {
    Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to delete this organization ?\n"
            + "Every server and member association will be lost.");

    Optional<ButtonType> result = conf.showAndWait();

    if (result.isPresent() && result.get().equals(ButtonType.OK)) {
        try {
            wsp.removeOrganization(orgas.selectionModelProperty().get().getSelectedItem().getOrganization());
            forceOrganizationListRefresh();
            App.getCurrentInstance().refreshWSPTabs();
        } catch(Exception e1) {
            ErrorUtils.getAlertFromException(e1).show();
        }
    }
}
MainPane.java 文件源码 项目:titanium 阅读 51 收藏 0 点赞 0 评论 0
private void editWSPAction(Event e) {
    EditWSPDialog dialog = new EditWSPDialog(wsp);
    Optional<WebServiceProvider> result = dialog.showAndWait();

    if (result.isPresent()) {
        try {
            wsp = result.get();
            wsp.fetchConfiguration();
            writeWSP(wsp);
        } catch (JSONException | WebApiException | IOException | HttpException e1) {
            Alert a = ErrorUtils.getAlertFromException(e1);
            a.show();
            e1.printStackTrace();
        }

    } else {
        new Alert(AlertType.ERROR, "Wrong WSP information");
    }
}
CashCalculateController.java 文件源码 项目:Money-Manager 阅读 43 收藏 0 点赞 0 评论 0
@FXML
private void mnuUndo(ActionEvent event) {
    Stage CashCalculateStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Action Failed");
    alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
    alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
    alert.setX(CashCalculateStage.getX() + 60);
    alert.setY(CashCalculateStage.getY() + 170);
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK){
        (new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
        (new GoToOperation()).goToMakeATransaction(CashCalculateStage.getX(), CashCalculateStage.getY());
        CashCalculateStage.close();
    }
}
SettingsController.java 文件源码 项目:Money-Manager 阅读 36 收藏 0 点赞 0 评论 0
@FXML
private void mnuUndo(ActionEvent event) {
    Stage SettingsStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Action Failed");
    alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
    alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
    alert.setX(SettingsStage.getX() + 60);
    alert.setY(SettingsStage.getY() + 170);
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK){
        (new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
        (new GoToOperation()).goToMakeATransaction(SettingsStage.getX(), SettingsStage.getY());
        SettingsStage.close();
    }
}
Main.java 文件源码 项目:uPMT 阅读 32 收藏 0 点赞 0 评论 0
public void changeLocaleAndReload(String locale){
    saveCurrentProject();
       Alert alert = new Alert(AlertType.CONFIRMATION);
       alert.setTitle("Confirmation Dialog");
       alert.setHeaderText("This will take effect after reboot");
       alert.setContentText("Are you ok with this?");

       Optional<ButtonType> result = alert.showAndWait();
       if (result.get() == ButtonType.OK){
           // ... user chose OK
        try {
            Properties props = new Properties();
            props.setProperty("locale", locale);
            File f = new File(getClass().getResource("../bundles/Current.properties").getFile());
            OutputStream out = new FileOutputStream( f );
            props.store(out, "This is an optional header comment string");

            start(primaryStage);
        }
        catch (Exception e ) {
            e.printStackTrace();
        }
       } else {
           // ... user chose CANCEL or closed the dialog
       }
}
SettingsController.java 文件源码 项目:Money-Manager 阅读 42 收藏 0 点赞 0 评论 0
@FXML
private void unarchiveSector(ActionEvent event) {
    try {
        sector.unarchiveSector(sectorcmboUnArchive.getValue());

        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
        confirmationMsg.setTitle("Message");
        confirmationMsg.setHeaderText(null);
        confirmationMsg.setContentText(sectorcmboUnArchive.getValue()+ " is Unarchived Successfully");
        Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
        confirmationMsg.setX(SettingsStage.getX() + 200);
        confirmationMsg.setY(SettingsStage.getY() + 170);
        confirmationMsg.showAndWait();

        tabSectorInitialize();
    } catch (Exception e) {}
}
DashboardController.java 文件源码 项目:Money-Manager 阅读 35 收藏 0 点赞 0 评论 0
@FXML
private void mnuUndo(ActionEvent event) {
    Stage DashboardStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Action Failed");
    alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
    alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
    alert.setX(DashboardStage.getX() + 60);
    alert.setY(DashboardStage.getY() + 170);
    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK){
        (new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
        (new GoToOperation()).goToMakeATransaction(DashboardStage.getX(), DashboardStage.getY());
        DashboardStage.close();
    }
}
AlertSupport.java 文件源码 项目:WebtoonDownloadManager 阅读 37 收藏 0 点赞 0 评论 0
public int alertErrorConfirm() {

        int r = 0;

        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("경고");
        alert.setHeaderText(null);
        alert.setContentText(this.msg);
        alert.showAndWait();

        Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK) {
            r = 1;
        }

        return r;

    }
ToDoOverviewController.java 文件源码 项目:kanphnia2 阅读 36 收藏 0 点赞 0 评论 0
@FXML
private void handleDeleteEntry() {
    int selectedIndex = entryTable.getSelectionModel().getSelectedIndex();

    if (selectedIndex >= 0) {
        entryTable.getItems().remove(selectedIndex);
    }
    else {
        Alert alert = new Alert(AlertType.WARNING);
        alert.initOwner(mainApp.getPrimaryStage());
        alert.setTitle("No Selection");
        alert.setHeaderText("No Entry Selected");
        alert.setContentText("Please select an entry in the table");
        alert.showAndWait();
    }
}
FileMenu.java 文件源码 项目:Matcher 阅读 37 收藏 0 点赞 0 评论 0
private void saveMatches() {
    Path path = Gui.requestFile("Save matches file", gui.getScene().getWindow(), Arrays.asList(new FileChooser.ExtensionFilter("Matches", "*.match")), false);
    if (path == null) return;

    if (!path.getFileName().toString().toLowerCase(Locale.ENGLISH).endsWith(".match")) {
        path = path.resolveSibling(path.getFileName().toString()+".match");
    }

    try {
        if (Files.isDirectory(path)) {
            gui.showAlert(AlertType.ERROR, "Save error", "Invalid file selection", "The selected file is a directory.");
        } else if (Files.exists(path)) {
            Files.deleteIfExists(path);
        }

        if (!gui.getMatcher().saveMatches(path)) {
            gui.showAlert(AlertType.WARNING, "Matches save warning", "No matches to save", "There are currently no matched classes, so saving was aborted.");
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    }
}
Controller.java 文件源码 项目:Orsum-occulendi 阅读 32 收藏 0 点赞 0 评论 0
@FXML
public void presentNewGameProposalWindow(Event e) {
    TextInputDialog dialog = new TextInputDialog();
    dialog.setHeaderText("Neuer Spielvorschalg");
    dialog.setContentText("Wie soll das Spiel heissen?");

    Optional<String> gameNameResult = dialog.showAndWait();
    gameNameResult.ifPresent(result -> {
        if (!gameNameResult.get().isEmpty()) {
            this.client.enqueueTask(new CommunicationTask(new ClientMessage("server", "newgame", gameNameResult.get()), (success, response) -> {
                Platform.runLater(() -> {
                    if (success && response.getDomain().equals("success") && response.getCommand().equals("created")) {
                        refreshGameList(e);
                        System.out.println("Game erstellt");
                    } else {
                        Alert alert = new Alert(AlertType.ERROR);
                        alert.setHeaderText("Das Spiel konnte nicht erstellt werden");
                        alert.setContentText(response.toString());
                        alert.show();
                    }
                });
            }));
        }
    });
}
FrmLogin.java 文件源码 项目:AlphaLab 阅读 32 收藏 0 点赞 0 评论 0
private void senhaInvalida() {
    if (txtLogin.getText().equals("") && !pswSenha.getText().equals("")) {
        caixaAlerta(AlertType.ERROR, "Erro ao fazer login", "Login deve ser informado", "Informe o login!");
    }

    if (pswSenha.getText().equals("") && !txtLogin.getText().equals("")) {
        caixaAlerta(AlertType.ERROR, "Erro ao fazer login", "Senha deve ser informada", "Informe a senha!");
    }

    if (txtLogin.getText().equals("") && pswSenha.getText().equals("")) {
        caixaAlerta(AlertType.ERROR, "Erro ao fazer login", "Login e senha devem ser informados",
                "Informe o login e a senha!");

    }

    if (!txtLogin.getText().equals("") && !pswSenha.getText().equals("")) {
        caixaAlerta(AlertType.ERROR, "Erro ao fazer login", "Login e senha inv�lidos",
                "Informe login e senha v�lidos!");
    }
}
DisplayWindow.java 文件源码 项目:marathonv5 阅读 58 收藏 0 点赞 0 评论 0
private boolean closeEditor(IEditor e) {
    if (e == null) {
        return true;
    }
    if (e.isDirty()) {
        Optional<ButtonType> result = FXUIUtils.showConfirmDialog(DisplayWindow.this,
                "File \"" + e.getName() + "\" Modified. Do you want to save the changes ",
                "File \"" + e.getName() + "\" Modified", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO,
                ButtonType.CANCEL);
        ButtonType shouldSaveFile = result.get();
        if (shouldSaveFile == ButtonType.CANCEL) {
            return false;
        }
        if (shouldSaveFile == ButtonType.YES) {
            File file = save(e);
            if (file == null) {
                return false;
            }
            EditorDockable dockable = (EditorDockable) e.getData("dockable");
            dockable.updateKey();
        }
    }
    return true;
}
DisplayWindow.java 文件源码 项目:marathonv5 阅读 35 收藏 0 点赞 0 评论 0
public boolean canAppend(File file) {
    EditorDockable dockable = findEditorDockable(file);
    if (dockable == null) {
        return true;
    }
    if (!dockable.getEditor().isDirty()) {
        return true;
    }
    Optional<ButtonType> result = FXUIUtils.showConfirmDialog(DisplayWindow.this,
            "File " + file.getName() + " being edited. Do you want to save the file?", "Save Module", AlertType.CONFIRMATION,
            ButtonType.YES, ButtonType.NO);
    ButtonType option = result.get();
    if (option == ButtonType.YES) {
        save(dockable.getEditor());
        return true;
    }
    return false;
}
FrmGerenciarHorario.java 文件源码 项目:AlphaLab 阅读 29 收藏 0 点赞 0 评论 0
@FXML
void btnProximo_onAction(ActionEvent event) {
    String string = getDadosTabVisualizar();

    if (string.length() > 0) {
        Alert alerta = new Alert(AlertType.INFORMATION);
        alerta.setTitle("AlphaLab");
        alerta.setHeaderText("Dados de Requisitos");
        alerta.setContentText(string);
        alerta.show();
    } else {
        tabVisualizar.setDisable(true);
        tabPreencherDados.setDisable(false);
        tbpDados.getSelectionModel().select(tabPreencherDados);
        texLaboratorio.setText(cmbLaboratorio.getValue().getNome());
        if (hbxHorarios.getChildren() != null)
            hbxHorarios.getChildren().clear();
        criarNovasReservas();
        hbxHorarios.getChildren().addAll(buildBoxHorario());
        cmbProfessor.requestFocus();
    }
}
FXUIUtils.java 文件源码 项目:marathonv5 阅读 37 收藏 0 点赞 0 评论 0
public static void showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) {
    if (Platform.isFxApplicationThread()) {
        _showMessageDialog(parent, message, title, type, monospace);
    } else {
        Object lock = new Object();
        synchronized (lock) {
            Platform.runLater(() -> {
                _showMessageDialog(parent, message, title, type, monospace);
                lock.notifyAll();
            });
        }
        synchronized (lock) {
            try {
                lock.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
FXUIUtils.java 文件源码 项目:marathonv5 阅读 42 收藏 0 点赞 0 评论 0
public static void _showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) {
    Alert alert = new Alert(type);
    alert.initOwner(parent);
    alert.setTitle(title);
    alert.setHeaderText(title);
    alert.setContentText(message);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.setResizable(true);
    if (monospace) {
        Text text = new Text(message);
        alert.getDialogPane().setStyle("-fx-padding: 0 10px 0 10px;");
        text.setStyle(" -fx-font-family: monospace;");
        alert.getDialogPane().contentProperty().set(text);
    }
    alert.showAndWait();
}
ToDoOverviewController.java 文件源码 项目:kanphnia2 阅读 33 收藏 0 点赞 0 评论 0
@FXML
private void handleEditEntry() throws Exception {
    Entry selectedEntry = entryTable.getSelectionModel().getSelectedItem();

    if (selectedEntry != null) {
        boolean okClicked = mainApp.showAppEditDialog(selectedEntry);

        if (okClicked) {
            // removed description field
        }
    }
    else {
        Alert alert = new Alert(AlertType.WARNING);
        alert.initOwner(mainApp.getPrimaryStage());
        alert.setTitle("No Selection");
        alert.setHeaderText("No Entry Selected");
        alert.setContentText("Please select an entry in the table.");

        alert.showAndWait();
    }
}
PlayGraphic.java 文件源码 项目:Himalaya-JavaFX 阅读 35 收藏 0 点赞 0 评论 0
@Override
protected void humanActions(Player p) {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ActionsFXML.fxml"));
        Parent root1 = (Parent) fxmlLoader.load();
        ActionsFXMLController actionCtrl = fxmlLoader.getController();
        actionCtrl.setPlayer(p);
        actionCtrl.setBackground(background);
        Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);

        //Pour click sur close de action
        stage.setOnCloseRequest((WindowEvent event) -> {
            // consume event
            event.consume();
            // show close dialog
            Alert alert = new Alert(AlertType.ERROR);
            alert.setTitle("Pas de précipitation !");
            alert.setHeaderText(null);
            alert.setContentText("Vous devez choisir 6 actions !\nNe pas oublier de choisir la région pour les délégations.");
            alert.showAndWait();
        });

        stage.setTitle("Choix des actions");
        stage.setScene(new Scene(root1));
        stage.showAndWait();

    } catch (IOException ex) {
        Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex);
    }
}
MainWindowController.java 文件源码 项目:mountieLibrary 阅读 40 收藏 0 点赞 0 评论 0
/**
 * Display an option Alert to verify user selection.
 * @param message The message to be displayed at the window.
 * @return an <code>integer</code> specifying if user wants to proceed or not.
 */
public int optionsAlert(String message){
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Delete permanetly");
    alert.setHeaderText(null);
    alert.setContentText(message);

    ButtonType button1 = new ButtonType("Yes");
    ButtonType button2 = new ButtonType("No");

    alert.getButtonTypes().setAll(button2, button1);
    Optional<ButtonType> result = alert.showAndWait();

    if (result.get() == button1)
        return 1; //1 == delete
    else
        return 0; //0 == don't delete
}
DialogUtil.java 文件源码 项目:keyboard-light-composer 阅读 48 收藏 0 点赞 0 评论 0
public static void showPropertyContainerEditor(Window owner, KlcPropertyContainer propertyContainer, String title,
        String headerText, String contentText) {

    Alert alert = new Alert(AlertType.CONFIRMATION, contentText, ButtonType.OK);
    alert.setTitle(title);
    alert.setHeaderText(headerText);
    alert.initOwner(owner);
    alert.initModality(Modality.WINDOW_MODAL);

    KlcPropertyContainerEditor editor = new KlcPropertyContainerEditor();
    editor.setPrefWidth(300);
    editor.setPrefHeight(200);
    editor.setPropertyContainer(propertyContainer);
    alert.getDialogPane().setContent(editor);

    alert.showAndWait();

}
FolderResource.java 文件源码 项目:marathonv5 阅读 47 收藏 0 点赞 0 评论 0
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete the folder `" + path + "` and all its children?",
                "Confirm", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        if (Files.exists(path)) {
            try {
                File file = path.toFile();
                File[] listFiles = file.listFiles();
                option = Copy.delete(path, option);
                if (listFiles.length > 0)
                    for (File f : listFiles) {
                        Event.fireEvent(this,
                                new ResourceModificationEvent(ResourceModificationEvent.DELETE, new FileResource(f)));
                    }
                Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
                getParent().getChildren().remove(this);
            } catch (IOException e) {
                String message = String.format("Unable to delete: %s: %s%n", path, e);
                FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
            }
        }
    }
    return option;
}
RealMain.java 文件源码 项目:marathonv5 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Given a directory key like marathon.test.dir check whether given
 * directory exists.
 *
 * @param dirKey
 *            , a property key
 * @return true, if the directory exists
 */
private static boolean dirExists(String dirKey, boolean batchMode) {
    String dirName = System.getProperty(dirKey);
    if (dirKey != null) {
        dirName = dirName.replace(';', File.pathSeparatorChar);
        dirName = dirName.replace('/', File.separatorChar);
        System.setProperty(dirKey, dirName);
    }
    dirName = System.getProperty(dirKey);
    String[] values = dirName.split(String.valueOf(File.pathSeparatorChar));
    for (String value : values) {
        File dir = new File(value);
        if (!dir.exists() || !dir.isDirectory()) {
            if (batchMode)
                System.err.println("Invalid directory specified for " + dirKey + " - " + dirName);
            else
                FXUIUtils.showMessageDialog(null, "Invalid directory specified for " + dirKey + " - " + dirName, "Error",
                        AlertType.ERROR);
            return false;
        }
    }
    return true;
}
InterviewTreeView.java 文件源码 项目:uPMT 阅读 68 收藏 0 点赞 0 评论 0
public void deleteInterview(DescriptionEntretien interview){
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Supression Entretien");
    alert.setHeaderText("Vous allez supprimer "+interview.getNom());

    ButtonType buttonTypeOne = new ButtonType("Valider");
    ButtonType buttonTypeCancel = new ButtonType("Annuler", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == buttonTypeOne){
        main.getCurrentProject().getEntretiens().remove(interview);
        this.getTreeItem().getParent().getChildren().remove(this.getTreeItem());
    }
}
RootLayoutController.java 文件源码 项目:kanphnia2 阅读 29 收藏 0 点赞 0 评论 0
@FXML
private void handleNew() {
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Confirmation Dialog");
    alert.setHeaderText("Do you want to save your current changes?");
    alert.setContentText("");

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK){
        File entryFile = mainApp.getFilePath();
        mainApp.saveEntryDataToFile(entryFile);
    }

    mainApp.getEntryList().clear();
    mainApp.setFilePath(null);
}


问题


面经


文章

微信
公众号

扫码关注公众号