org.springframework.richclient.command.config
Class CommandButtonIconInfo

java.lang.Object
  extended by org.springframework.richclient.command.config.CommandButtonIconInfo
All Implemented Interfaces:
VisualizedElement, ButtonConfigurer

public class CommandButtonIconInfo
extends Object
implements ButtonConfigurer, VisualizedElement

A parameter object consisting of the various icons that may be displayed on a single command button depending on its state.

The set of states for which this object maintains icons are as follows:

Author:
Keith Donald

Field Summary
static CommandButtonIconInfo BLANK_ICON_INFO
          A CommandButtonIconInfo instance that can be used for command buttons that have no icon information associated with them.
 
Constructor Summary
CommandButtonIconInfo(Icon icon)
          Creates a new CommandButtonIconInfo with the given icon.
CommandButtonIconInfo(Icon icon, Icon selectedIcon)
          Creates a new CommandButtonIconInfo with the given icons.
CommandButtonIconInfo(Icon icon, Icon selectedIcon, Icon rolloverIcon)
          Creates a new CommandButtonIconInfo with the given icons.
CommandButtonIconInfo(Icon icon, Icon selectedIcon, Icon rolloverIcon, Icon disabledIcon, Icon pressedIcon)
          Creates a new CommandButtonIconInfo with the given icons.
 
Method Summary
 AbstractButton configure(AbstractButton button)
          Configures the given command button with the icon values from this instance.
 boolean equals(Object o)
          
 Icon getDisabledIcon()
          Returns the icon to be displayed when the command button is in a disabled state.
 Icon getIcon()
          Returns the icon associated with the application component, or null.
 Image getImage()
          Returns the image from the main default icon of this instance if it is actually an instance of an ImageIcon.
 Icon getPressedIcon()
          Returns the icon to be displayed when the command button is in a pressed state.
 Icon getRolloverIcon()
          Returns the icon to be displayed when the mouse pointer rolls over the command button.
 Icon getSelectedIcon()
          Returns the icon to be displayed when the command button is in a selected state.
 int hashCode()
          
 void setDisabledIcon(Icon disabledIcon)
          Sets the icon to be displayed when the command button is in a disabled state.
 void setIcon(Icon icon)
          Sets the main default icon for the command button.
 void setPressedIcon(Icon pressedIcon)
          Sets the icon to be displayed when the command button is in a pressed state.
 void setRolloverIcon(Icon rolloverIcon)
          Sets the icon to be displayed when the mouse pointer rolls over the command button.
 void setSelectedIcon(Icon selectedIcon)
          Sets the icon to be displayed when the command button is in a pressed state.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BLANK_ICON_INFO

public static final CommandButtonIconInfo BLANK_ICON_INFO
A CommandButtonIconInfo instance that can be used for command buttons that have no icon information associated with them.

Constructor Detail

CommandButtonIconInfo

public CommandButtonIconInfo(Icon icon)
Creates a new CommandButtonIconInfo with the given icon. No optional icons will be associated with this instance.

Parameters:
icon - The main displayable icon.

CommandButtonIconInfo

public CommandButtonIconInfo(Icon icon,
                             Icon selectedIcon)
Creates a new CommandButtonIconInfo with the given icons.

Parameters:
icon - The main default icon. May be null.
selectedIcon - The icon to be displayed when the command button is in a selected state. May be null.

CommandButtonIconInfo

public CommandButtonIconInfo(Icon icon,
                             Icon selectedIcon,
                             Icon rolloverIcon)
Creates a new CommandButtonIconInfo with the given icons.

Parameters:
icon - The main default icon. May be null.
selectedIcon - The icon to be displayed when the command button is in a selected state.
rolloverIcon - The icon to be displayed when the mouse pointer rolls over the command button. May be null.

CommandButtonIconInfo

public CommandButtonIconInfo(Icon icon,
                             Icon selectedIcon,
                             Icon rolloverIcon,
                             Icon disabledIcon,
                             Icon pressedIcon)
Creates a new CommandButtonIconInfo with the given icons.

Parameters:
icon - The main default icon. May be null.
selectedIcon - The icon to be displayed when the command button is in a selected state.
rolloverIcon - The icon to be displayed when the mouse pointer rolls over the command button. May be null.
disabledIcon - The icon to be displayed when the command button is in a disabled state. May be null.
pressedIcon - The icon to be displayed when the command button is in a pressed state. May be null.
Method Detail

configure

public AbstractButton configure(AbstractButton button)
Configures the given command button with the icon values from this instance.

Specified by:
configure in interface ButtonConfigurer
Parameters:
button - The button to be configured with icons. Must not be null.
Returns:
the configured button.
Throws:
IllegalArgumentException - if button is null.

getImage

public Image getImage()
Returns the image from the main default icon of this instance if it is actually an instance of an ImageIcon.

Specified by:
getImage in interface VisualizedElement
Returns:
The image from the main default icon, or null if there is no default icon or it is not an ImageIcon.

getIcon

public Icon getIcon()
Returns the icon associated with the application component, or null.

Specified by:
getIcon in interface VisualizedElement

getDisabledIcon

public Icon getDisabledIcon()
Returns the icon to be displayed when the command button is in a disabled state.

Returns:
The icon for the command button in disabled state, or null.

getPressedIcon

public Icon getPressedIcon()
Returns the icon to be displayed when the command button is in a pressed state.

Returns:
The icon for the command button in pressed state, or null.

getRolloverIcon

public Icon getRolloverIcon()
Returns the icon to be displayed when the mouse pointer rolls over the command button.

Returns:
The icon for the command button when rolled over by the mouse pointer, or null.

getSelectedIcon

public Icon getSelectedIcon()
Returns the icon to be displayed when the command button is in a selected state.

Returns:
The icon for the command button in selected state, or null.

setIcon

public void setIcon(Icon icon)
Sets the main default icon for the command button.

Parameters:
icon - The main default icon for the command button. May be null.

setDisabledIcon

public void setDisabledIcon(Icon disabledIcon)
Sets the icon to be displayed when the command button is in a disabled state.

Parameters:
disabledIcon - The icon for the button in a disabled state. May be null.

setPressedIcon

public void setPressedIcon(Icon pressedIcon)
Sets the icon to be displayed when the command button is in a pressed state.

Parameters:
pressedIcon - The icon for the button in a pressed state. May be null.

setRolloverIcon

public void setRolloverIcon(Icon rolloverIcon)
Sets the icon to be displayed when the mouse pointer rolls over the command button.

Parameters:
rolloverIcon - The icon for the button in a rolled over. May be null.

setSelectedIcon

public void setSelectedIcon(Icon selectedIcon)
Sets the icon to be displayed when the command button is in a pressed state.

Parameters:
selectedIcon - The icon for the button in a pressed state. May be null.

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.