java.lang.Object
edu.ntnu.idatt2001.carljgu.client.controllers.EditArmyController
All Implemented Interfaces:
javafx.fxml.Initializable

public class EditArmyController extends Object implements javafx.fxml.Initializable
A controller class which handles events in the fxml file edit-army.fxml. This includes requesting to import armies and simulate the battle
Version:
1.9 14.05.2022
Author:
Carl Gützkow
  • Field Details

    • editArmyTitle

      public javafx.scene.control.Label editArmyTitle
    • armyToString

      public javafx.scene.control.Label armyToString
    • editNameField

      public javafx.scene.control.TextField editNameField
    • editArmyNameButton

      public javafx.scene.control.Button editArmyNameButton
    • addUnitsButton

      public javafx.scene.control.Button addUnitsButton
    • deleteUnitsButton

      public javafx.scene.control.Button deleteUnitsButton
    • unitsTypeComboBox

      public javafx.scene.control.ComboBox<String> unitsTypeComboBox
    • amountOfUnitsSpinner

      public javafx.scene.control.Spinner<Integer> amountOfUnitsSpinner
    • unitsHealthSpinner

      public javafx.scene.control.Spinner<Integer> unitsHealthSpinner
    • unitsNameField

      public javafx.scene.control.TextField unitsNameField
    • allUnitsComboBox

      public javafx.scene.control.ComboBox<Unit> allUnitsComboBox
    • armyUnitsListView

      public javafx.scene.control.ListView<Unit> armyUnitsListView
    • changelogListView

      public javafx.scene.control.ListView<String> changelogListView
    • hboxRoot

      public javafx.scene.layout.HBox hboxRoot
    • observableChangelog

      private javafx.collections.ObservableList<String> observableChangelog
  • Constructor Details

    • EditArmyController

      public EditArmyController()
  • Method Details

    • editArmyName

      public void editArmyName()
      Called for updating the army's name.
    • addUnits

      public void addUnits()
      Called for adding new units. Adds units with information about amount of units, their name, their health, and their unit type.
    • deleteUnit

      public void deleteUnit()
      Called for deleting a unit.
    • cancelAllChanges

      public void cancelAllChanges()
      Cancel all changes and changes scene to the main page. As the changes are stored in a deep copy, the scene change disregards these changes.
    • writeToCSV

      public void writeToCSV()
      Writes the changed army to a csv file.
    • updateArmyAndGoBack

      public void updateArmyAndGoBack()
      Update army and go back. Sets the original army to the deep copied army.
    • displaySuccessfulPopupMessage

      public void displaySuccessfulPopupMessage(String successMessage)
      Display successful popup message. Creates a new stage which is removed after a click. Adds a blur effect behind the popup message that is removed after it is hidden.
      Parameters:
      successMessage - the success message
    • updateComponentsWithInformation

      public void updateComponentsWithInformation()
      Update all fields and labels with updated information.
    • addEventListenersToFieldsAndLists

      public void addEventListenersToFieldsAndLists()
      Adds event listeners to some fields to set buttons to disabled if input is invalid.
    • initialize

      public void initialize(URL url, ResourceBundle resourceBundle)
      Run when the fxml file is first loaded. Fills in the combo boxes and spinners
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url - URL - a Uniform Resource Loader
      resourceBundle - ResourceBundle