org.springframework.richclient.command.config
Class CommandFaceDescriptor

java.lang.Object
  extended by org.springframework.binding.value.support.AbstractPropertyChangePublisher
      extended by org.springframework.richclient.command.config.CommandFaceDescriptor
All Implemented Interfaces:
PropertyChangePublisher, CommandIconConfigurable, CommandLabelConfigurable, DescribedElement, DescriptionConfigurable, VisualizedElement

public class CommandFaceDescriptor
extends AbstractPropertyChangePublisher
implements DescribedElement, VisualizedElement, CommandLabelConfigurable, DescriptionConfigurable, CommandIconConfigurable

A parameter object that contains the information to describe the visual representation of a command object.

Author:
Keith Donald

Field Summary
static String ICON_INFO_PROPERTY
          The property name used when firing events for the iconInfo property.
static String ICON_PROPERTY
          The property name used when firing events for the icon property.
static String LABEL_INFO_PROPERTY
          The property name used when firing events for the labelInfo property.
static String LARGE_ICON_INFO_PROPERTY
          The property name used when firing events for the largeIconInfo property.
static String LARGE_ICON_PROPERTY
          The property name used when firing events for the largeIcon property.
 
Fields inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher
logger
 
Fields inherited from interface org.springframework.richclient.core.DescribedElement
CAPTION_PROPERTY, DESCRIPTION_PROPERTY, DISPLAY_NAME_PROPERTY
 
Constructor Summary
CommandFaceDescriptor()
          Creates a new CommandFaceDescriptor with a blank label and no icon or caption.
CommandFaceDescriptor(CommandButtonLabelInfo labelInfo)
          Creates a new CommandFaceDescriptor whose label information is provided by the given CommandButtonLabelInfo instance.
CommandFaceDescriptor(String encodedLabel)
          Creates a new CommandFaceDescriptor that uses the given encoded label descriptor to provide the label properties.
CommandFaceDescriptor(String encodedLabel, Icon icon, String caption)
          Creates a new CommandFaceDescriptor that uses the given encoded label descriptor to provide the label properties, along with the given icon and caption.
 
Method Summary
 void configure(AbstractButton button, AbstractCommand command, CommandButtonConfigurer configurer)
          Configures the given button and command using the given configurer and the information contained in this instance.
 void configure(Action action)
          Configures the given action with the information contained in this descriptor.
 void configureIcon(AbstractButton button)
          Configures the given button with the icon information contained in this descriptor.
 void configureIconInfo(AbstractButton button, boolean useLargeIcons)
          Configures the given button with the icon information contained in this descriptor.
 void configureLabel(AbstractButton button)
          Configures the given button with the label information contained in this descriptor.
 KeyStroke getAccelerator()
          Returns the keystroke accelerator associated with the command.
 String getCaption()
          Returns the caption for this object.
 String getDescription()
          Returns a description of this object.
 String getDisplayName()
          Returns the display name of this object.
 Icon getIcon()
          Returns the icon associated with the application component, or null.
protected  CommandButtonIconInfo getIconInfo()
          Returns the label information for the command.
 Image getImage()
          Returns the image associated with the application component, or null.
protected  CommandButtonLabelInfo getLabelInfo()
          Returns the command button label info object.
 Icon getLargeIcon()
          Returns the main default large icon associated with the command.
protected  CommandButtonIconInfo getLargeIconInfo()
          Returns the large icon information object for the command.
 int getMnemonic()
          Returns the mnemonic to be associated with the command.
 int getMnemonicIndex()
          Returns the zero-based index of the mnemonic character within the label text associated with the command.
 String getText()
          Returns the label text specified by this descriptor.
 boolean isBlank()
          Returns true if no command label information is provided by this descriptor.
 void setButtonLabelInfo(String encodedLabelInfo)
          Sets the label information for the command using the given encoded label descriptor.
 void setCaption(String shortDescription)
          
 void setDescription(String longDescription)
          
 void setIcon(Icon icon)
          Set the main default icon to be associated with the command.
 void setIconInfo(CommandButtonIconInfo iconInfo)
          
 void setLabelInfo(CommandButtonLabelInfo labelInfo)
          
 void setLargeIcon(Icon icon)
          Sets the main default large icon for the command.
 void setLargeIconInfo(CommandButtonIconInfo largeIconInfo)
          
 String toString()
          
 
Methods inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LABEL_INFO_PROPERTY

public static final String LABEL_INFO_PROPERTY
The property name used when firing events for the labelInfo property.

See Also:
Constant Field Values

ICON_PROPERTY

public static final String ICON_PROPERTY
The property name used when firing events for the icon property.

See Also:
Constant Field Values

LARGE_ICON_PROPERTY

public static final String LARGE_ICON_PROPERTY
The property name used when firing events for the largeIcon property.

See Also:
Constant Field Values

ICON_INFO_PROPERTY

public static final String ICON_INFO_PROPERTY
The property name used when firing events for the iconInfo property.

See Also:
Constant Field Values

LARGE_ICON_INFO_PROPERTY

public static final String LARGE_ICON_INFO_PROPERTY
The property name used when firing events for the largeIconInfo property.

See Also:
Constant Field Values
Constructor Detail

CommandFaceDescriptor

public CommandFaceDescriptor(String encodedLabel)
Creates a new CommandFaceDescriptor that uses the given encoded label descriptor to provide the label properties.

Parameters:
encodedLabel - The encoded label descriptor. May be null or empty to define a blank label.
See Also:
CommandButtonLabelInfo.valueOf(String)

