Package xtwm.plugins
Class ScreensaverPlugin
- java.lang.Object
-
- jexer.TWidget
-
- xtwm.plugins.PluginWidget
-
- xtwm.plugins.ScreensaverPlugin
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
- Direct Known Subclasses:
BlackHoleScreensaver
,BlankScreensaver
,BouncingTextScreensaver
,RainScreensaver
public abstract class ScreensaverPlugin extends PluginWidget
ScreensaverPlugin is a plugin whose draw() method can be used as the system screensaver. It can also be instantiated in a separate window or as part of a tiled panel.
-
-
Field Summary
Fields Modifier and Type Field Description protected TField
passwordField
The password field.protected TPanel
passwordPanel
The password panel.protected boolean
unlocked
If true, the user entered the password, or there is no password.-
Fields inherited from class xtwm.plugins.PluginWidget
app, loadOnStartup, pluginEnabled
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ScreensaverPlugin(TWidget parent)
Constructor for subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
checkPassword()
Called to flag the screensaver to ask for a password.abstract void
endScreensaver()
This method is called when the screensaver ends.int
getPreferredHeight()
Get the desired height when rendering this plugin.int
getPreferredWidth()
Get the desired width when rendering this plugin.TWindow
getWindow(XTWMApplication application)
Get the window that will be used for this plugin when isWindowed() is true.boolean
isLoadOnStartup()
See if this plugin will load on startup.boolean
isOnAllDesktops()
Whether or not this plugin should be on all desktops when loaded as a widget at startup.boolean
isResizable()
Check if widget should be in a resizable window.boolean
isUnlocked()
Called to see if the password was entered OK.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
setLoadOnStartup(boolean loadOnStartup)
Set plugin load on startup.abstract void
startScreensaver(Screen screen)
This method is called when the screensaver is activated.-
Methods inherited from class xtwm.plugins.PluginWidget
closeFromMenu, getApplicationCommand, getMenuMnemonic, getOption, getOption, getPluginDescription, getPluginName, getPluginSettingsEditor, getWindowTitle, initialize, isApplication, isPluginEnabled, isWidget, isWindowed, makeDataFile, onMenu, setOption, setPluginEnabled
-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, draw, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getScreen, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMouseDoubleClick, onMouseDown, onMouseMotion, onMouseUp, onResize, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Constructor Detail
-
ScreensaverPlugin
protected ScreensaverPlugin(TWidget parent)
Constructor for subclasses.- Parameters:
parent
- parent widget
-
-
Method Detail
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWidget
- Parameters:
keypress
- keystroke event
-
isLoadOnStartup
public final boolean isLoadOnStartup()
See if this plugin will load on startup.- Overrides:
isLoadOnStartup
in classPluginWidget
- Returns:
- true if this plugin will load on startup
-
setLoadOnStartup
public final void setLoadOnStartup(boolean loadOnStartup)
Set plugin load on startup.- Overrides:
setLoadOnStartup
in classPluginWidget
- Parameters:
loadOnStartup
- if true, this plugin will load on startup
-
isOnAllDesktops
public final boolean isOnAllDesktops()
Whether or not this plugin should be on all desktops when loaded as a widget at startup.- Overrides:
isOnAllDesktops
in classPluginWidget
- Returns:
- true if this plugin should be on all desktops
-
getPreferredWidth
public int getPreferredWidth()
Get the desired width when rendering this plugin.- Specified by:
getPreferredWidth
in classPluginWidget
- Returns:
- the width
-
getPreferredHeight
public int getPreferredHeight()
Get the desired height when rendering this plugin.- Specified by:
getPreferredHeight
in classPluginWidget
- Returns:
- the height
-
isResizable
public boolean isResizable()
Check if widget should be in a resizable window.- Overrides:
isResizable
in classPluginWidget
- 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.- Overrides:
getWindow
in classPluginWidget
- Parameters:
application
- the application- Returns:
- the window
-
startScreensaver
public abstract void startScreensaver(Screen screen)
This method is called when the screensaver is activated.- Parameters:
screen
- a snapshot of the screen "under" the screensaver.
-
endScreensaver
public abstract void endScreensaver()
This method is called when the screensaver ends.
-
checkPassword
public void checkPassword()
Called to flag the screensaver to ask for a password.
-
isUnlocked
public boolean isUnlocked()
Called to see if the password was entered OK.- Returns:
- true if the user entered the password successfully
-
-