Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package lapr.project.ui;
  7.  
  8. import javafx.collections.FXCollections;
  9. import javafx.collections.ObservableList;
  10. import javafx.event.ActionEvent;
  11. import javafx.fxml.FXML;
  12. import javafx.fxml.Initializable;
  13. import javafx.scene.control.Alert;
  14. import javafx.scene.control.ButtonType;
  15. import javafx.scene.control.Label;
  16. import javafx.scene.control.ListView;
  17. import javafx.stage.Stage;
  18. import lapr.project.controller.ReviewPendingApplicationListController;
  19. import lapr.project.model.event.EventRegistry;
  20.  
  21. import java.net.URL;
  22. import java.util.List;
  23. import java.util.Optional;
  24. import java.util.ResourceBundle;
  25.  
  26. /**
  27. * Review Pending applications listing
  28. *
  29. * @author gugar
  30. */
  31. public class ReviewPendingApplicationListUI implements Initializable {
  32. /**
  33. * Title of the UC
  34. */
  35. @FXML
  36. private Label Title;
  37. /**
  38. * Subtitle of the UC
  39. */
  40. @FXML
  41. private Label SubTitle;
  42. /**
  43. * The Review Pending Application's list view.
  44. * The elements are each application description.
  45. */
  46. @FXML
  47. private ListView<String> rpappListView;
  48.  
  49.  
  50. /**
  51. * The systems event registry.
  52. */
  53. public EventRegistry eventRegistry;
  54. /**
  55. * The previously selected event name.
  56. */
  57. public String eventName;
  58.  
  59. /**
  60. * The list review pending applications use case controller.
  61. */
  62. public ReviewPendingApplicationListController reviewPendingApplicationListController;
  63.  
  64.  
  65. /**
  66. * Creates the list pending applications list use case controller.
  67. * Must be called before attempting to register an event.
  68. *
  69. * @param eventRegistry the system's event registry.
  70. * @param eventName the event's name
  71. */
  72.  
  73. public void createUCController(EventRegistry eventRegistry, String eventName) {
  74. reviewPendingApplicationListController = new ReviewPendingApplicationListController(eventRegistry, eventName);
  75. }
  76.  
  77.  
  78. /**
  79. * Fills the application list view with the pending applications
  80. */
  81. public void fillApplications() {
  82.  
  83. List<String> eventReviewPendingApps = reviewPendingApplicationListController.getPendingApplicationNames();
  84. ObservableList<String> reviewPendingAppsObsList = FXCollections.observableArrayList(eventReviewPendingApps);
  85. rpappListView.setItems(reviewPendingAppsObsList);
  86. }
  87.  
  88. /**
  89. * Initializes the controller class.
  90. */
  91. @Override
  92. public void initialize(URL url, ResourceBundle rb) {
  93. // TODO
  94. }
  95.  
  96. /**
  97. * Asks for confirmation and cancels the listing process.
  98. * @param event the action event.
  99. */
  100. @FXML
  101. private void Cancel(ActionEvent event) {
  102. Alert confirmationAlert = new Alert(Alert.AlertType.CONFIRMATION);
  103. confirmationAlert.setTitle("Are you sure?");
  104. confirmationAlert.setHeaderText("Exit the Application's Listing");
  105. confirmationAlert.setContentText("Are you sure that you want to exit the listing process?");
  106.  
  107. Optional<ButtonType> result = confirmationAlert.showAndWait();
  108. if (result.isPresent() && result.get() == ButtonType.OK) {
  109. Stage stage = (Stage) Title.getScene().getWindow();
  110. stage.close();
  111. }
  112. }
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement