// Handler for MenuItem[fx:id="assignOfficialMenuItem"] onAction
 public void assignOfficial(ActionEvent event) {
   // TODO add assertions to be sure that no null value are passed to the
   // controller
   officialsController.assignOfficialTo(
       officialsFilteredTableView.getSelectionModel().getSelectedItem(),
       assigmentsListView.getSelectionModel().getSelectedItem());
 }
  @FXML
  void initialize() {

    //
    // Defines for event list
    //
    removeButton.setDisable(true);
    editButton.setDisable(true);
    listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    listView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue observableValue, Object o, Object o2) {
                // Selected
                if (listView.getSelectionModel().getSelectedItem() == null) {
                  removeButton.setDisable(true);
                  editButton.setDisable(true);
                } else {
                  removeButton.setDisable(false);
                  editButton.setDisable(false);
                }

                //
                if (listView.getItems().size() != 0) {
                  clearButton.setDisable(false);
                } else {
                  clearButton.setDisable(true);
                }
              }
            });

    //
    // Defines for date picker
    //
    datePicker.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            listView.getItems().clear();

            List<EventController.EventInfo> list =
                EventController._eventMap.get(datePicker.getValue());
            if (list == null) {
              // No items
            } else {

              // Sorting by time
              TreeMap<String, String> sortedMap = new TreeMap<String, String>();
              for (EventController.EventInfo info : list) {
                sortedMap.put(info.Time, info.Description);
              }

              for (Map.Entry<String, String> entry : sortedMap.entrySet()) {
                mainApplication.addEvent(entry.getKey(), entry.getValue());
              }
            }
          }
        });

    //
    // Defines for clear button
    //
    clearButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            List<EventController.EventInfo> list =
                EventController._eventMap.get(datePicker.getValue());
            if (list == null) {
              // No items
            } else {
              listView.getItems().clear();
              list.clear();
            }
          }
        });

    //
    // Defines for add button
    //
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            mainApplication.displayAdd();
          }
        });

    //
    // Defines for remove button
    //
    removeButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            // Not null
            TempClass selectedTemp = itemMap.get(listView.getSelectionModel().getSelectedItem());
            if (listView.getSelectionModel().getSelectedItem() != null) {
              listView.getItems().remove(listView.getSelectionModel().getSelectedItem());
              EventController.RemoveEvent(
                  datePicker.getValue(), selectedTemp.Time, selectedTemp.Description);
            }
          }
        });

    //
    // Defines for edit button
    //
    editButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            // Not null
            Object selectedItem = listView.getSelectionModel().getSelectedItem();
            if (selectedItem != null) {
              TempClass temp = itemMap.get(selectedItem);
              mainApplication.displayEdit(
                  datePicker.getValue(), temp.Time, temp.Description, selectedItem);
            }
          }
        });
  }