Class MenuBar


  • class MenuBar
    extends java.lang.Object
    This class is used in order to implements all the options in this menu.
    Author:
    CADOUL Michael AND VERY-GRIETTE Milan
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.swing.JFileChooser fc
      JMenuBar component
      private javax.swing.JMenuBar menuBar  
      private javax.swing.JFileChooser save
      File chooser to select .txt
    • Constructor Summary

      Constructors 
      Constructor Description
      MenuBar​(MainPanel mainPanel)
      Class constructor
    • Method Summary

      Modifier and Type Method Description
      (package private) javax.swing.JMenuBar getMenuBar()
      Getter
      (package private) void loadFileDat​(java.io.File file, MainPanel context)
      Used to load a .dat file and restore the state of a TaskStorage instance
      private void showDialog​(MainPanel mainPanel, java.lang.String message)
      Used to show a personalized JOptionPane, with a specific message
      private void writeFileDat​(java.io.File file, TaskStorage object, MainPanel context)
      Used in order to save all the informations stored in the memory with the TaskStorage class.
      private void writeFileTxt​(java.io.File file, MainPanel context)
      Used to write a txt file with all the saved tasks
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • menuBar

        private javax.swing.JMenuBar menuBar
      • fc

        private javax.swing.JFileChooser fc
        JMenuBar component
      • save

        private javax.swing.JFileChooser save
        File chooser to select .txt
    • Constructor Detail

      • MenuBar

        MenuBar​(MainPanel mainPanel)
        Class constructor
        Parameters:
        mainPanel - Using a reference to the MainPanel
    • Method Detail

      • writeFileTxt

        private void writeFileTxt​(java.io.File file,
                                  MainPanel context)
        Used to write a txt file with all the saved tasks
        Parameters:
        file - The File element given thanks to the fileChooser (used to get the path basically)
        context - Using a reference to the MainPanel.
      • writeFileDat

        private void writeFileDat​(java.io.File file,
                                  TaskStorage object,
                                  MainPanel context)
        Used in order to save all the informations stored in the memory with the TaskStorage class. So, we can save a .dat file, which going to write the current state of the Task storage instance, and reload it after when we run this app again for example. Thanks to this, the tasks data are persistent.
        Parameters:
        file - The File element given thanks to the fileChooser (used to get the path basically)
        object - The object that we want to save
        context - Using a reference to the MainPanel.
      • loadFileDat

        void loadFileDat​(java.io.File file,
                         MainPanel context)
        Used to load a .dat file and restore the state of a TaskStorage instance
        Parameters:
        file - The File element given thanks to the fileChooser (used to get the path basically)
        context - Using a reference to the MainPanel.
      • showDialog

        private void showDialog​(MainPanel mainPanel,
                                java.lang.String message)
        Used to show a personalized JOptionPane, with a specific message
        Parameters:
        mainPanel - Using the reference of the MainPanel.
        message - The message we want to show
      • getMenuBar

        javax.swing.JMenuBar getMenuBar()
        Getter
        Returns:
        The JMeneBar