Class AbstractApplicationFrame

    • Field Detail

      • m_Children

        protected HashSet<Child> m_Children
        contains the child frames/windows (title <-> object).
      • m_MenuWindows

        protected JMenu m_MenuWindows
        the "windows" menu.
      • m_ScriptingLogPanel

        protected ScriptingLogPanel m_ScriptingLogPanel
        the scripting log panel.
      • m_ApplicationTitle

        protected String m_ApplicationTitle
        the title of the application.
      • m_LoggingLevel

        protected LoggingLevel m_LoggingLevel
        the logging level.
      • m_UserMode

        protected UserMode m_UserMode
        the user mode - determines what menu entries to display.
      • m_MinimalWindow

        protected boolean m_MinimalWindow
        whether to not maximize the main window.
      • m_EnableRestart

        protected boolean m_EnableRestart
        whether the application can be restarted (through Launcher class).
      • m_StartUps

        protected BaseString[] m_StartUps
        the menu items (classnames with further parameters) to start up immediately.
      • m_DocumentationDirectories

        protected PlaceholderDirectory[] m_DocumentationDirectories
        the directories containing PDF documentation.
      • m_AppMenu

        protected ApplicationMenu m_AppMenu
        the application menu in use.
      • m_InitFinished

        protected boolean m_InitFinished
        whether initialization has finished.
      • m_Logger

        protected Logger m_Logger
        the logger to use.
      • m_RemoteScriptingEngineCmdLine

        protected String m_RemoteScriptingEngineCmdLine
        the commandline of the remote scripting engine to use at startup time.
      • m_RemoteScriptingEngine

        protected RemoteScriptingEngine m_RemoteScriptingEngine
        the remote command scripting engine.
    • Constructor Detail

      • AbstractApplicationFrame

        public AbstractApplicationFrame()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BaseFrame
      • initializeLogger

        protected void initializeLogger()
        Initializes the logger.

        Default implementation uses the class name.
        Overrides:
        initializeLogger in class BaseFrame
      • getDefaultDatabaseConnection

        protected abstract AbstractDatabaseConnection getDefaultDatabaseConnection()
        Returns the default database connection.
        Returns:
        the default database connection
      • getDefaultApplicationTitle

        protected abstract String getDefaultApplicationTitle()
        Returns the default title of the application.
        Returns:
        the default title
      • setLoggingLevel

        public void setLoggingLevel​(LoggingLevel value)
        Sets the logging level.
        Parameters:
        value - the level
      • getLoggingLevel

        public LoggingLevel getLoggingLevel()
        Returns the logging level.
        Returns:
        the level
      • loggingLevelTipText

        public String loggingLevelTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getApplicationTitle

        public String getApplicationTitle()
        Returns the currently set application title.
        Returns:
        the current title
      • setApplicationTitle

        public void setApplicationTitle​(String value)
        Sets the application title to use.
        Parameters:
        value - the title to use
      • applicationTitleTipText

        public String applicationTitleTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUserMode

        public void setUserMode​(UserMode value)
        Sets the user mode - determines what menu entries are being displayed.
        Parameters:
        value - the user mode
      • getUserMode

        public UserMode getUserMode()
        Returns the current user mode - determines what menu entries are being displayed.
        Returns:
        the user mode
      • userModeTipText

        public String userModeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setMinimalWindow

        public void setMinimalWindow​(boolean value)
        Sets whether the main window uses minimal size or gets extended to the full width of the screen.
        Parameters:
        value - true if minimal size
      • getMinimalWindow

        public boolean getMinimalWindow()
        Returns whether the main window uses minimal size or gets extended to the full width of the screen.
        Returns:
        true if minimal size
      • minimalWindowTipText

        public String minimalWindowTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getStartUps

        public BaseString[] getStartUps()
        Returns the currently set menu items to immediately start up.
        Returns:
        the menu items (incl. further parameters)
      • setStartUps

        public void setStartUps​(BaseString[] value)
        Sets the menu items to start up immediately.
        Parameters:
        value - the menu items (incl. further parameters)
      • startUpsTipText

        public String startUpsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDocumentationDirectories

        public PlaceholderDirectory[] getDocumentationDirectories()
        Returns the currently set directories with PDF documentation.
        Returns:
        the directories
      • setDocumentationDirectories

        public void setDocumentationDirectories​(PlaceholderDirectory[] value)
        Sets the currently set directories with PDF documentation.
        Parameters:
        value - the menu items (incl. further parameters)
      • documentationDirectoriesTipText

        public String documentationDirectoriesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setEnableRestart

        public void setEnableRestart​(boolean value)
        Sets whether to enable the restart through the Launcher.
        Specified by:
        setEnableRestart in interface RestartableApplication
        Parameters:
        value - true if to enable restart via Launcher class
      • getEnableRestart

        public boolean getEnableRestart()
        Returns whether to enable the restart through the Launcher.
        Specified by:
        getEnableRestart in interface RestartableApplication
        Returns:
        true if restart is enabled
      • enableRestartTipText

        public String enableRestartTipText()
        Returns the tip text for this property.
        Specified by:
        enableRestartTipText in interface RestartableApplication
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setRemoteScriptingEngineCmdLine

        public void setRemoteScriptingEngineCmdLine​(String value)
        Sets the commandline of the remote scripting engine to execute at startup time.
        Parameters:
        value - the commandline, use empty string if not to use one
      • getRemoteScriptingEngineCmdLine

        public String getRemoteScriptingEngineCmdLine()
        Returns the commandline of the remote scripting engine to execute at startup time.
        Returns:
        the commandline, empty string it not to use one
      • remoteScriptingEngineCmdLineTipText

        public String remoteScriptingEngineCmdLineTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • notifyRemoteScriptingEngineUpdateListeners

        public void notifyRemoteScriptingEngineUpdateListeners​(RemoteScriptingEngineUpdateEvent e)
        Notifies all listeners of remote scripting engine changes.
        Parameters:
        e - the event to send
      • setLookAndFeel

        protected void setLookAndFeel()
        Sets the look'n'feel.
      • initGUI

        protected void initGUI()
        initializes the GUI.
        Overrides:
        initGUI in class BaseFrame
      • finishInit

        protected void finishInit()
        finishes the initialization, by setting size/location.
        Overrides:
        finishInit in class BaseFrame
      • createLogHandler

        protected Handler createLogHandler()
        Returns the log handler to use.
        Returns:
        the handler
      • setSizeAndLocation

        protected void setSizeAndLocation()
        Sets the size and location of the main window.
      • closeChildren

        protected void closeChildren()
        Closes all children frames.
      • closeApplication

        protected void closeApplication()
        Closes the application.
      • close

        public void close()
        Closes the application down.
      • getMenuLayoutFile

        protected abstract String getMenuLayoutFile()
        Returns the filename that stores the menu layout.
        Returns:
        the filename
      • getAppMenu

        public ApplicationMenu getAppMenu()
        Returns the menu generator.
        Returns:
        the menu generator
      • createMenuBar

        protected JMenuBar createMenuBar()
        Creates the menu bar.
        Returns:
        the generated menu bar
      • createChildFrame

        protected ChildFrame createChildFrame​(String title,
                                              Component c,
                                              Dimension size,
                                              String icon)
        creates a frame and returns it.
        Parameters:
        title - the title of the frame
        c - the component to place, can be null
        size - the size of the frame, ignored if -1 and -1
        icon - the icon to use, null for default
        Returns:
        the generated frame
      • createChildFrame

        public static ChildFrame createChildFrame​(AbstractApplicationFrame owner,
                                                  String title,
                                                  Component c,
                                                  Dimension size,
                                                  String icon)
        creates a frame and returns it.
        Parameters:
        owner - the owner
        title - the title of the frame
        c - the component to place, can be null
        size - the size of the frame, ignored if -1 and -1
        icon - the icon to use, null for default
        Returns:
        the generated frame
      • insertMenuItem

        protected void insertMenuItem​(JMenu menu,
                                      JMenuItem menuitem)
        insert the menu item in a sorted fashion.
        Parameters:
        menu - the menu to add the item to
        menuitem - the menu item to add
      • insertMenuItem

        protected void insertMenuItem​(JMenu menu,
                                      JMenuItem menuitem,
                                      int startIndex)
        insert the menu item in a sorted fashion.
        Parameters:
        menu - the menu to add the item to
        menuitem - the menu item to add
        startIndex - the index in the menu to start with (0-based)
      • createTitle

        public void createTitle​(String title)
        creates and displays the title.
        Parameters:
        title - the additional part of the title
      • addChildFrame

        public void addChildFrame​(ChildFrame c)
        adds the given child frame to the list of frames.
        Parameters:
        c - the child frame to add
      • removeChildFrame

        public boolean removeChildFrame​(Container c)
        tries to remove the child frame, it returns true if it could do such.
        Parameters:
        c - the child frame to remove
        Returns:
        true if the child frame could be removed
      • showWindow

        public boolean showWindow​(Child c)
        brings child frame to the top.
        Parameters:
        c - the frame to activate
        Returns:
        true if frame was activated
      • showWindow

        public boolean showWindow​(Class windowClass)
        brings the first frame to the top that is of the specified window class.
        Parameters:
        windowClass - the class to display the first child for
        Returns:
        true, if a child was found and brought to front
      • getWindowList

        public Iterator<Child> getWindowList()
        returns all currently open frames.
        Returns:
        an iterator over all currently open frame
      • getWindow

        public Child getWindow​(Class windowClass)
        returns the first instance of the given window class, null if none can be found.
        Parameters:
        windowClass - the class to retrieve the first instance for
        Returns:
        null, if no instance can be found
      • getWindow

        public Child getWindow​(String title)
        returns the first window with the given title, null if none can be found.
        Parameters:
        title - the title to look for
        Returns:
        null, if no instance can be found
      • containsWindow

        public boolean containsWindow​(Class windowClass)
        checks, whether an instance of the given window class is already in the Window list.
        Parameters:
        windowClass - the class to check for an instance in the current window list
        Returns:
        true if the class is already listed in the Window list
      • containsWindow

        public boolean containsWindow​(String title)
        checks, whether a window with the given title is already in the Window list.
        Parameters:
        title - the title to check for in the current window list
        Returns:
        true if a window with the given title is already listed in the Window list
      • minimizeWindows

        public void minimizeWindows()
        minimizes all windows.
      • restoreWindows

        public void restoreWindows()
        restores all windows.
      • windowListChanged

        public void windowListChanged()
        is called when window list changed somehow (add or remove).
      • buildWindowsMenu

        protected void buildWindowsMenu()
        creates the menu of currently open windows.
      • setVisible

        public void setVisible​(boolean b)
        Shows or hides this component depending on the value of parameter b.
        Overrides:
        setVisible in class BaseFrame
        Parameters:
        b - if true, shows this component; otherwise, hides this component
      • startUpMenuItems

        protected void startUpMenuItems()
        Starts up any menu items that were defined.
        See Also:
        m_StartUps
      • getScriptingLogPanel

        public ScriptingLogPanel getScriptingLogPanel()
        Returns the scripting log panel instance.
        Returns:
        the panel
      • getHostnamePrefix

        public static String getHostnamePrefix()
        Returns the hostname prefix for windows.
        Returns:
        the prefix, null if not available
      • insertHostnamePrefix

        public static String insertHostnamePrefix​(String title)
        Injects the hostname, if possible, into the title for the window.
        Parameters:
        title - the title to update
        Returns:
        the updated title
      • runApplication

        public static AbstractApplicationFrame runApplication​(Class env,
                                                              Class app,
                                                              String[] options)
        Runs the application from the commandline.
        Parameters:
        env - the environment class to use
        app - the application frame class
        options - the commandline options
        Returns:
        the instantiated frame, null in case of an error or invocation of help
      • forName

        public static AbstractApplicationFrame forName​(String classname,
                                                       String[] options)
        Instantiates the application frame with the given options.
        Parameters:
        classname - the classname of the application frame to instantiate
        options - the options for the application frame
        Returns:
        the instantiated application frame or null if an error occurred
      • forCommandLine

        public static AbstractApplicationFrame forCommandLine​(String cmdline)
        Instantiates the application frame from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the application frame to instantiate
        Returns:
        the instantiated application frame or null if an error occurred