Class InterfaceSession

java.lang.Object
mgui.interfaces.InterfaceSession

public class InterfaceSession
extends java.lang.Object
This is the main entry point into the mgui application. The main method instantiates a MainFrame with an optionally specified init file. If no file is specified, InterfaceEnvironment uses its default init file.

This class represents a static session of modelGUI. It sets up the static InterfaceEnvironment and then displays a corresponding SessionFrame and InterfaceWorkspace instance.

See this wiki page for a description of init files.

Since:
1.0
Version:
1.0
Author:
Andrew Reid
See Also:
SessionFrame, InterfaceEnvironment
  • Constructor Summary

    Constructors
    Constructor Description
    InterfaceSession()  
  • Method Summary

    Modifier and Type Method Description
    static Clipboard getClipboard()
    Returns the clipboard for the current session.
    static InterfaceDisplayPanel getDisplayPanel()
    Returns the top display panel for the current session.
    static SessionFrame getSessionFrame()
    Returns the frame for the current session.
    static long getUID()
    Returns a unique identifier for this session.
    static InterfaceWorkspace getWorkspace()
    Returns the workspace for the current session.
    static void handleException​(java.lang.Exception ex)
    Handles an exception, assuming the LoggingType is Errors.
    static void handleException​(java.lang.Exception ex, LoggingType type)
    Handles an exception, based on the specified LoggingType.
    static boolean isInit()
    Specifies whether this session has been completely initialized yet.
    static boolean log​(java.lang.String message)
    Logs a message according the logging type of InterfaceEnvironment.
    static boolean log​(java.lang.String _message, LoggingType type)
    Logs a message according the logging type of InterfaceEnvironment.
    static boolean log​(java.lang.String _message, LoggingType type, boolean timestamp)
    Logs a message according the logging type of InterfaceEnvironment.
    static boolean showErrorsOnConsole()  
    static boolean showStackTraceOnConsole()  
    static void start()
    Main entry point into ModelGUI application.
    static void start​(boolean show_gui)
    Main entry point into ModelGUI application.
    static void start​(java.lang.String init)
    Main entry point into modelGUI application.
    static void start​(java.lang.String init, boolean show_gui)
    Main entry point into modelGUI application.
    static void start_no_gui()
    Main entry point into modelGUI application, without a frame being created.
    static void start_no_gui​(java.lang.String init)
    Main entry point into modelGUI application.
    static void terminate()
    Terminates this ModelGUI session and exits the JVM.

    Methods inherited from class java.lang.Object

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

    • InterfaceSession

      public InterfaceSession()
  • Method Details

    • start_no_gui

      public static void start_no_gui()
      Main entry point into modelGUI application, without a frame being created. Initializes InterfaceEnvironment from the default init file. Constructs and displays an instance of MainFrame, and sets the look and feel.
    • start_no_gui

      public static void start_no_gui​(java.lang.String init)
      Main entry point into modelGUI application. Initializes InterfaceEnvironment from the default init file. Constructs and displays an instance of MainFrame, and sets the look and feel.
    • start

      public static void start()
      Main entry point into ModelGUI application. Initializes InterfaceEnvironment from the default init file. Constructs and displays an instance of MainFrame, and sets the look and feel.
    • start

      public static void start​(boolean show_gui)
      Main entry point into ModelGUI application. Initializes InterfaceEnvironment from the default init file. Constructs and displays an instance of MainFrame, and sets the look and feel.
    • start

      public static void start​(java.lang.String init)
      Main entry point into modelGUI application. Initializes InterfaceEnvironment from the init file init, or a default init file if init is null. Constructs and displays an instance of MainFrame, and sets the look and feel.
      Parameters:
      init - the init file; if null, the environment loads from the default init file
    • start

      public static void start​(java.lang.String init, boolean show_gui)
      Main entry point into modelGUI application. Initializes InterfaceEnvironment from the init file init, or a default init file if init is null. Constructs and displays an instance of MainFrame, and sets the look and feel.
      Parameters:
      init - the init file; if null, the environment loads from the default init file
      how_gui - Whether to make the session frame visible
    • terminate

      public static void terminate()
      Terminates this ModelGUI session and exits the JVM.
    • getUID

      public static long getUID()
      Returns a unique identifier for this session.
      Returns:
    • getSessionFrame

      public static SessionFrame getSessionFrame()
      Returns the frame for the current session.
      Returns:
    • getWorkspace

      public static InterfaceWorkspace getWorkspace()
      Returns the workspace for the current session.
      Returns:
    • getDisplayPanel

      public static InterfaceDisplayPanel getDisplayPanel()
      Returns the top display panel for the current session.
      Returns:
    • isInit

      public static boolean isInit()
      Specifies whether this session has been completely initialized yet.
      Returns:
    • log

      public static boolean log​(java.lang.String message)
      Logs a message according the logging type of InterfaceEnvironment.
      Parameters:
      message -
      Returns:
    • log

      public static boolean log​(java.lang.String _message, LoggingType type)
      Logs a message according the logging type of InterfaceEnvironment. Whether the log occurs depends on the environment logging type for this session, and the type parameter:
      • Errors: Will always be logged
      • Concise: Will always be logged unless environment logging type is Errors
      • Verbose: Will only be logged if environment logging type is Verbose or Debug
      • Debug: Will only be logged is environment logging type is Debug

      This method is thread safe, since it calls invokeLater.

      Parameters:
      message -
      type -
      Returns:
    • log

      public static boolean log​(java.lang.String _message, LoggingType type, boolean timestamp)
      Logs a message according the logging type of InterfaceEnvironment. Whether the log occurs depends on the environment logging type for this session, and the type parameter:
      • Errors: Will always be logged
      • Concise: Will always be logged unless environment logging type is Errors
      • Verbose: Will only be logged if environment logging type is Verbose or Debug
      • Debug: Will only be logged is environment logging type is Debug
      Parameters:
      message - - message to log
      type - - logging type
      timestamp - - whether to log the timestamp
      Returns:
    • showErrorsOnConsole

      public static boolean showErrorsOnConsole()
    • showStackTraceOnConsole

      public static boolean showStackTraceOnConsole()
    • handleException

      public static void handleException​(java.lang.Exception ex)
      Handles an exception, assuming the LoggingType is Errors.
      Parameters:
      ex -
    • handleException

      public static void handleException​(java.lang.Exception ex, LoggingType type)
      Handles an exception, based on the specified LoggingType.
      Parameters:
      ex -
      type - The type of exception, determines how it will be displayed based on the current environment setting
    • getClipboard

      public static Clipboard getClipboard()
      Returns the clipboard for the current session. This can be used for simple copy/paste procedures.
      Returns: