frysk.gui.monitor
Class TrayIcon

java.lang.Object
  extended by frysk.gui.monitor.TrayIcon
All Implemented Interfaces:
Saveable

public class TrayIcon
extends Object
implements Saveable

TrayIcon is intended as a wrapper class for EggTrayIcon, and provides some useful functionalities such as facilitating popup menus and opening/minimizing windows


Field Summary
static int BUTTON_1
           
static int BUTTON_2
           
static int BUTTON_3
           
static int NO_BUTTON
           
 
Constructor Summary
TrayIcon(String tooltip, boolean active)
          Creates a new TrayIcon
 
Method Summary
 void addPopupWindow(org.gnu.gtk.Window popup)
          Adds a new window to be triggered when the appropriate mouse button is pressed
 void clearPopups()
          Clears the popup windows and the popup menu
 int getMenuButton()
          Returns the button that is currently set to display the popup menu
 int getWindowButton()
          Returns the button that is currently set to display the popup window(s)
 boolean isActive()
           
 void load(Preferences prefs)
           
 void save(Preferences prefs)
           
 void setActive(boolean active, String tooltip)
           
 void setMenuButton(int button)
          Sets the button that can be used to open the popup menu.
 void setPopupMenu(org.gnu.gtk.Menu popup)
          Adds a popup menu to be shown when the user clicks the given mouse button
 void setPopupWindows(List popups)
          Sets the windows to be displayed to be exactly the contents of popups.
 void setWindowButton(int button)
          Sets the button that can be used to open the windows associated with the icon.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_BUTTON

public static int NO_BUTTON

BUTTON_1

public static int BUTTON_1

BUTTON_2

public static int BUTTON_2

BUTTON_3

public static int BUTTON_3
Constructor Detail

TrayIcon

public TrayIcon(String tooltip,
                boolean active)
Creates a new TrayIcon

Parameters:
tooltip - the tooltip to display when you hover over the icon
active - whether the icon should be animated or not
Method Detail

setPopupMenu

public void setPopupMenu(org.gnu.gtk.Menu popup)
Adds a popup menu to be shown when the user clicks the given mouse button

Parameters:
popup - The menu to be shown

addPopupWindow

public void addPopupWindow(org.gnu.gtk.Window popup)
Adds a new window to be triggered when the appropriate mouse button is pressed

Parameters:
popup - The window to be added

setPopupWindows

public void setPopupWindows(List popups)
Sets the windows to be displayed to be exactly the contents of popups. Every element in popups must be of type org.gnu.gtk.Window

Parameters:
popups - The popups to be displayed

setMenuButton

public void setMenuButton(int button)
                   throws IllegalArgumentException
Sets the button that can be used to open the popup menu. If the button is already in use the previous item is cleared to NO_BUTTON

Parameters:
button - The button to trigger the menu
Throws:
IllegalArgumentException - If button is not one of BUTTON_1, BUTTON_2, BUTTON_3, or NO_BUTTON

setWindowButton

public void setWindowButton(int button)
                     throws IllegalArgumentException
Sets the button that can be used to open the windows associated with the icon. If the give button is already in use, the previous action is cleared to NO_BUTTON

Parameters:
button - The button to trigger showing the window
Throws:
IllegalArgumentException - If button is not one of BUTTON_1, BUTTON_2, BUTTON_3, or NO_BUTTON

getWindowButton

public int getWindowButton()
Returns the button that is currently set to display the popup window(s)

Returns:
The assigned button, either NO_BUTTON, BUTTON_1, BUTTON_2, or BUTTON_3

getMenuButton

public int getMenuButton()
Returns the button that is currently set to display the popup menu

Returns:
The assigned button, either NO_BUTTON, BUTTON_1, BUTTON_2, or BUTTON_3

clearPopups

public void clearPopups()
Clears the popup windows and the popup menu


save

public void save(Preferences prefs)
Specified by:
save in interface Saveable

load

public void load(Preferences prefs)
Specified by:
load in interface Saveable

isActive

public boolean isActive()

setActive

public void setActive(boolean active,
                      String tooltip)