Class Main

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.db.DatabaseConnectionHandler, adams.db.DatabaseConnectionProvider, adams.db.DatabaseConnectionUser, adams.event.DatabaseConnectionChangeListener, adams.scripting.RemoteScriptingEngineHandler, Serializable

    public class Main
    extends AbstractLanternaTerminalApplication
    Main ADAMS application - terminal-based.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Main.LogHandler
      The log handler for the application.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.googlecode.lanterna.gui2.Button m_ButtonClear
      the button for clearing the log.
      protected com.googlecode.lanterna.gui2.Panel m_MenuBar
      the menu bar.
      protected com.googlecode.lanterna.gui2.Panel m_PanelMain
      the main panel.
      protected LogTextBox m_TextBoxLog
      the textbox for the logging.
      • Fields inherited from class adams.terminal.application.AbstractTerminalApplication

        m_ApplicationTitle, m_DbConn, m_RemoteScriptingEngine, m_RemoteScriptingEngineCmdLine, m_RemoteScriptingEngineUpdateListeners
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      Main()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendLog​(String msg)
      Appends the log message.
      protected Handler createLogHandler()
      Returns the log handler to use.
      protected String getDefaultApplicationTitle()
      Returns the default title of the application.
      protected adams.db.AbstractDatabaseConnection getDefaultDatabaseConnection()
      Returns the default database connection.
      LogTextBox getLogTextBox()
      Returns the textbox to be used for logging.
      String globalInfo()
      Returns a string describing the object.
      protected void initTerminal()
      Initializes the terminal.
      static void main​(String[] args)
      Starts the terminal application from commandline.
      protected void setTitle​(String value)
      Sets the title to use.
      • Methods inherited from class adams.terminal.application.AbstractTerminalApplication

        addRemoteScriptingEngine, addRemoteScriptingEngineUpdateListener, applicationTitleTipText, createTitle, databaseConnectionStateChanged, defineOptions, forCommandLine, forName, getApplicationTitle, getDatabaseConnection, getRemoteScriptingEngine, getRemoteScriptingEngineCmdLine, notifyRemoteScriptingEngineUpdateListeners, remoteScriptingEngineCmdLineTipText, removeRemoteScriptingEngine, removeRemoteScriptingEngineUpdateListener, runApplication, setApplicationTitle, setDatabaseConnection, setLoggingLevel, setRemoteScriptingEngine, setRemoteScriptingEngineCmdLine
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_PanelMain

        protected com.googlecode.lanterna.gui2.Panel m_PanelMain
        the main panel.
      • m_MenuBar

        protected com.googlecode.lanterna.gui2.Panel m_MenuBar
        the menu bar.
      • m_TextBoxLog

        protected LogTextBox m_TextBoxLog
        the textbox for the logging.
      • m_ButtonClear

        protected com.googlecode.lanterna.gui2.Button m_ButtonClear
        the button for clearing the log.
    • Constructor Detail

      • Main

        public Main()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • getDefaultApplicationTitle

        protected String getDefaultApplicationTitle()
        Returns the default title of the application.
        Specified by:
        getDefaultApplicationTitle in class adams.terminal.application.AbstractTerminalApplication
        Returns:
        the default title
      • setTitle

        protected void setTitle​(String value)
        Sets the title to use.
        Specified by:
        setTitle in class adams.terminal.application.AbstractTerminalApplication
        Parameters:
        value - the title
      • getDefaultDatabaseConnection

        protected adams.db.AbstractDatabaseConnection getDefaultDatabaseConnection()
        Returns the default database connection.
        Specified by:
        getDefaultDatabaseConnection in class adams.terminal.application.AbstractTerminalApplication
        Returns:
        the default database connection
      • createLogHandler

        protected Handler createLogHandler()
        Returns the log handler to use.
        Specified by:
        createLogHandler in class adams.terminal.application.AbstractTerminalApplication
        Returns:
        the handler
      • appendLog

        public void appendLog​(String msg)
        Appends the log message.
        Parameters:
        msg - the log message
      • main

        public static void main​(String[] args)
                         throws Exception
        Starts the terminal application from commandline.
        Parameters:
        args - the arguments
        Throws:
        Exception - if start up fails