use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class NewUserRegistrationController method btnRegistration.
@FXML
private void btnRegistration(ActionEvent event) {
if (txtName.getText().isEmpty() || countWords(txtName.getText()) == 0) {
lblMsg1.setText("Write your name");
txtName.clear();
} else if (txtUsername.getText().isEmpty()) {
lblMsg1.setText("Set a Username");
} else if (passPassword.getText().isEmpty()) {
lblMsg1.setText("Set a Password");
} else if (!passPassword.getText().equals(passReTypePassword.getText())) {
lblMsg1.setText("Re-type Password Correctly");
} else if (txtAnswer.getText().isEmpty()) {
lblMsg1.setText("Set a Security Question Answer");
} else {
boolean feedback = setUsername(txtUsername.getText());
setUserFullName(txtName.getText());
setPassword(passPassword.getText());
setSecurityQuestion(cmboSecurityQuestion.getValue());
setSecurityQuestionAnswer(txtAnswer.getText());
Stage NewUserRegistrationStage = (Stage) btnRegistration.getScene().getWindow();
(new GoToOperation()).goToSignIn(NewUserRegistrationStage);
if (feedback) {
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Created User Successfully");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Account Created Successfully");
confirmationMsg.setX(NewUserRegistrationStage.getX() + 200);
confirmationMsg.setY(NewUserRegistrationStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
} else {
Alert confirmationMsg = new Alert(AlertType.ERROR);
confirmationMsg.setTitle("Sign Up Failed");
confirmationMsg.setHeaderText("Sign Up Failed");
confirmationMsg.setContentText("There have some problem.");
confirmationMsg.setX(NewUserRegistrationStage.getX() + 200);
confirmationMsg.setY(NewUserRegistrationStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
}
}
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class RegistrationIssueController method btnSave.
@FXML
private void btnSave(ActionEvent event) {
if (passPassword.getText().isEmpty()) {
lblMsgInformation.setText("Password can't empty");
} else if (!passReTypePassword.getText().equals(passPassword.getText())) {
lblMsgInformation.setText("Re-type Your Password Correctly");
} else if (txtAnswer.getText().isEmpty() || countWords(txtAnswer.getText()) == 0) {
lblMsgInformation.setText("Answer the Security Question.");
} else {
setPassword(passPassword.getText());
setSecurityQuestion(cmboSecurityQuestion.getValue());
setSecurityQuestionAnswer(txtAnswer.getText());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Operation Successful");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Information Updated Successfully");
Stage RegistrationIssueStage = (Stage) btnSave.getScene().getWindow();
confirmationMsg.setX(RegistrationIssueStage.getX() + 200);
confirmationMsg.setY(RegistrationIssueStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
(new GoToOperation()).goToSignIn(RegistrationIssueStage);
}
}
use of javafx.event.ActionEvent in project Malai by arnobl.
the class BaseWIMPWidgetTest method testProcessEventGoodDataOnStart.
@Test
void testProcessEventGoodDataOnStart() {
interaction.getFsm().addHandler(new InteractionHandlerStub() {
@Override
public void fsmStarts() {
assertEquals(wimpWidget, interaction.getWidget());
}
});
interaction.processEvent(new ActionEvent(wimpWidget, null));
JfxtestHelper.waitForTimeoutTransitions();
}
use of javafx.event.ActionEvent in project Malai by arnobl.
the class TestMenuItemPressed method testProcessEventReinit.
@Test
void testProcessEventReinit() {
interaction.processEvent(new ActionEvent(menuitem, null));
assertNull(interaction.getWidget());
assertTrue(interaction.getFsm().getCurrentState() instanceof InitState);
}
use of javafx.event.ActionEvent in project Malai by arnobl.
the class TestMenuItemPressed method testProcessEventGoodData.
@Test
void testProcessEventGoodData() {
interaction.getFsm().addHandler(new InteractionHandlerStub() {
@Override
public void fsmStops() {
assertEquals(menuitem, interaction.getWidget());
}
});
interaction.processEvent(new ActionEvent(menuitem, null));
}
Aggregations