org.pietschy.command
Class Face

java.lang.Object
  extended by org.pietschy.command.Face

public class Face
extends java.lang.Object

The face class holds all the visiual information about a Command. Faces are identified by a FaceId that references the parent command and the name of the face. Face names may be any non empty string but are usually the defaults defined by DEFAULT, BUTTON, TOOLBAR, MENU, POPUP and HTML. The commands will determine the appropriate face based on the context in which a button or menu is created.


Field Summary
static java.lang.String BUTTON
           
static java.lang.String DEFAULT
           
protected  FaceId extendsId
           
protected  FaceManager faceManager
           
static java.lang.String HTML
           
static java.lang.String MENU
           
protected  java.beans.PropertyChangeSupport pcs
           
static java.lang.String POPUP
           
static java.lang.String TOOLBAR
           
 
Constructor Summary
protected Face(FaceId id, FaceManager manager)
          Constructs a new empty face with the specified id, that uses the specified CommandManager to locating the face it extends.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 boolean canExtend(FaceId faceId)
           
 javax.swing.KeyStroke getAccelerator()
           
 java.lang.String getClientProperty(java.lang.String name)
           
 java.lang.String getClientProperty(java.lang.String name, java.lang.String defaultValue)
           
 java.lang.String[] getClientPropertyNames()
           
 java.lang.String getDescription()
           
 javax.swing.Icon getDisabledIcon()
           
 FaceId getExtendsId()
           
 java.lang.Integer getHorizontalTextPosition()
          Gets the horizontal text position of this face.
 javax.swing.Icon getIcon()
           
 java.lang.Integer getIconTextGap()
          Gets the vertical text position of this face.
 FaceId getId()
           
 java.lang.String getLongDescription()
           
 java.lang.Integer getMnemonic()
           
 java.lang.Integer getMnemonicIndex()
           
 java.lang.String getName()
           
 javax.swing.Icon getPressedIcon()
           
 javax.swing.Icon getRolloverIcon()
           
 javax.swing.Icon getRolloverSelectedIcon()
           
 javax.swing.Icon getSelectedIcon()
           
 java.lang.String getText()
          Returns the Test as displayed by attachments of this command.
 java.lang.Integer getVerticalTextPosition()
          Gets the vertical text position of this face.
 boolean isAcceleratorInherited()
           
 boolean isDisabledIconInherited()
           
 boolean isIconInherited()
           
 boolean isIconTextGapInherited()
           
 boolean isMenuTooltipEnabled()
           
 boolean isNameEqualTo(java.lang.String name)
          Tests if this face's name is the same as the specified name.
 boolean isPressedIconInherited()
           
 boolean isRolloverIconInherited()
           
 boolean isRolloverSelectedIconInherited()
           
 boolean isSelectedIconInherited()
           
protected  void notifyMenuTooltipDefaultChanged(boolean newValue)
           
 void putClientProperty(java.lang.String name, java.lang.String value)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void setAccelerator(javax.swing.KeyStroke accelerator)
           
 void setAcceleratorInherited(boolean acceleratorInherited)
           
 void setDescription(java.lang.String string)
           
 void setDisabledIcon(javax.swing.Icon icon)
           
 void setDisabledIconInherited(boolean inherited)
           
 void setExtendsId(FaceId extendsId)
           
 void setHorizontalTextPosition(java.lang.Integer position)
          Sets the horizontal position for the text on this face.
 void setIcon(javax.swing.Icon icon)
           
 void setIconInherited(boolean iconInherited)
           
 void setIconTextGap(java.lang.Integer gap)
           
 void setIconTextGapInherited(boolean inherited)
           
 void setLongDescription(java.lang.String string)
           
 void setMenuTooltipEnabled(boolean menuTooltipEnabled)
           
 void setMnemonic(java.lang.Integer mnemonic)
           
 void setMnemonicIndex(java.lang.Integer mnemonicIndex)
          Sets the mnemonic to use based on it character index in the string.
 void setPressedIcon(javax.swing.Icon icon)
           
 void setPressedIconInherited(boolean inherited)
           
 void setRolloverIcon(javax.swing.Icon icon)
           
 void setRolloverIconInherited(boolean inherited)
           
 void setRolloverSelectedIcon(javax.swing.Icon icon)
           
 void setRolloverSelectedIconInherited(boolean inherited)
           
 void setSelectedIcon(javax.swing.Icon selectedIcon)
           
 void setSelectedIconInherited(boolean selectedIconInherited)
           
 void setText(java.lang.String string)
          Sets the text for the face.
 void setTextInherited(boolean textInherited)
           
 void setVerticalTextPosition(java.lang.Integer position)
          Sets the vertical position for the text on this face.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final java.lang.String DEFAULT
See Also:
Constant Field Values

BUTTON

public static final java.lang.String BUTTON
See Also:
Constant Field Values

TOOLBAR

public static final java.lang.String TOOLBAR
See Also:
Constant Field Values

MENU

public static final java.lang.String MENU
See Also:
Constant Field Values

POPUP

public static final java.lang.String POPUP
See Also:
Constant Field Values

HTML

public static final java.lang.String HTML
See Also:
Constant Field Values

extendsId

protected FaceId extendsId

pcs

protected java.beans.PropertyChangeSupport pcs

faceManager

protected FaceManager faceManager
Constructor Detail

Face

protected Face(FaceId id,
               FaceManager manager)
Constructs a new empty face with the specified id, that uses the specified CommandManager to locating the face it extends.

Parameters:
id - the id of this face.
manager - the FaceManager to use to locate the parent face.
Method Detail

getId

public FaceId getId()

getName

public java.lang.String getName()

isNameEqualTo

public boolean isNameEqualTo(java.lang.String name)
Tests if this face's name is the same as the specified name.

