com.quadrique.jbuildingblocks.gui
Class ActionBaseToggle

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.quadrique.jbuildingblocks.gui.ActionBase
          extended by com.quadrique.jbuildingblocks.gui.ActionBaseToggle
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public abstract class ActionBaseToggle
extends ActionBase

This is the base class for an action that can be toggled on and off The main additional functionality compared to ActionBase is that the action icon is either a checked rectangle when the action is "on" (e.g. a window is displayed, debug mode is active...) or an empty rectangle when it is "off".

Author:
Hervé Rivere
See Also:
AbstractAction, Action, Serialized Form

Field Summary
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ActionBaseToggle(String zActionName, String zTooltipText, boolean zIsChecked)
          constructor
 
Method Summary
 boolean isChecked()
           
 void setIsChecked(boolean zIsChecked)
          Set the current status and update accordingly the icon
 void toggleStatus()
          to switch from "checked" to "unchecked" and vice -versa
 
Methods inherited from class com.quadrique.jbuildingblocks.gui.ActionBase
getAccelerator, getIcon, getMnemonic, getName, getTooltipText, setAccelerator, setIcon, setMnemonic, toString, updateAction
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Constructor Detail

ActionBaseToggle

public ActionBaseToggle(String zActionName,
                        String zTooltipText,
                        boolean zIsChecked)
                 throws Exception
constructor

Parameters:
zActionName - the name of the action
zTooltipText - the tooltip text to use for this action
zIsChecked - true if the intial state of the action is "checked", false otherwise
Throws:
Exception - if an error occurs
See Also:
Resources
Method Detail

isChecked

public boolean isChecked()
Returns:
true if the current status is "checked", false otherwise

setIsChecked

public void setIsChecked(boolean zIsChecked)
Set the current status and update accordingly the icon

Parameters:
zIsChecked - true if the checked icon is to be used, false otherwise

toggleStatus

public void toggleStatus()
to switch from "checked" to "unchecked" and vice -versa



Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.