Package xtwm.ui
Class XTWMApplication
- java.lang.Object
-
- jexer.TApplication
-
- xtwm.ui.XTWMApplication
-
- All Implemented Interfaces:
java.lang.Runnable
public class XTWMApplication extends TApplication
The main Xterm Window Manager application.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jexer.TApplication
TApplication.BackendType
-
-
Field Summary
Fields Modifier and Type Field Description static int
MENU_TERMINAL_CLOSE
Terminal | Close menu item.static int
MENU_TERMINAL_HORIZONTAL_SPLIT
Terminal | Horizontal split menu item.static int
MENU_TERMINAL_VERTICAL_SPLIT
Terminal | Vertical split menu item.static java.lang.String
VERSION
Release version.-
Fields inherited from class jexer.TApplication
desktopCanHaveCursor, helpFile, helpTopics, imageSupportTest, lastUserInputTime, menuTrayText, smartWindowPlacement, textMouse
-
-
Constructor Summary
Constructors Constructor Description XTWMApplication(Backend backend)
Public constructor.XTWMApplication(TApplication.BackendType backendType)
Public constructor.XTWMApplication(TApplication.BackendType backendType, int minimumWidth, int minimumHeight, int fontSize)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDesktop()
Add one desktop to the end of the list.VirtualDesktop
getCurrentDesktop()
Get the current desktop.java.util.List<VirtualDesktop>
getDesktops()
Obtain the desktops.java.lang.String
getOption(java.lang.String key)
Get an option value.java.lang.String
getOption(java.lang.String key, java.lang.String defaultValue)
Get an option value.java.io.File
getPluginDataDir()
Get the directory that plugins are expected to read and write from.java.lang.String
getPluginOption(java.lang.String pluginName, java.lang.String key)
Get a plugin option value.java.lang.String
getPluginOption(java.lang.String pluginName, java.lang.String key, java.lang.String defaultValue)
Get a plugin option value.java.util.List<ScreensaverPlugin>
getScreensavers()
Get the list of available system screensavers.ScreensaverPlugin
getSystemScreensaver()
Get the currently selected system screensaver.java.util.List<PluginWidget>
getWidgets()
Get the list of available widgets.void
loadPluginProperties(java.lang.String pluginName)
Load the properties for a plugin.protected boolean
onCommand(TCommandEvent command)
Method that TApplication subclasses can override to handle menu or posted command events.void
onExit()
Subclasses can use this hook to cleanup resources.protected boolean
onKeypress(TKeypressEvent keypress)
Method that TApplication subclasses can override to handle keystrokes.boolean
onMenu(TMenuEvent menu)
Handle menu events.protected void
onPostDraw()
Function called immediately after the screen is drawn, while the screen is still synchronized/locked.protected void
onPreDraw()
Function called immediately before the screen is drawn.TWindow
openEditor(java.lang.String filename)
Convenience function to open a file in an editor window and make it active.InternalEditorWindow
openInternalEditor(java.lang.String filename)
Convenience function to open a file in an internal editor window and make it active.void
putOnAllDesktops(TWindow window)
Put a window on all desktops.void
removeDesktop()
Remove the last desktop.void
savePluginProperties(PluginWidget plugin)
Save the properties for a plugin.void
setOption(java.lang.String key, java.lang.String value)
Set an option value.void
setPluginOption(java.lang.String pluginName, java.lang.String key, java.lang.String value)
Set a plugin option value.protected void
showAboutDialog()
Display the about dialog.void
switchToNextDesktop()
Switch to the next desktop.void
switchToPreviousDesktop()
Switch to the previous desktop.-
Methods inherited from class jexer.TApplication
activateWindow, addEditMenu, addFileMenu, addHelpMenu, addMenu, addMenu, addMenuItem, addSubMenu, addTableMenu, addTimer, addToolMenu, addWindow, addWindow, addWindow, addWindow, addWindowMenu, closeMenu, closeSubMenu, closeWindow, disableMenuItem, disableMenuItems, doRepaint, doSmartPlacement, enableMenuItem, enableMenuItems, enableSecondaryEventReceiver, exit, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getActiveWindow, getAllMenus, getAllWindows, getBackend, getClipboard, getDesktop, getDesktopBottom, getDesktopTop, getFocusFollowsMouse, getMenuItem, getScreen, getTheme, hasWindow, hiddenWindowCount, hideWindow, inputBox, inputBox, inputBox, invokeLater, isModalThreadRunning, isRunning, messageBox, messageBox, openContextMenu, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, openTerminal, postEvent, postMenuEvent, recomputeMenuX, removeMenu, removeTimer, restoreConsole, run, setDesktop, setDesktop, setFocusFollowsMouse, setHideMenuBar, setHideStatusBar, shownWindowCount, showWindow, switchMenu, switchWindow, windowCount, yield
-
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
Release version.- See Also:
- Constant Field Values
-
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 valuesminimumWidth
- minimum width of windowminimumHeight
- minimum height of windowfontSize
- 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 classTApplication
-
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 classTApplication
-
onExit
public void onExit()
Subclasses can use this hook to cleanup resources. Called as the last step of TApplication.run().- Overrides:
onExit
in classTApplication
-
onKeypress
protected boolean onKeypress(TKeypressEvent keypress)
Method that TApplication subclasses can override to handle keystrokes.- Overrides:
onKeypress
in classTApplication
- Parameters:
keypress
- keystroke event- Returns:
- if true, this event was consumed
-
onMenu
public boolean onMenu(TMenuEvent menu)
Handle menu events.- Overrides:
onMenu
in classTApplication
- 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 classTApplication
- Parameters:
command
- command event- Returns:
- if true, this event was consumed
-
showAboutDialog
protected void showAboutDialog()
Display the about dialog.- Overrides:
showAboutDialog
in classTApplication
-
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 optiondefaultValue
- 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 optionvalue
- 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 pluginkey
- 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 pluginkey
- name of the optiondefaultValue
- 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 pluginkey
- name of the optionvalue
- 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
-
-