Parameters:
name - the name to compare with this face's name.
Returns:
true if the names are the same, false otherwise.

putClientProperty

public void putClientProperty(java.lang.String name,
                              java.lang.String value)

getClientProperty

public java.lang.String getClientProperty(java.lang.String name)

getClientProperty

public java.lang.String getClientProperty(java.lang.String name,
                                          java.lang.String defaultValue)

getClientPropertyNames

public java.lang.String[] getClientPropertyNames()

getText

public java.lang.String getText()
Returns the Test as displayed by attachments of this command. This is the value that actually appears on the button or menu item.

Returns:
the text this face displays.

getHorizontalTextPosition

public java.lang.Integer getHorizontalTextPosition()
Gets the horizontal text position of this face.

This attribute will be ignored if the verticalPosition has been configured as the vertical position on button is only useful if the horizontal position is set to SwingConstants.CENTER.

Returns:
the horizontal text position of the face.
See Also:
getVerticalTextPosition()

getVerticalTextPosition

public java.lang.Integer getVerticalTextPosition()
Gets the vertical text position of this face.

Configuring this value will result in the horizontalTextPosition being ignored.

Returns:
the vertical text position of the face.
See Also:
getVerticalTextPosition()

getIconTextGap

public java.lang.Integer getIconTextGap()
Gets the vertical text position of this face. If it hasn't been configured, then null is returned.

Returns:
the icon text gap of the face or null if it hasn't been configured.

isIconTextGapInherited

public boolean isIconTextGapInherited()

getIcon

public javax.swing.Icon getIcon()

isIconInherited

public boolean isIconInherited()

getSelectedIcon

public javax.swing.Icon getSelectedIcon()

isSelectedIconInherited

public boolean isSelectedIconInherited()

getRolloverIcon

public javax.swing.Icon getRolloverIcon()

isRolloverIconInherited

public boolean isRolloverIconInherited()

getRolloverSelectedIcon

public javax.swing.Icon getRolloverSelectedIcon()

isRolloverSelectedIconInherited

public boolean isRolloverSelectedIconInherited()

getPressedIcon

public javax.swing.Icon getPressedIcon()

isPressedIconInherited

public boolean isPressedIconInherited()

getDisabledIcon

public javax.swing.Icon getDisabledIcon()

isDisabledIconInherited

public boolean isDisabledIconInherited()

getMnemonic

public java.lang.Integer getMnemonic()

getMnemonicIndex

public java.lang.Integer getMnemonicIndex()

getAccelerator

public javax.swing.KeyStroke getAccelerator()

isAcceleratorInherited

public boolean isAcceleratorInherited()

getDescription

public java.lang.String getDescription()

getLongDescription

public java.lang.String getLongDescription()

isMenuTooltipEnabled

public boolean isMenuTooltipEnabled()

setAccelerator

public void setAccelerator(javax.swing.KeyStroke accelerator)

setAcceleratorInherited

public void setAcceleratorInherited(boolean acceleratorInherited)

setIcon

public void setIcon(javax.swing.Icon icon)

setIconInherited

public void setIconInherited(boolean iconInherited)

setSelectedIcon

public void setSelectedIcon(javax.swing.Icon selectedIcon)

setSelectedIconInherited

public void setSelectedIconInherited(boolean selectedIconInherited)

setRolloverIcon

public void setRolloverIcon(javax.swing.Icon icon)

setRolloverIconInherited

public void setRolloverIconInherited(boolean inherited)

setRolloverSelectedIcon

public void setRolloverSelectedIcon(javax.swing.Icon icon)

setRolloverSelectedIconInherited

public void setRolloverSelectedIconInherited(boolean inherited)

setPressedIcon

public void setPressedIcon(javax.swing.Icon icon)

setPressedIconInherited

public void setPressedIconInherited(boolean inherited)

setDisabledIcon

public void setDisabledIcon(javax.swing.Icon icon)

setDisabledIconInherited

public void setDisabledIconInherited(boolean inherited)

setLongDescription

public void setLongDescription(java.lang.String string)

setMnemonic

public void setMnemonic(java.lang.Integer mnemonic)

setMnemonicIndex

public void setMnemonicIndex(java.lang.Integer mnemonicIndex)
Sets the mnemonic to use based on it character index in the string.

Parameters:
mnemonicIndex -

setDescription

public void setDescription(java.lang.String string)

setText

public void setText(java.lang.String string)
Sets the text for the face. This methods interprets the '_' character as a mnemonic marker. If present this method will automatically update the mnemonic settings of the face as well.

Parameters:
string - the new string for the face.

setTextInherited

public void setTextInherited(boolean textInherited)

setHorizontalTextPosition

public void setHorizontalTextPosition(java.lang.Integer position)
Sets the horizontal position for the text on this face. If it null, then the default for the look and feel will be used.

Parameters:
position - the horizontal position of the text.
See Also:
getHorizontalTextPosition()

setVerticalTextPosition

public void setVerticalTextPosition(java.lang.Integer position)
Sets the vertical position for the text on this face. If it null, then the default for the look and feel will be used.

Parameters:
position - the vertical position of the text.
See Also:
getVerticalTextPosition()

setIconTextGap

public void setIconTextGap(java.lang.Integer gap)

setIconTextGapInherited

public void setIconTextGapInherited(boolean inherited)

setMenuTooltipEnabled

public void setMenuTooltipEnabled(boolean menuTooltipEnabled)

getExtendsId

public FaceId getExtendsId()

setExtendsId

public void setExtendsId(FaceId extendsId)

canExtend

public boolean canExtend(FaceId faceId)

notifyMenuTooltipDefaultChanged

protected void notifyMenuTooltipDefaultChanged(boolean newValue)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object