Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package lapr.project.ui;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.control.Alert;
- import javafx.scene.control.ButtonType;
- import javafx.scene.control.Label;
- import javafx.scene.control.ListView;
- import javafx.stage.Stage;
- import lapr.project.controller.ReviewPendingApplicationListController;
- import lapr.project.model.event.EventRegistry;
- import java.net.URL;
- import java.util.List;
- import java.util.Optional;
- import java.util.ResourceBundle;
- /**
- * Review Pending applications listing
- *
- * @author gugar
- */
- public class ReviewPendingApplicationListUI implements Initializable {
- /**
- * Title of the UC
- */
- @FXML
- private Label Title;
- /**
- * Subtitle of the UC
- */
- @FXML
- private Label SubTitle;
- /**
- * The Review Pending Application's list view.
- * The elements are each application description.
- */
- @FXML
- private ListView<String> rpappListView;
- /**
- * The systems event registry.
- */
- public EventRegistry eventRegistry;
- /**
- * The previously selected event name.
- */
- public String eventName;
- /**
- * The list review pending applications use case controller.
- */
- public ReviewPendingApplicationListController reviewPendingApplicationListController;
- /**
- * Creates the list pending applications list use case controller.
- * Must be called before attempting to register an event.
- *
- * @param eventRegistry the system's event registry.
- * @param eventName the event's name
- */
- public void createUCController(EventRegistry eventRegistry, String eventName) {
- reviewPendingApplicationListController = new ReviewPendingApplicationListController(eventRegistry, eventName);
- }
- /**
- * Fills the application list view with the pending applications
- */
- public void fillApplications() {
- List<String> eventReviewPendingApps = reviewPendingApplicationListController.getPendingApplicationNames();
- ObservableList<String> reviewPendingAppsObsList = FXCollections.observableArrayList(eventReviewPendingApps);
- rpappListView.setItems(reviewPendingAppsObsList);
- }
- /**
- * Initializes the controller class.
- */
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- // TODO
- }
- /**
- * Asks for confirmation and cancels the listing process.
- * @param event the action event.
- */
- @FXML
- private void Cancel(ActionEvent event) {
- Alert confirmationAlert = new Alert(Alert.AlertType.CONFIRMATION);
- confirmationAlert.setTitle("Are you sure?");
- confirmationAlert.setHeaderText("Exit the Application's Listing");
- confirmationAlert.setContentText("Are you sure that you want to exit the listing process?");
- Optional<ButtonType> result = confirmationAlert.showAndWait();
- if (result.isPresent() && result.get() == ButtonType.OK) {
- Stage stage = (Stage) Title.getScene().getWindow();
- stage.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement