Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.face
Class Face

    java.lang.Object
      com.pietschy.command.face.Face

All Implemented Interfaces:
  java.lang.Cloneable

    public class Face

extends java.lang.Object
implements java.lang.Cloneable

The face class holds all the visiual information about a Command. Faces are identified by a context that defines where the face is relevant. The context may be any non empty string but are usually the defaults defined by `DEFAULT`, `BUTTON`, `TOOLBAR`, `MENU`, `HTML`, `POPUP` `TOOLBAR_POPUP`, and `HTML_POPUP`.

Faces are then used by the current `FaceRenderer` to configure the appearance of buttons created with the context of this face.

See Also:
  `Defaults.setFaceRenderer(FaceRenderer)`, `Command.createButton(String)`, `Command.createMenuItem(String)`

Field Summary
`static java.lang.String` | `BUTTON` Button context
`static java.lang.String` | `DEFAULT` Default context
`static java.lang.String` | `HTML` HTML context
`static java.lang.String` | `HTML_POPUP` HTML popup context
`static java.lang.String` | `MENU` Menu context
`static char` | `MNEMONIC_MARKER`
`(package private) com.pietschy.command.face.Face.ParentListener` | `parentListener`
`static java.lang.String` | `POPUP` Popup menu context
`static java.lang.String` | `TOOLBAR` Toolbar context
`static java.lang.String` | `TOOLBAR_POPUP` Toolbar popup context

Constructor Summary
`Face(java.lang.String context)` Constructs a new empty face with the specified context.

