Search in sources :

Example 71 with ActionEvent

use of javafx.event.ActionEvent in project Money-Manager by krHasan.

the class SettingsController method unarchiveSector.

@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);
        Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                confirmationMsg.hide();
            }
        }));
        idlestage.setCycleCount(1);
        idlestage.play();
        confirmationMsg.showAndWait();
        tabSectorInitialize();
    } catch (Exception e) {
    }
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 72 with ActionEvent

use of javafx.event.ActionEvent in project Money-Manager by krHasan.

the class SettingsController method sourcebtnDelete.

@FXML
private void sourcebtnDelete(ActionEvent event) {
    try {
        Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
        Alert alert = new Alert(AlertType.CONFIRMATION);
        alert.setTitle("Delete Source");
        alert.setHeaderText("Are you sure?");
        alert.setContentText("You are going to delete Source \"" + sourcecmboDelete.getValue() + "\" ");
        alert.setX(SettingsStage.getX() + 210);
        alert.setY(SettingsStage.getY() + 170);
        Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK) {
            source.deleteSource(sourcecmboDelete.getValue());
            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
            confirmationMsg.setTitle("Message");
            confirmationMsg.setHeaderText(null);
            confirmationMsg.setContentText(sourcecmboDelete.getValue() + " Deleted Successfully");
            confirmationMsg.setX(SettingsStage.getX() + 190);
            confirmationMsg.setY(SettingsStage.getY() + 190);
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    confirmationMsg.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            confirmationMsg.showAndWait();
        }
        tabSourceInitialize();
    } catch (Exception e) {
    }
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) ButtonType(javafx.scene.control.ButtonType) FXML(javafx.fxml.FXML)

Example 73 with ActionEvent

use of javafx.event.ActionEvent in project Money-Manager by krHasan.

the class SettingsController method changeName.

@FXML
private void changeName(ActionEvent event) {
    try {
        if (!nameChangeClicked) {
            TextInputDialog dialog = new TextInputDialog();
            dialog.setTitle("Name Change");
            dialog.setHeaderText("Enter password for authentication");
            dialog.setContentText("Your Password :");
            Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
            dialog.setX(SettingsStage.getX() + 200);
            dialog.setY(SettingsStage.getY() + 170);
            Optional<String> result = dialog.showAndWait();
            if (result.isPresent()) {
                if (getPassword().equals(result.get())) {
                    systemtxtName.setDisable(false);
                    systembtnChangeName.setText("Save Name");
                    nameChangeClicked = true;
                } else {
                    Alert alert = new Alert(AlertType.WARNING);
                    alert.setTitle("Message");
                    alert.setHeaderText(null);
                    alert.setContentText("Wrong Password");
                    alert.setX(SettingsStage.getX() + 200);
                    alert.setY(SettingsStage.getY() + 170);
                    Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {

                        @Override
                        public void handle(ActionEvent event) {
                            alert.hide();
                        }
                    }));
                    idlestage.setCycleCount(1);
                    idlestage.play();
                    alert.showAndWait();
                }
            }
        } else {
            setUserFullName(systemtxtName.getText());
            nameChangeClicked = false;
            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
            confirmationMsg.setTitle("Message");
            confirmationMsg.setHeaderText(null);
            confirmationMsg.setContentText("Information updated successfully");
            Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
            confirmationMsg.setX(SettingsStage.getX() + 200);
            confirmationMsg.setY(SettingsStage.getY() + 170);
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    confirmationMsg.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            confirmationMsg.showAndWait();
            lblUserFullName.setText(getUserFullName());
            tabSystemInitialize();
        }
    } catch (Exception e) {
    }
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) TextInputDialog(javafx.scene.control.TextInputDialog) FXML(javafx.fxml.FXML)

Example 74 with ActionEvent

use of javafx.event.ActionEvent in project Money-Manager by krHasan.

the class SettingsController method advancedBtnAdd.

@FXML
private void advancedBtnAdd(ActionEvent event) {
    try {
        if (new ComboboxList().getAdvancedSectorActiveArraySize() == 7) {
            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
            confirmationMsg.setTitle("Message");
            confirmationMsg.setHeaderText(null);
            confirmationMsg.setContentText("You can add maximum 7 sector to this list");
            Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
            confirmationMsg.setX(SettingsStage.getX() + 200);
            confirmationMsg.setY(SettingsStage.getY() + 170);
            tabAdvancedInitialize();
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(7), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    confirmationMsg.setResult(ButtonType.CANCEL);
                    confirmationMsg.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            confirmationMsg.showAndWait();
        } else {
            advancedSector.addSectorToList(advancedCmboAdd.getValue());
            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
            confirmationMsg.setTitle("Message");
            confirmationMsg.setHeaderText(null);
            confirmationMsg.setContentText("Successful");
            Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
            confirmationMsg.setX(SettingsStage.getX() + 200);
            confirmationMsg.setY(SettingsStage.getY() + 28);
            tabAdvancedInitialize();
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    confirmationMsg.setResult(ButtonType.CANCEL);
                    confirmationMsg.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            confirmationMsg.showAndWait();
        }
    } catch (Exception e) {
    }
}
Also used : Timeline(javafx.animation.Timeline) ComboboxList(operation.ComboboxList) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 75 with ActionEvent

use of javafx.event.ActionEvent in project Money-Manager by krHasan.

the class TransactionHistoryController method mnuUndo.

@FXML
private void mnuUndo(ActionEvent event) {
    String feedback = new Undo().actionUndo();
    Stage TransactionHistoryStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("Action Successful");
    alert.setHeaderText(null);
    alert.setContentText(feedback);
    alert.setX(TransactionHistoryStage.getX() + 190);
    alert.setY(TransactionHistoryStage.getY() + 190);
    initialize();
    Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            alert.hide();
        }
    }));
    idlestage.setCycleCount(1);
    idlestage.play();
    alert.showAndWait();
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) Undo(system.Undo) FXML(javafx.fxml.FXML)

Aggregations

ActionEvent (javafx.event.ActionEvent)171 EventHandler (javafx.event.EventHandler)61 Stage (javafx.stage.Stage)52 KeyFrame (javafx.animation.KeyFrame)47 Timeline (javafx.animation.Timeline)47 FXML (javafx.fxml.FXML)44 Alert (javafx.scene.control.Alert)36 Button (javafx.scene.control.Button)35 Label (javafx.scene.control.Label)35 MenuItem (javafx.scene.control.MenuItem)33 ContextMenu (javafx.scene.control.ContextMenu)25 File (java.io.File)24 Insets (javafx.geometry.Insets)24 Scene (javafx.scene.Scene)24 List (java.util.List)21 ObservableList (javafx.collections.ObservableList)21 Node (javafx.scene.Node)20 TextField (javafx.scene.control.TextField)20 Optional (java.util.Optional)18 FXCollections (javafx.collections.FXCollections)18