Package xtwm.ui

Class XTWMApplication

  • All Implemented Interfaces:
    java.lang.Runnable

    public class XTWMApplication
    extends TApplication
    The main Xterm Window Manager application.
    • Field Detail

      • MENU_TERMINAL_HORIZONTAL_SPLIT

        public static final int MENU_TERMINAL_HORIZONTAL_SPLIT
        Terminal | Horizontal split menu item.
        See Also:
        Constant Field Values
      • MENU_TERMINAL_VERTICAL_SPLIT

        public static final int MENU_TERMINAL_VERTICAL_SPLIT
        Terminal | Vertical split menu item.
        See Also:
        Constant Field Values
      • MENU_TERMINAL_CLOSE

        public static final int MENU_TERMINAL_CLOSE
        Terminal | Close menu item.
        See Also:
        Constant Field Values
    • Constructor Detail

      • XTWMApplication

        public XTWMApplication​(TApplication.BackendType backendType)
                        throws java.lang.Exception
        Public constructor.
        Parameters:
        backendType - one of the TApplication.BackendType values
        Throws:
        java.lang.Exception - if TApplication can't instantiate the Backend.
      • XTWMApplication

        public XTWMApplication​(TApplication.BackendType backendType,
                               int minimumWidth,
                               int minimumHeight,
                               int fontSize)
                        throws java.lang.Exception
        Public constructor.
        Parameters:
        backendType - one of the TApplication.BackendType values
        minimumWidth - minimum width of window
        minimumHeight - minimum height of window
        fontSize - the size in points
        Throws:
        java.lang.Exception - if TApplication can't instantiate the Backend.
      • XTWMApplication

        public XTWMApplication​(Backend backend)
        Public constructor.
        Parameters:
        backend - a Backend that is already ready to go.
    • Method Detail

      • onPreDraw

        protected void onPreDraw()
        Function called immediately before the screen is drawn. This can be used by subclasses of TApplication to update things, for example to set menuTrayText.
        Overrides:
        onPreDraw in class TApplication
      • onPostDraw

        protected void onPostDraw()
        Function called immediately after the screen is drawn, while the screen is still synchronized/locked. This can be used by subclasses of TApplication to alter the final post-rendered screen before it goes out -- or even replace the entire thing such as a screensaver.
        Overrides:
        onPostDraw in class TApplication
      • onExit

        public void onExit()
        Subclasses can use this hook to cleanup resources. Called as the last step of TApplication.run().
        Overrides:
        onExit in class TApplication
      • onKeypress

        protected boolean onKeypress​(TKeypressEvent keypress)
        Method that TApplication subclasses can override to handle keystrokes.
        Overrides:
        onKeypress in class TApplication
        Parameters:
        keypress - keystroke event
        Returns:
        if true, this event was consumed
      • onMenu

        public boolean onMenu​(TMenuEvent menu)
        Handle menu events.
        Overrides:
        onMenu in class TApplication
        Parameters:
        menu - menu event
        Returns:
        if true, the event was processed and should not be passed onto a window
      • onCommand

        protected boolean onCommand​(TCommandEvent command)
        Method that TApplication subclasses can override to handle menu or posted command events.
        Overrides:
        onCommand in class TApplication
        Parameters:
        command - command event
        Returns:
        if true, this event was consumed
      • getOption

        public java.lang.String getOption​(java.lang.String key)
        Get an option value.
        Parameters:
        key - name of the option
        Returns:
        the option value, or null if it is undefined
      • getOption

        public java.lang.String getOption​(java.lang.String key,
                                          java.lang.String defaultValue)
        Get an option value.
        Parameters:
        key - name of the option
        defaultValue - the value to return if the option is not defined
        Returns:
        the option value, or defaultValue
      • setOption

        public void setOption​(java.lang.String key,
                              java.lang.String value)
        Set an option value.
        Parameters:
        key - name of the option
        value - the new the option value
      • addDesktop

        public void addDesktop()
        Add one desktop to the end of the list.
      • removeDesktop

        public void removeDesktop()
        Remove the last desktop.
      • getCurrentDesktop

        public VirtualDesktop getCurrentDesktop()
        Get the current desktop.
        Returns:
        the virtual desktop, or null if no virtual desktops are defined
      • switchToNextDesktop

        public void switchToNextDesktop()
        Switch to the next desktop.
      • switchToPreviousDesktop

        public void switchToPreviousDesktop()
        Switch to the previous desktop.
      • getDesktops

        public java.util.List<VirtualDesktop> getDesktops()
        Obtain the desktops.
        Returns:
        the list of desktops
      • putOnAllDesktops

        public void putOnAllDesktops​(TWindow window)
        Put a window on all desktops.
        Parameters:
        window - the window
      • loadPluginProperties

        public void loadPluginProperties​(java.lang.String pluginName)
        Load the properties for a plugin.
        Parameters:
        pluginName - name of the plugin
      • savePluginProperties

        public void savePluginProperties​(PluginWidget plugin)
        Save the properties for a plugin.
        Parameters:
        plugin - an instance of the plugin
      • getPluginOption

        public java.lang.String getPluginOption​(java.lang.String pluginName,
                                                java.lang.String key)
        Get a plugin option value.
        Parameters:
        pluginName - name of the plugin
        key - name of the option
        Returns:
        the option value, or null if it is undefined
      • getPluginOption

        public java.lang.String getPluginOption​(java.lang.String pluginName,
                                                java.lang.String key,
                                                java.lang.String defaultValue)
        Get a plugin option value.
        Parameters:
        pluginName - name of the plugin
        key - name of the option
        defaultValue - the value to return if the option is not defined
        Returns:
        the option value, or defaultValue
      • setPluginOption

        public void setPluginOption​(java.lang.String pluginName,
                                    java.lang.String key,
                                    java.lang.String value)
        Set a plugin option value.
        Parameters:
        pluginName - name of the plugin
        key - name of the option
        value - the new the option value
      • getPluginDataDir

        public java.io.File getPluginDataDir()
        Get the directory that plugins are expected to read and write from.
        Returns:
        the plugin data directory, or null if it is not available
      • getScreensavers

        public java.util.List<ScreensaverPlugin> getScreensavers()
        Get the list of available system screensavers.
        Returns:
        a list containing screensaver instances
      • getSystemScreensaver

        public ScreensaverPlugin getSystemScreensaver()
        Get the currently selected system screensaver.
        Returns:
        an instance of the system screensaver, or null if not set
      • getWidgets

        public java.util.List<PluginWidget> getWidgets()
        Get the list of available widgets.
        Returns:
        a list containing widget instances
      • openEditor

        public TWindow openEditor​(java.lang.String filename)
                           throws java.io.IOException
        Convenience function to open a file in an editor window and make it active.
        Parameters:
        filename - the file to open, or null for a new file
        Returns:
        the editor window opened, either an ExternalEditorWindow or an InternalEditorWindow, or null if filename exists and is not a file
        Throws:
        java.io.IOException - if a java.io operation throws
      • openInternalEditor

        public InternalEditorWindow openInternalEditor​(java.lang.String filename)
                                                throws java.io.IOException
        Convenience function to open a file in an internal editor window and make it active.
        Parameters:
        filename - the file to open, or null for a new file
        Returns:
        the editor window, or null if filename exists and is not a file
        Throws:
        java.io.IOException - if a java.io operation throws