Method Summary
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Adds a property change listener for all properties of the face.
`void` | `addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)` Adds a property change listener to the face.
`Face` | `clone()` Creates a clone of this face.
`(package private) AttributeValue` | `createAttributeValue(Attribute attr)` Creates the attribute for the specified attribute name.
`javax.swing.KeyStroke` | `getAccelerator()` Gets the accelerator of the face.
`AttributeValue` | `getAttribute(Attribute attr)` Gets the specified attribute, lazily creating it if it doesn't already exit.
`(package private) java.util.EnumMap<Attribute,AttributeValue>` | `getAttributeMap()` Exposed for unit test purposes.
`(package private) java.lang.Object` | `getAttributeValue(Attribute attr)` Gets the value of the specified attribute.
`java.lang.String` | `getClientProperty(java.lang.String name)` Gets the value of the specified client property.
`java.lang.String` | `getClientProperty(java.lang.String name, java.lang.String defaultValue)` Gets the value of the specified client property, or returns the specified default value if it doesn't exist.
`java.util.Set<java.lang.String>` | `getClientPropertyNames()` Gets the client property names of this face.
`java.lang.String` | `getContext()` Gets the context of this face.
`java.lang.String` | `getDescription()` Gets the description attriubte of the face.
`javax.swing.Icon` | `getDisabledIcon()` Gets the disabled icon for the face.
`java.lang.String` | `getExtendsContext()` Gets the face context that this face extends.
`java.lang.Integer` | `getHorizontalTextPosition()` Gets the horizontal text position of this face.
`javax.swing.Icon` | `getIcon()` Gets the main icon for the face.
`java.lang.Integer` | `getIconTextGap()` Gets the icon text gap of the face, or `null` if it hasn't been configured.
`java.lang.String` | `getLongDescription()` Gets the long description attribute of the face.
`java.lang.Integer` | `getMnemonic()` Gets the mnemonic of the face.
`java.lang.Integer` | `getMnemonicIndex()` Gets the mnemonic index of the face.
`(package private) Face` | `getParent()` Gets this parent face.
`(package private) java.lang.Object` | `getParentValue(Attribute attr)` Gets the inherited value of the specified attribute name.
`(package private) java.beans.PropertyChangeSupport` | `getPcs()`
`javax.swing.Icon` | `getPressedIcon()` Gets the pressed icon for the face.
`javax.swing.Icon` | `getRolloverIcon()` Gets the rollover icon for the face.
`javax.swing.Icon` | `getRolloverSelectedIcon()` Gets the rollover selected icon for the face.
`javax.swing.Icon` | `getSelectedIcon()` Gets the selected icon for the face.
`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.
`void` | `putClientProperty(java.lang.String name, java.lang.String value)` Sets the value of the specified client property.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Removes a property change listener from all properties of the face.
`void` | `removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)` Removes a property change listener from the face.
`void` | `setAccelerator(javax.swing.KeyStroke accelerator)` Sets accelerator of the face.
`void` | `setAcceleratorInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setDescription(java.lang.String description)` Sets the description attribute of the face.
`void` | `setDescriptionInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setDisabledIcon(javax.swing.Icon icon)` Sets the disabled icon of the face.
`void` | `setDisabledIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setExtendsContext(java.lang.String extendsContext)` Sets the context this face extends.
`void` | `setHorizontalTextPosition(java.lang.Integer position)` Sets the horizontal position for the text on this face.
`void` | `setHorizontalTextPositionInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setIcon(javax.swing.Icon icon)` Sets the main icon of the face.
`void` | `setIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setIconTextGap(java.lang.Integer gap)` Sets the icon text gap of the face.
`void` | `setIconTextGapInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setLongDescription(java.lang.String description)` Sets the long description attribute of the face.
`void` | `setLongDescriptionInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setMnemonic(java.lang.Integer mnemonic)` Sets the mnemonic of the face.
`void` | `setMnemonicIndex(java.lang.Integer index)` Sets the mnemonic index the face.
`void` | `setMnemonicIndexInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setMnemonicInherited(boolean inherited)` Configures if the value is inherited when `null`.
`(package private) void` | `setParent(Face parent)` Sets this faces parent.
`void` | `setPressedIcon(javax.swing.Icon icon)` Sets the pressed icon of the face.
`void` | `setPressedIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setRolloverIcon(javax.swing.Icon icon)` Sets the rollover icon of the face.
`void` | `setRolloverIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setRolloverSelectedIcon(javax.swing.Icon icon)` Sets the rollover selected icon of the face.
`void` | `setRolloverSelectedIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setSelectedIcon(javax.swing.Icon icon)` Sets the selected icon of the face.
`void` | `setSelectedIconInherited(boolean inherited)` Configures if the value is inherited when `null`.
`void` | `setText(java.lang.String text)` Sets the text for the face.
`void` | `setTextInherited(boolean textInherited)` Configures if the text is inherited if the value is `null`.
`void` | `setVerticalTextPosition(java.lang.Integer integer)` Sets the vertical text position.
`void` | `setVerticalTextPositionInherited(boolean inherited)` Configures if the value is inherited when `null`.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MNEMONIC_MARKER

    public static final char MNEMONIC_MARKER

See Also:
  Constant Field Values

### DEFAULT

    public static final java.lang.String DEFAULT

  Default context

  See Also:
    Constant Field Values

### BUTTON

    public static final java.lang.String BUTTON

  Button context

  See Also:
    Constant Field Values

### MENU

    public static final java.lang.String MENU

  Menu context

  See Also:
    Constant Field Values

### POPUP

    public static final java.lang.String POPUP

  Popup menu context

  See Also:
    Constant Field Values

### TOOLBAR

    public static final java.lang.String TOOLBAR

  Toolbar context

  See Also:
    Constant Field Values

### TOOLBAR_POPUP

    public static final java.lang.String TOOLBAR_POPUP

  Toolbar popup context

  See Also:
    Constant Field Values

### HTML

    public static final java.lang.String HTML

  HTML context

  See Also:
    Constant Field Values

### HTML_POPUP

    public static final java.lang.String HTML_POPUP

  HTML popup context

  See Also:
    Constant Field Values

### parentListener

    com.pietschy.command.face.Face.ParentListener parentListener

Constructor Detail

### Face

    public Face(java.lang.String context)

  Constructs a new empty face with the specified context.

  Parameters:
    `context` - the context of this face. Typically "default", "button", "menu" etc

Method Detail

### clone

    public Face clone()

  Creates a clone of this face.

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    a clone of this face.

### getPcs

    java.beans.PropertyChangeSupport getPcs()

### getContext

    public java.lang.String getContext()

  Gets the context of this face.

  Returns:
    the context of this face.

### getExtendsContext

    public java.lang.String getExtendsContext()

  Gets the face context that this face extends. May be `null`.

  Returns:
    the face context that this face extends, or `null` if this face doesn't extend another.

### setExtendsContext

    public void setExtendsContext(java.lang.String extendsContext)

  Sets the context this face extends.

  Parameters:
    `extendsContext` - the context this face extends, or `null` if this face doesn't extend another.

### getParent

    Face getParent()

  Gets this parent face.

### setParent

    void setParent(Face parent)

  Sets this faces parent.

### getAttribute

    public AttributeValue getAttribute(Attribute attr)

  Gets the specified attribute, lazily creating it if it doesn't already exit. This method is not typically used by end users.

  Parameters:
    `attr` - the `Attribute`.
  Returns:
    the specified attribute of the face.

### createAttributeValue

    AttributeValue createAttributeValue(Attribute attr)

  Creates the attribute for the specified attribute name. This method knows to create `DescriptionAttributeValue` values for the description and longDescriptoin attributes.

  Parameters:
    `attr` -
  Returns:
    a new attribute for the specified attribute name.

### getAttributeValue

    java.lang.Object getAttributeValue(Attribute attr)

  Gets the value of the specified attribute. This method will attempt to retrieve the inherited value if required.

  Parameters:
    `attr` - the attribute name
  Returns:
    the attribute value, or the inherited value if required.

### getAttributeMap

    java.util.EnumMap<Attribute,AttributeValue> getAttributeMap()

  Exposed for unit test purposes.

  Returns:
    the attribute map of this face.

### getParentValue

    java.lang.Object getParentValue(Attribute attr)

  Gets the inherited value of the specified attribute name.

  Parameters:
    `attr` - the attribute.
  Returns:
    the inherited value.

### putClientProperty

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

  Sets the value of the specified client property. This property will be applied to all buttons created with this face.

  Parameters:
    `name` - the client property name.
    `value` - the client property value.

### getClientProperty

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

  Gets the value of the specified client property.

  Parameters:
    `name` - the property name.
  Returns:
    the property value.

### getClientProperty

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

  Gets the value of the specified client property, or returns the specified default value if it doesn't exist.

  Parameters:
    `name` - the property name
    `defaultValue` - the value to return if the property isn't defined.
  Returns:
    the property value or the defaultValue if the property doesn't exists.

### getClientPropertyNames

    public java.util.Set<java.lang.String> getClientPropertyNames()

  Gets the client property names of this face.

  Returns:
    the client property names of this face.

### 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.

### setText

    public void setText(java.lang.String text)

  Sets the text for the face. This methods interprets the '_' character as a mnemonic marker. If present it will automatically update the mnemonic settings of the face as well.

  Parameters:
    `text` - the new string for the face.

### setTextInherited

    public void setTextInherited(boolean textInherited)

  Configures if the text is inherited if the value is `null`.

  Parameters:
    `textInherited` - `true` to inherit from the parent face, `false` otherwise.

### 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()`

