org.jurvis.swing.actions
Class JvViewAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jurvis.swing.actions.JvViewAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, JvToggleAction

public class JvViewAction
extends AbstractAction
implements JvToggleAction

An Action for toggling the visibility of a Component.

Author:
Neil W. Weber
See Also:
Serialized Form

Nested Class Summary
protected  class JvViewAction.LocalItemListener
           
protected  class JvViewAction.LocalPropertyChangeListener
           
 
Field Summary
protected  ButtonModel buttonModel
          The button model tracking the component's visibility.
protected  Component component
          The controlled component.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
JvViewAction(String name, Component component)
          Create a JvViewAction with the given name that controls the visibility of the given component.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 ButtonModel getButtonModel()
           
 boolean isVisible()
          Return the visibility of the controlled component.
 void setVisible(boolean visible)
          Set the visibility of the controlled component.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.Action
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 

Field Detail

component

protected final Component component
The controlled component.


buttonModel

protected final ButtonModel buttonModel
The button model tracking the component's visibility.

Constructor Detail

JvViewAction

public JvViewAction(String name,
                    Component component)
Create a JvViewAction with the given name that controls the visibility of the given component.

Parameters:
name - the name of the action
component - the controlled component
Method Detail

setVisible

public void setVisible(boolean visible)
Set the visibility of the controlled component.

Parameters:
visible - the new visibility setting

isVisible

public boolean isVisible()
Return the visibility of the controlled component.

Returns:
true if the component is visible; false otherwise

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

getButtonModel

public ButtonModel getButtonModel()
Specified by:
getButtonModel in interface JvToggleAction
Returns:
a ButtonModel useful for checking the toggle state of this action.


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.