Package xtwm.plugins

Class PluginWidget

    • Field Detail

      • app

        protected XTWMApplication app
        The XTWMApplication using this plugin.
      • pluginEnabled

        protected boolean pluginEnabled
        If true, this plugin will be enabled.
      • loadOnStartup

        protected boolean loadOnStartup
        If true, this plugin will load on startup.
    • Constructor Detail

      • PluginWidget

        protected PluginWidget​(TWidget parent)
        Constructor for subclasses.
        Parameters:
        parent - parent widget
    • Method Detail

      • onMenu

        public void onMenu​(TMenuEvent event)
        Process menu events.
        Overrides:
        onMenu in class TWidget
        Parameters:
        event - menu event
      • getMenuMnemonic

        public abstract java.lang.String getMenuMnemonic()
        Get the translated menu label for this plugin.
        Returns:
        a mnemonic string that will be populated in the menu
      • getPluginName

        public abstract java.lang.String getPluginName()
        Get the translated short name for this plugin.
        Returns:
        a short name, e.g. "Calendar"
      • getPluginDescription

        public abstract java.lang.String getPluginDescription()
        Get the translated full description for this plugin.
        Returns:
        a short name, e.g. "A simple calendar."
      • isApplication

        public abstract boolean isApplication()
        See if this is an "Application" plugin.
        Returns:
        true if this plugin should be listed the Application | Programs menu
      • getApplicationCommand

        public abstract java.lang.String getApplicationCommand()
        Get the command line to execute if this is an "Application" plugin.
        Returns:
        a command line
      • isWidget

        public abstract boolean isWidget()
        See if this is a "Widget" plugin.
        Returns:
        true if this plugin should be available in the Application | Widgets meny and the Panel | "Switch to" dialog
      • getWindowTitle

        public abstract java.lang.String getWindowTitle()
        Get the translated window title for this plugin.
        Returns:
        the title for the window when this widget is opened in the Application | Widgets menu, or null if this widget should have no title for its window.
      • isPluginEnabled

        public boolean isPluginEnabled()
        See if this plugin is enabled.
        Returns:
        true if this plugin should be enabled
      • setPluginEnabled

        public void setPluginEnabled​(boolean pluginEnabled)
        Set plugin enabled.
        Parameters:
        pluginEnabled - if true, this plugin will be enabled
      • isLoadOnStartup

        public boolean isLoadOnStartup()
        See if this plugin will load on startup.
        Returns:
        true if this plugin will load on startup
      • setLoadOnStartup

        public void setLoadOnStartup​(boolean loadOnStartup)
        Set plugin load on startup.
        Parameters:
        loadOnStartup - if true, this plugin will load on startup
      • isOnAllDesktops

        public boolean isOnAllDesktops()
        Whether or not this plugin should be on all desktops when loaded as a widget at startup.
        Returns:
        true if this plugin should be on all desktops
      • initialize

        public void initialize​(XTWMApplication app)
        Initialize the plugin. Since plugins are required to have a no-argument constructor, this method is called to provide a hook for the plugin to perform initialization. Subclasses that override initialize should call super.initialize() to set the XTWMApplication reference.
        Parameters:
        app - the application that will be using this plugin
      • getPluginSettingsEditor

        public TWidget getPluginSettingsEditor​(TWidget parent)
        Get an interface for editing the plugin settings.
        Parameters:
        parent - parent widget
        Returns:
        a widget that has settings
      • getPreferredWidth

        public abstract int getPreferredWidth()
        Get the desired width when rendering this plugin.
        Returns:
        the width
      • getPreferredHeight

        public abstract int getPreferredHeight()
        Get the desired height when rendering this plugin.
        Returns:
        the height
      • isResizable

        public boolean isResizable()
        Check if widget should be in a resizable window.
        Returns:
        true if the widget should be resizable when in a window
      • getWindow

        public TWindow getWindow​(XTWMApplication application)
        Get the window that will be used for this plugin when isWindowed() is true. The plugin will be reparented inside this window.
        Parameters:
        application - the application
        Returns:
        the window
      • isWindowed

        protected boolean isWindowed()
        Check if this widget is in a window.
        Returns:
        true if the widget is in a window
      • getOption

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

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

        protected void setOption​(java.lang.String key,
                                 java.lang.String value)
        Set an option value for this plugin.
        Parameters:
        key - name of the option
        value - the new the option value
      • makeDataFile

        protected java.io.File makeDataFile​(java.lang.String pathname)
        Obtain a File relative to the plugin data directory. Note that there is a single plugin data directory for all plugins.
        Parameters:
        pathname - a pathname string
        Returns:
        a File instance
      • closeFromMenu

        public void closeFromMenu()
        Called when the user selects Terminal | Close from the menu. The default implementation behaves like a TiledTerminal close.