### 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()`

### setHorizontalTextPositionInherited

    public void setHorizontalTextPositionInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### 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()`

### setVerticalTextPosition

    public void setVerticalTextPosition(java.lang.Integer integer)

  Sets the vertical text position. The values are as per `AbstractButton.setVerticalTextPosition(int)`.

  Configuring this value will result in the `horizontalTextPosition` being ignored.

  Parameters:
    `integer` - the vertical text position of the face.

### setVerticalTextPositionInherited

    public void setVerticalTextPositionInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getIconTextGap

    public java.lang.Integer getIconTextGap()

  Gets the icon text gap of the face, or `null` if it hasn't been configured.

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

### setIconTextGap

    public void setIconTextGap(java.lang.Integer gap)

  Sets the icon text gap of the face.

  Parameters:
    `gap` - the icon text gap of the face, or `null` to inherit or clear the value.

### setIconTextGapInherited

    public void setIconTextGapInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getIcon

    public javax.swing.Icon getIcon()

  Gets the main icon for the face.

  Returns:
    the main icon for the face.

### setIcon

    public void setIcon(javax.swing.Icon icon)

  Sets the main icon of the face.

  Parameters:
    `icon` - the icon of the face, or `null` to inherit or clear the value.

### setIconInherited

    public void setIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getSelectedIcon

    public javax.swing.Icon getSelectedIcon()

  Gets the selected icon for the face.

  Returns:
    the selected icon for the face.

### setSelectedIcon

    public void setSelectedIcon(javax.swing.Icon icon)

  Sets the selected icon of the face.

  Parameters:
    `icon` - the selected icon of the face, or `null` to inherit or clear the value.

### setSelectedIconInherited

    public void setSelectedIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getRolloverIcon

    public javax.swing.Icon getRolloverIcon()

  Gets the rollover icon for the face.

  Returns:
    the rollover icon for the face.

### setRolloverIcon

    public void setRolloverIcon(javax.swing.Icon icon)

  Sets the rollover icon of the face.

  Parameters:
    `icon` - the rollover icon of the face, or `null` to inherit or clear the value.

### setRolloverIconInherited

    public void setRolloverIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getRolloverSelectedIcon

    public javax.swing.Icon getRolloverSelectedIcon()

  Gets the rollover selected icon for the face.

  Returns:
    the rollover selected icon for the face.

