org.pietschy.command

Class 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 String
BUTTON
static String
DEFAULT
static String
HTML
static String
MENU
static String
POPUP
static String
TOOLBAR
protected FaceId
extendsId
protected FaceManager
faceManager
protected PropertyChangeSupport
pcs

Constructor Summary

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(PropertyChangeListener listener)
void
addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
boolean
canExtend(FaceId faceId)
KeyStroke
getAccelerator()
String
getClientProperty(String name)
String
getClientProperty(String name, String defaultValue)
String[]
getClientPropertyNames()
String
getDescription()
Icon
getDisabledIcon()
FaceId
getExtendsId()
Integer
getHorizontalTextPosition()
Gets the horizontal text position of this face.
Icon
getIcon()
Integer
getIconTextGap()
Gets the vertical text position of this face.
FaceId
getId()
String
getLongDescription()
Integer
getMnemonic()
Integer
getMnemonicIndex()
String
getName()
Icon
getPressedIcon()
Icon
getRolloverIcon()
Icon
getRolloverSelectedIcon()
Icon
getSelectedIcon()
String
getText()
Returns the Test as displayed by attachments of this command.
Integer
getVerticalTextPosition()
Gets the vertical text position of this face.
boolean
isAcceleratorInherited()
boolean
isDisabledIconInherited()
boolean
isIconInherited()
boolean
isIconTextGapInherited()
boolean
isMenuTooltipEnabled()
boolean
isNameEqualTo(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(String name, String value)
void
removePropertyChangeListener(PropertyChangeListener listener)
void
removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
void
setAccelerator(KeyStroke accelerator)
void
setAcceleratorInherited(boolean acceleratorInherited)
void
setDescription(String string)
void
setDisabledIcon(Icon icon)
void
setDisabledIconInherited(boolean inherited)
void
setExtendsId(FaceId extendsId)
void
setHorizontalTextPosition(Integer position)
Sets the horizontal position for the text on this face.
void
setIcon(Icon icon)
void
setIconInherited(boolean iconInherited)
void
setIconTextGap(Integer gap)
void
setIconTextGapInherited(boolean inherited)
void
setLongDescription(String string)
void
setMenuTooltipEnabled(boolean menuTooltipEnabled)
void
setMnemonic(Integer mnemonic)
void
setMnemonicIndex(Integer mnemonicIndex)
Sets the mnemonic to use based on it character index in the string.
void
setPressedIcon(Icon icon)
void
setPressedIconInherited(boolean inherited)
void
setRolloverIcon(Icon icon)
void
setRolloverIconInherited(boolean inherited)
void
setRolloverSelectedIcon(Icon icon)
void
setRolloverSelectedIconInherited(boolean inherited)
void
setSelectedIcon(Icon selectedIcon)
void
setSelectedIconInherited(boolean selectedIconInherited)
void
setText(String string)
Sets the text for the face.
void
setTextInherited(boolean textInherited)
void
setVerticalTextPosition(Integer position)
Sets the vertical position for the text on this face.
String
toString()

Field Details

BUTTON

public static final String BUTTON

DEFAULT

public static final String DEFAULT

HTML

public static final String HTML

MENU

public static final String MENU

POPUP

public static final String POPUP

TOOLBAR

public static final String TOOLBAR

extendsId

protected FaceId extendsId

faceManager

protected FaceManager faceManager

pcs

protected PropertyChangeSupport pcs

Constructor Details

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 Details

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)

canExtend

public boolean canExtend(FaceId faceId)

getAccelerator

public KeyStroke getAccelerator()

getClientProperty

public String getClientProperty(String name)

getClientProperty

public String getClientProperty(String name,
                                String defaultValue)

getClientPropertyNames

public String[] getClientPropertyNames()

getDescription

public String getDescription()

getDisabledIcon

public Icon getDisabledIcon()

getExtendsId

public FaceId getExtendsId()

getHorizontalTextPosition

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

getIcon

public Icon getIcon()

getIconTextGap

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

getId

public FaceId getId()

getLongDescription

public String getLongDescription()

getMnemonic

public Integer getMnemonic()

getMnemonicIndex

public Integer getMnemonicIndex()

getName

public String getName()

getPressedIcon

public Icon getPressedIcon()

getRolloverIcon

public Icon getRolloverIcon()

getRolloverSelectedIcon

public Icon getRolloverSelectedIcon()

getSelectedIcon

public Icon getSelectedIcon()

getText

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

getVerticalTextPosition

public Integer getVerticalTextPosition()
Returns:
the vertical text position of the face.

isAcceleratorInherited

public boolean isAcceleratorInherited()

isDisabledIconInherited

public boolean isDisabledIconInherited()

isIconInherited

public boolean isIconInherited()

isIconTextGapInherited

public boolean isIconTextGapInherited()

isMenuTooltipEnabled

public boolean isMenuTooltipEnabled()

isNameEqualTo

public boolean isNameEqualTo(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.

isPressedIconInherited

public boolean isPressedIconInherited()

isRolloverIconInherited

public boolean isRolloverIconInherited()

isRolloverSelectedIconInherited

public boolean isRolloverSelectedIconInherited()

isSelectedIconInherited

public boolean isSelectedIconInherited()

notifyMenuTooltipDefaultChanged

protected void notifyMenuTooltipDefaultChanged(boolean newValue)

putClientProperty

public void putClientProperty(String name,
                              String value)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)

setAccelerator

public void setAccelerator(KeyStroke accelerator)

setAcceleratorInherited

public void setAcceleratorInherited(boolean acceleratorInherited)

setDescription

public void setDescription(String string)

setDisabledIcon

public void setDisabledIcon(Icon icon)

setDisabledIconInherited

public void setDisabledIconInherited(boolean inherited)

setExtendsId

public void setExtendsId(FaceId extendsId)

setHorizontalTextPosition

public void setHorizontalTextPosition(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.

setIcon

public void setIcon(Icon icon)

setIconInherited

public void setIconInherited(boolean iconInherited)

setIconTextGap

public void setIconTextGap(Integer gap)

setIconTextGapInherited

public void setIconTextGapInherited(boolean inherited)

setLongDescription

public void setLongDescription(String string)

setMenuTooltipEnabled

public void setMenuTooltipEnabled(boolean menuTooltipEnabled)

setMnemonic

public void setMnemonic(Integer mnemonic)

setMnemonicIndex

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

setPressedIcon

public void setPressedIcon(Icon icon)

setPressedIconInherited

public void setPressedIconInherited(boolean inherited)

setRolloverIcon

public void setRolloverIcon(Icon icon)

setRolloverIconInherited

public void setRolloverIconInherited(boolean inherited)

setRolloverSelectedIcon

public void setRolloverSelectedIcon(Icon icon)

setRolloverSelectedIconInherited

public void setRolloverSelectedIconInherited(boolean inherited)

setSelectedIcon

public void setSelectedIcon(Icon selectedIcon)

setSelectedIconInherited

public void setSelectedIconInherited(boolean selectedIconInherited)

setText

public void setText(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)

setVerticalTextPosition

public void setVerticalTextPosition(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.

toString

public String toString()