Package mgui.interfaces
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 theLoggingType
isErrors.
static void
handleException(java.lang.Exception ex, LoggingType type)
Handles an exception, based on the specifiedLoggingType
.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 ofInterfaceEnvironment
.static boolean
log(java.lang.String _message, LoggingType type)
Logs a message according the logging type ofInterfaceEnvironment
.static boolean
log(java.lang.String _message, LoggingType type, boolean timestamp)
Logs a message according the logging type ofInterfaceEnvironment
.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. InitializesInterfaceEnvironment
from the default init file. Constructs and displays an instance ofMainFrame
, 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. InitializesInterfaceEnvironment
from the default init file. Constructs and displays an instance ofMainFrame
, and sets the look and feel. -
start
public static void start()Main entry point into ModelGUI application. InitializesInterfaceEnvironment
from the default init file. Constructs and displays an instance ofMainFrame
, and sets the look and feel. -
start
public static void start(boolean show_gui)Main entry point into ModelGUI application. InitializesInterfaceEnvironment
from the default init file. Constructs and displays an instance ofMainFrame
, and sets the look and feel. -
start
public static void start(java.lang.String init)Main entry point into modelGUI application. InitializesInterfaceEnvironment
from the init fileinit
, or a default init file ifinit
isnull
. Constructs and displays an instance ofMainFrame
, and sets the look and feel.- Parameters:
init
- the init file; ifnull
, 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. InitializesInterfaceEnvironment
from the init fileinit
, or a default init file ifinit
isnull
. Constructs and displays an instance ofMainFrame
, and sets the look and feel.- Parameters:
init
- the init file; ifnull
, the environment loads from the default init filehow_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
Returns the frame for the current session.- Returns:
-
getWorkspace
Returns the workspace for the current session.- Returns:
-
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 ofInterfaceEnvironment
.- Parameters:
message
-- Returns:
-
log
Logs a message according the logging type ofInterfaceEnvironment
. Whether the log occurs depends on the environment logging type for this session, and thetype
parameter:Errors
: Will always be loggedConcise
: Will always be logged unless environment logging type isErrors
Verbose
: Will only be logged if environment logging type isVerbose
orDebug
Debug
: Will only be logged is environment logging type isDebug
This method is thread safe, since it calls
invokeLater
.- Parameters:
message
-type
-- Returns:
-
log
Logs a message according the logging type ofInterfaceEnvironment
. Whether the log occurs depends on the environment logging type for this session, and thetype
parameter:Errors
: Will always be loggedConcise
: Will always be logged unless environment logging type isErrors
Verbose
: Will only be logged if environment logging type isVerbose
orDebug
Debug
: Will only be logged is environment logging type isDebug
- Parameters:
message
- - message to logtype
- - logging typetimestamp
- - 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 theLoggingType
isErrors.
- Parameters:
ex
-
-
handleException
Handles an exception, based on the specifiedLoggingType
.- Parameters:
ex
-type
- The type of exception, determines how it will be displayed based on the current environment setting
-
getClipboard
Returns the clipboard for the current session. This can be used for simple copy/paste procedures.- Returns:
-