CommandFaceDescriptor

public CommandFaceDescriptor(String encodedLabel,
                             Icon icon,
                             String caption)
Creates a new CommandFaceDescriptor that uses the given encoded label descriptor to provide the label properties, along with the given icon and caption.

Parameters:
encodedLabel - The encoded label descriptor. May be null or empty.
icon - The main default icon to be displayed by the command. May be null.
caption - The caption to be displayed on rollover of the command. May be null or empty.
See Also:
CommandButtonLabelInfo.valueOf(String)

CommandFaceDescriptor

public CommandFaceDescriptor()
Creates a new CommandFaceDescriptor with a blank label and no icon or caption.


CommandFaceDescriptor

public CommandFaceDescriptor(CommandButtonLabelInfo labelInfo)
Creates a new CommandFaceDescriptor whose label information is provided by the given CommandButtonLabelInfo instance.

Parameters:
labelInfo - The label information for the command.
Method Detail

isBlank

public boolean isBlank()
Returns true if no command label information is provided by this descriptor.

Returns:
true if there is no label information, false otherwise.

getText

public String getText()
Returns the label text specified by this descriptor.

Returns:
The label text. May be null or empty.

getDisplayName

public String getDisplayName()
Returns the display name of this object.

Specified by:
getDisplayName in interface DescribedElement
Returns:
The display name, or null.

getCaption

public String getCaption()
Returns the caption for this object.

Specified by:
getCaption in interface DescribedElement
Returns:
The caption, or null.

getDescription

public String getDescription()
Returns a description of this object.

Specified by:
getDescription in interface DescribedElement
Returns:
The description, or null.

getMnemonic

public int getMnemonic()
Returns the mnemonic to be associated with the command.

Returns:
The command mnemonic.

getMnemonicIndex

public int getMnemonicIndex()
Returns the zero-based index of the mnemonic character within the label text associated with the command.

Returns:
The mnemonic index, or -1 if no mnemonic index is associated with the command.

getImage

public Image getImage()
Returns the image associated with the application component, or null.

Specified by:
getImage in interface VisualizedElement

getIcon

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

Specified by:
getIcon in interface VisualizedElement

getLargeIcon

public Icon getLargeIcon()
Returns the main default large icon associated with the command.

Returns:
The large icon, or null.

getAccelerator

public KeyStroke getAccelerator()
Returns the keystroke accelerator associated with the command.

Returns:
The keystroke accelerator, or null.

getLabelInfo

protected CommandButtonLabelInfo getLabelInfo()
Returns the command button label info object.

Returns:
The command button label info, or null.

getIconInfo

protected CommandButtonIconInfo getIconInfo()
Returns the label information for the command.

Returns:
The label information, never null.

getLargeIconInfo

protected CommandButtonIconInfo getLargeIconInfo()
Returns the large icon information object for the command.

Returns:
The large icon information, or null.

setCaption

public void setCaption(String shortDescription)

Specified by:
setCaption in interface DescriptionConfigurable

setDescription

public void setDescription(String longDescription)

Specified by:
setDescription in interface DescriptionConfigurable

setButtonLabelInfo

public void setButtonLabelInfo(String encodedLabelInfo)
Sets the label information for the command using the given encoded label descriptor.

Parameters:
encodedLabelInfo - The encoded label descriptor. May be null or empty.
See Also:
CommandButtonLabelInfo.valueOf(String)

setLabelInfo

public void setLabelInfo(CommandButtonLabelInfo labelInfo)

Specified by:
setLabelInfo in interface CommandLabelConfigurable

setIconInfo

public void setIconInfo(CommandButtonIconInfo iconInfo)

Specified by:
setIconInfo in interface CommandIconConfigurable

setLargeIconInfo

public void setLargeIconInfo(CommandButtonIconInfo largeIconInfo)

Specified by:
setLargeIconInfo in interface CommandIconConfigurable

setIcon

public void setIcon(Icon icon)
Set the main default icon to be associated with the command.

Parameters:
icon - The main default icon. May be null.

setLargeIcon

public void setLargeIcon(Icon icon)
Sets the main default large icon for the command.

Parameters:
icon - The large icon. May be null.

configureLabel

public void configureLabel(AbstractButton button)
Configures the given button with the label information contained in this descriptor.

Parameters:
button - The button to be configured. Must not be null.
Throws:
IllegalArgumentException - if button is null.

configureIcon

public void configureIcon(AbstractButton button)
Configures the given button with the icon information contained in this descriptor.

Parameters:
button - The button to be configured. Must not be null.
Throws:
IllegalArgumentException - if button is null.

configureIconInfo

public void configureIconInfo(AbstractButton button,
                              boolean useLargeIcons)
Configures the given button with the icon information contained in this descriptor.

Parameters:
button - The button to be configured. Must not be null.
useLargeIcons - Set to true to configure the button with large icons. False will use default size icons.
Throws:
IllegalArgumentException - if button is null.

configure

public void configure(AbstractButton button,
                      AbstractCommand command,
                      CommandButtonConfigurer configurer)
Configures the given button and command using the given configurer and the information contained in this instance.

Parameters:
button - The button to be configured. Must not be null.
command - The command to be configured. May be null.
configurer - The configurer. Must not be null.
Throws:
IllegalArgumentException - if button or configurer are null.

configure

public void configure(Action action)
Configures the given action with the information contained in this descriptor.

Parameters:
action - The action to be configured. Must not be null.
Throws:
IllegalArgumentException - if action is null.

toString

public String toString()

Overrides:
toString in class Object


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