Class ViewHelper

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ViewHelper extends JFrame
Utility class that provides helper functionalities for the application view.
See Also:
  • Field Details

    • SECONDS_SHOWING_MESSAGES

      public static final int SECONDS_SHOWING_MESSAGES
      In seconds, for how long messages are shown to the user.
      See Also:
  • Constructor Details

    • ViewHelper

      private ViewHelper()
      Utility class
  • Method Details

    • showErrorMessageInStatus

      public static void showErrorMessageInStatus(JLabel label, String message)
      Writes an error message in a label for SECONDS_SHOWING_MESSAGES
      Parameters:
      label - the label where the message is written
      message - the message
    • showMessageInStatus

      public static void showMessageInStatus(JLabel label, String message)
      Writes a message in a label for SECONDS_SHOWING_MESSAGES
      Parameters:
      label - the label where the message is written
      message - the message
    • writeInStatusLabel

      private static void writeInStatusLabel(JLabel label, String message)
      Writes message in a label for SECONDS_SHOWING_MESSAGES
      Parameters:
      label - the label where the message is written
      message - the message
    • selectFileFromDisk

      public static Optional<String> selectFileFromDisk(JFrame parent, String description, String... extensions)
      Shows the dialog window to select a file, returning the name of the file selected.
      Parameters:
      description - description of the type of files to be opened
      extensions - all the file extensions to be used as filter
      Returns:
      the absolute path of the selected file; null if no file was selected.
    • getResourceNamePath

      public static String getResourceNamePath(String resourceName)
      Gets the file path for a resource
      Parameters:
      resourceName - the name of the resource
      Returns:
      the whole path where the resource is placed