Class ApplicationViewLogic

  • All Implemented Interfaces:
    Serializable

    public class ApplicationViewLogic
    extends Object
    implements Serializable
    This class provides an interface for the logical operations between the CRUD view, its parts like the Job editor form and the data source, including fetching and saving jobs. Having this separate from the view makes it easier to test various parts of the system separately, and to e.g. provide alternative views for the same data.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ApplicationViewLogic​(ApplicationView simpleCrudView)
      ApplicationViewLogic constructor to initialize the CRUD view object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancelJob()
      The function simply remove everything fromt he application form if someone want to cancel any modification of any existing job or new job
      void deleteJob​(Jobs job)
      This function use a job object as parameter and utilize the view object to call the delete method for the job instance.
      void editJob​(Jobs job)
      This function use a job object as parameter and utilize the view object to call the edit method for the job instance.
      void enter​(String jobId)
      Opens the Application form and clears its fields to make it ready for entering a new Job if Id is null, otherwise loads the Jobs with the given jobId and shows its data in the form fields so the user can edit them.
      void newJob()
      This function use a job object as parameter and utilize the view to clear all previous selctions for adding new job.
      void rowSelected​(Jobs job)
      Row selection method pop up the job selected from the dashboard grid and show it on the application form
      void saveProduct​(Jobs job)
      This function use a job object as parameter and check whether the job is a new job or not by isNewJob() after that its clearing the fields on the application form.
    • Constructor Detail

      • ApplicationViewLogic

        public ApplicationViewLogic​(ApplicationView simpleCrudView)
        ApplicationViewLogic constructor to initialize the CRUD view object
        Parameters:
        simpleCrudView - application view UI
    • Method Detail

      • cancelJob

        public void cancelJob()
        The function simply remove everything fromt he application form if someone want to cancel any modification of any existing job or new job
      • enter

        public void enter​(String jobId)
        Opens the Application form and clears its fields to make it ready for entering a new Job if Id is null, otherwise loads the Jobs with the given jobId and shows its data in the form fields so the user can edit them.
        Parameters:
        jobId - of the job object to load
        Throws:
        NumberFormatException - if there is an issue parsing the int
      • saveProduct

        public void saveProduct​(Jobs job)
        This function use a job object as parameter and check whether the job is a new job or not by isNewJob() after that its clearing the fields on the application form. using the view instance to call the updatejob method to save or update the job
        Parameters:
        job - object to save
        Throws:
        IllegalArgumentException - if you can't read or write to the file
        See Also:
        Notification.show(String)
      • deleteJob

        public void deleteJob​(Jobs job)
        This function use a job object as parameter and utilize the view object to call the delete method for the job instance. After deleting the job a popup message will show as the success of removing the job
        Parameters:
        job - object to delete
        See Also:
        Notification.show(String)
      • editJob

        public void editJob​(Jobs job)
        This function use a job object as parameter and utilize the view object to call the edit method for the job instance. After it will pop up the information from the desired job of grids to the application form.
        Parameters:
        job - to edit
      • newJob

        public void newJob()
        This function use a job object as parameter and utilize the view to clear all previous selctions for adding new job. then it would call the edit function to load that jobo
      • rowSelected

        public void rowSelected​(Jobs job)
        Row selection method pop up the job selected from the dashboard grid and show it on the application form
        Parameters:
        job - object for the row object