Class AddIncomeController

java.lang.Object
no.ntnu.idatt1002.demo.controller.AddIncomeController

public class AddIncomeController extends Object
Class that represents the popup dialog box that appears whenever an income is to be added or edited. The dialog contains various fields that are used to create a new income or edit an existing income.
Since:
24.3.2023
Author:
Harry Linrui Xu
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the value of the category box.
    Gets the newly created income.
    void
    Initializes the category and recurring drop boxes by filling them with all the values from the IncomeCategory enum, and the boolean values respectively, and the datepicker calendar.
    boolean
    Gets the value from the recurring box.
    void
    pressCancelBtn(javafx.event.ActionEvent event)
    Closes the dialog box and cancels any pending changes.
    void
    pressOkBtn(javafx.event.ActionEvent event)
    Adds a new to the tableview or edits an existing entry in table if the OK button is pressed.
    void
    setIncome(Income income)
    Binds the income that is taken in as the argument with an income declared in this class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AddIncomeController

      public AddIncomeController()
  • Method Details

    • initialize

      public void initialize()
      Initializes the category and recurring drop boxes by filling them with all the values from the IncomeCategory enum, and the boolean values respectively, and the datepicker calendar. It then sets them to the default values of GIFT, false and today respectively.
    • getCategory

      public IncomeCategory getCategory()
      Gets the value of the category box.
      Returns:
      The chosen income category.
    • isRecurring

      public boolean isRecurring()
      Gets the value from the recurring box.
      Returns:
      The chosen recurring boolean value.
    • getNewIncome

      public Income getNewIncome()
      Gets the newly created income.
      Returns:
      The new income.
    • setIncome

      public void setIncome(Income income)
      Binds the income that is taken in as the argument with an income declared in this class. The income of this class is instantiated as a deep copy of the argument. Each attribute of their attributes are then bounded. The text fields and category boxes in the dialog window are then set to the values of the chosen income, as to not display empty values.
      Parameters:
      income - The income that is chosen to be edited.
    • pressOkBtn

      public void pressOkBtn(javafx.event.ActionEvent event)
      Adds a new to the tableview or edits an existing entry in table if the OK button is pressed. An entry is edited as the selected entry of the table is bounded to another income in this class. If this income is altered, the income in the tableview will automatically respond with the same changes.
      Parameters:
      event - If the OK button is pressed.
    • pressCancelBtn

      public void pressCancelBtn(javafx.event.ActionEvent event)
      Closes the dialog box and cancels any pending changes.
      Parameters:
      event - A button click on the cancel button.