### setRolloverSelectedIcon

    public void setRolloverSelectedIcon(javax.swing.Icon icon)

  Sets the rollover selected icon of the face.

  Parameters:
    `icon` - the rollover selected icon of the face, or `null` to inherit or clear the value.

### setRolloverSelectedIconInherited

    public void setRolloverSelectedIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getPressedIcon

    public javax.swing.Icon getPressedIcon()

  Gets the pressed icon for the face.

  Returns:
    the pressed icon for the face.

### setPressedIcon

    public void setPressedIcon(javax.swing.Icon icon)

  Sets the pressed icon of the face.

  Parameters:
    `icon` - the pressed icon of the face, or `null` to inherit or clear the value.

### setPressedIconInherited

    public void setPressedIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getDisabledIcon

    public javax.swing.Icon getDisabledIcon()

  Gets the disabled icon for the face.

  Returns:
    the disabled icon for the face.

### setDisabledIcon

    public void setDisabledIcon(javax.swing.Icon icon)

  Sets the disabled icon of the face.

  Parameters:
    `icon` - the disabled icon of the face, or `null` to inherit or clear the value.

### setDisabledIconInherited

    public void setDisabledIconInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getMnemonic

    public java.lang.Integer getMnemonic()

  Gets the mnemonic of the face.

  Returns:
    the mnemonic of the face.

### setMnemonic

    public void setMnemonic(java.lang.Integer mnemonic)

  Sets the mnemonic of the face. This value will be used unless `setMnemonicIndex(Integer)` is specified.

  Parameters:
    `mnemonic` - the mnemonic of the face, or `null` to inherit or clear the value.

### setMnemonicInherited

    public void setMnemonicInherited(boolean inherited)

  Configures if the value is inherited when `null`. If specified this value will be used in preference to `getMnemonic()`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getMnemonicIndex

    public java.lang.Integer getMnemonicIndex()

  Gets the mnemonic index of the face.

  Returns:
    the mnemonic index of the face.

### setMnemonicIndex

    public void setMnemonicIndex(java.lang.Integer index)

  Sets the mnemonic index the face.

  Parameters:
    `index` - the mnemonic index of the face, or `null` to inherit or clear the value.

### setMnemonicIndexInherited

    public void setMnemonicIndexInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getAccelerator

    public javax.swing.KeyStroke getAccelerator()

  Gets the accelerator of the face.

  Returns:
    the accelerator of the face.

### setAccelerator

    public void setAccelerator(javax.swing.KeyStroke accelerator)

  Sets accelerator of the face.

  Parameters:
    `accelerator` - the accelerator of the face, or `null` to inherit or clear the value.

### setAcceleratorInherited

    public void setAcceleratorInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getDescription

    public java.lang.String getDescription()

  Gets the description attriubte of the face.

  Returns:
    the description attriubte of the face.

### setDescription

    public void setDescription(java.lang.String description)

  Sets the description attribute of the face. Occurances of the strings "`$text`" and "`$accelerator`" will be replaced with the text and accelerator values of the face.

         face.setDescription("my accelerator is $accelerator");

  Parameters:
    `description` - the description attribute of the face, or `null` to inherit or clear the value.

### setDescriptionInherited

    public void setDescriptionInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### getLongDescription

    public java.lang.String getLongDescription()

  Gets the long description attribute of the face.

  Returns:
    the long description attribute of the face.

### setLongDescription

    public void setLongDescription(java.lang.String description)

  Sets the long description attribute of the face. Occurances of the strings "`$text`" and "`$accelerator`" will be replaced with the text and accelerator values of the face.

         face.setLongDescription("my accelerator is $accelerator");

  Parameters:
    `description` - the long description attribute of the face, or `null` to inherit or clear the value.

### setLongDescriptionInherited

    public void setLongDescriptionInherited(boolean inherited)

  Configures if the value is inherited when `null`.

  Parameters:
    `inherited` - `true` to inherit from the parent face, `false` otherwise.

### addPropertyChangeListener

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

  Adds a property change listener to the face.

  Parameters:
    `propertyName` - the property to observe.
    `listener` - the listener.

### removePropertyChangeListener

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

  Removes a property change listener from the face.

  Parameters:
    `propertyName` - the property being observed.
    `listener` - the listener to remove.

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Adds a property change listener for all properties of the face.

  Parameters:
    `listener` - the listener.

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Removes a property change listener from all properties of the face.

  Parameters:
    `listener` - the listener.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch