|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.yospace.yae.yogi.YogiComponent
YogiComponent is a general-purpose component class, designed to manage focus, events, location, painting, and the delegation of core functions to a UI delegate. A YogiComponent may have child components, and thus fulfills the role of a Container in a containment hierarchy. It can also act as a focus-domain root, which allows its descendents to remember the current focus even when the focus-domain root is not focussed.
All YogiComponents expect to own or share a UI delegate, which is a
subclass of ComponentUI. This object
represents the visible, active part of the component, and is responsible for the
appearance and event handling. Thus, as with Java's Swing package, the YogiComponent
only represents the Model of the component, while the pluggable ComponentUI represents
its View.
The choice of the UI is determined by the
UIManager instance that is
currently installed in the Toolkit.
A new component can be created by building a subclass of YogiComponent to hold any new state information, and then implementing the look and feel by creating a subclass of ComponentUI. The UI should normally be registered with the UIManager.
| Field Summary | |
static int |
ALIGN_CENTER
Alignment constant used for setting center alignment in some components, such as YogiLabel. |
static int |
ALIGN_LEFT
Alignment constant used for setting left alignment in some components, such as YogiLabel. |
static int |
ALIGN_RIGHT
Alignment constants used for setting right alignment in some components, such as YogiLabel. |
static int |
BORDER_DOTTED
A border-style constant representing a dotted border in the current border color. |
static int |
BORDER_NONE
A border-style constant representing "no border". |
static int |
BORDER_PLAIN
A border-style constant representing a simple border line in the current background color. |
static int |
BORDER_ROUNDED
A border-style constant representing a round cornered border in the current border color. |
static int |
BORDER_SOLID
A border-style constant representing a simple border line in the current border color. |
static int |
COLOR_BACKGROUND
Color-type constant used for setting and retrieving the background color, typically used for filling the space behind the detail of this component. |
static int |
COLOR_BORDER
Color-type constants used for setting and retrieving the border color when borders are enabled. |
static int |
COLOR_FOREGROUND
Color-type constant used for setting and retrieving the foreground color, typically used for coloring text or other details. |
static int |
FOCUS_DEFAULT
A focus-type constant - indicates that this component should use the focus traversability state as indicated by its UI delegate. |
static int |
FOCUS_OFF
A focus-type constant - indicates that this component should not be focus traversable. |
static int |
FOCUS_ON
A focus-type constant - indicates that this component should be focus traversable. |
static int |
PROPERTY_ALIGN
Constant for the alignment property |
static int |
PROPERTY_BORDER_STYLE
Constant for the border style property |
static int |
PROPERTY_BOUNDS
Constant for the bounds property |
static int |
PROPERTY_COLOR
Constant for the color property |
static int |
PROPERTY_CONTEXT_ENABLED
Constant for the context enabled property |
static int |
PROPERTY_ENABLED
Constant for the enabled property |
static int |
PROPERTY_FOCUS
Constant for the focus property |
static int |
PROPERTY_FOCUS_INDEX
Constant for the focus index property |
static int |
PROPERTY_FOCUS_TRAVERSABLE
Constant for the focus traversability property |
static int |
PROPERTY_FONT
Constant for the font property |
static int |
PROPERTY_HOTKEY
Constant for the hotkey property |
static int |
PROPERTY_LOCATION
Constant for the location property |
static int |
PROPERTY_OPAQUE
Constant for the opaque property |
static int |
PROPERTY_SIZE
Constant for the size property |
static int |
PROPERTY_VISIBLE
Constant for the visibility property |
static int |
PROPERTY_X_INSET
Constant for the x inset property |
static int |
PROPERTY_Y_INSET
Constant for the y inset property |
| Constructor Summary | |
YogiComponent()
Default constructor does nothing. |
|
| Method Summary | |
void |
_debugPrintComponents()
|
void |
add(YogiComponent comp)
Add a component to this container. |
void |
addPropertyChangeListener(PropertyChangeListener newPcl)
Adds a listener for any of the various property change events that components can produce. |
void |
bringForwards(YogiComponent c)
This method moves the given component one position forwards in the child component's pile. |
void |
bringInFrontOf(YogiComponent firstComp,
YogiComponent secondComp)
This method moves the first component one position to the front of the second component. |
void |
bringToFront(YogiComponent c)
This method puts the given component on top of the child components pile. |
boolean |
contains(int xp,
int yp)
Detects whether the specified location is within our bounds. |
boolean |
containsComponent(YogiComponent c)
Finds whether the given component is contained, at some level in the component hierarchy, by this one. |
void |
ensureVisible(int fx,
int fy,
int fw,
int fh)
Ensures that the specified area of this component is visible, where possible. |
protected void |
ensureVisible(YogiComponent child,
int fx,
int fy,
int fw,
int fh)
Ensures that the specified area of this component is visible, where possible; if there is a choice (perhaps because this component supports layers), then the supplied child component is the one that should be shown. |
YogiComponent |
findComponentAt(int xp,
int yp)
Searches the component hierarchy for the component that contains the specified point relative to this component. |
static YogiComponent |
findCurrentFocus(YogiComponent fdRoot,
boolean recurse)
Searches below fdRoot (which must be a focus-domain root) and locates the current focussed component. |
static YogiComponent |
findFirstFocus(YogiComponent fdRoot,
int distance)
Locates the first (or distanceth) focusable component on from this one within this
focus-domain. |
YogiComponent |
findFocusDomainRoot(YogiRootWindow key)
This method locates this component's closest focus-domain root component. |
protected YogiComponent |
findFocusDomainRootImpl()
|
YogiComponent |
findHotkeyComponent(int key)
If this component is a focus-domain root, this method will search the focusable children for one with the specified hotkey. |
static YogiComponent |
findNextFocus(YogiComponent fdRoot,
int distance)
Locates the distanceth focusable component within the focus-domain owned by fdRoot, relative
to the currently focussed item. |
void |
fireActionPerformedEvent()
This method fires an action event to the action listener (if any). |
void |
firePropertyChangeEvent(int propertyCode)
This method is used to send a notification to any registered PropertyChangeListeners to say that the specified
property has changed. |
int |
getAlign()
Gets the current alignment. |
int |
getBorderStyle()
Gets the current border style for the component. |
Rectangle |
getBounds()
Gets a Rectangle representing this component's bounds relative to the parent's coordinate space. |
int |
getColor(int index)
For the given index in the color set, returns the relevant color value. |
java.lang.String |
getColors()
Utility method which concatenates the currently set colors in this component into a readable, ';'-separated string. |
YogiComponent |
getComponent(int n)
Finds the nth immediate child of this one. |
YogiComponent |
getComponent(java.lang.String id)
Gets the descendant component whose id is equal to the supplied string. |
int |
getComponentCount()
Returns the number of child components associated with this component. |
int |
getComponentIndex(YogiComponent yc)
Finds the index of the given component within this component's child list. |
YogiComponent[] |
getComponents()
Creates an array of all of the immediate children of this component. |
Rectangle |
getFocusBounds()
This method returns the bounding region of this component that, if possible, would most prefer to be visible. |
int |
getFocusIndex()
Gets the focus index of the current component. |
Font |
getFont()
Gets the current font for the component. |
Point |
getGlobalLocation()
Calculates the location of this component on the root window. |
int |
getHeight()
Gets the number of pixels representing the component's height. |
int |
getHotkey()
Determines the current hotkey associated with this component. |
java.lang.String |
getId()
Returns the component's ID string. |
YogiComponent |
getParent()
Gets the parent container of the component. |
YogiComponent |
getParent(YogiRootWindow key)
Gets the parent container of the component if the key is not null. |
java.lang.Object |
getTreeLock()
Returns the synchronizable Object which is used as the tree lock. |
ComponentUI |
getUI()
Gets the UI delegate component associated with this component. |
int |
getWidth()
Gets the number of pixels representing the component's width. |
int |
getX()
Gets the number of pixels from the left edge of this component's parent to its own left edge. |
int |
getXInset()
Returns the horizontal inset for this component. |
int |
getY()
Gets the number of pixels from the top edge of this component's parent to its own top edge. |
int |
getYInset()
Returns the vertical inset for this component. |
boolean |
hasFocus(boolean global)
Tests whether this component has the focus. |
boolean |
isActive()
Determines whether this component is "active". |
boolean |
isContextEnabled()
Determines the "contextEnabled" state, which is true if and only if the component's ancestors are all enabled. |
boolean |
isEnabled()
Determines whether this component is interested in receiving events. |
boolean |
isFocusDomainRoot()
Tests whether this component is a focus-domain root |
boolean |
isFocusTraversable()
Returns the focus traversability of this component. |
boolean |
isOpaque()
Determines whether the component is opaque or transparent. |
boolean |
isVisible()
Determines whether this component has been set to be visible. |
boolean |
keyPressed(YogiComponent source,
int keyCode)
The keyPressed method is called when a key pressed event is detected
and this component has the focus. |
boolean |
keyReleased(YogiComponent source,
int keyCode)
The keyReleased method is called when a key released event is detected
and this component has the focus. |
boolean |
keyRepeated(YogiComponent source,
int keyCode)
The keyRepeated method is called when a key repeated event is detected
and this component has the focus. |
void |
paint(Graphics g,
Rectangle damage)
This method causes this component and all of its children to be checked for painting. |
void |
paintBackground(Graphics g)
This method paints the component's background for opaque components. |
void |
paintBorder(Graphics g)
This method paints the component's border. |
void |
paintForeground(Graphics g)
This method paints the component's foreground. |
boolean |
pointerDragged(YogiComponent source,
int x,
int y)
The pointerDragged method is called when a pointer dragged event is detected. |
boolean |
pointerPressed(YogiComponent source,
int x,
int y)
The pointerPressed method is called when a pointer pressed event is detected. |
boolean |
pointerReleased(YogiComponent source,
int x,
int y)
The pointerReleased method is called when a pointer released event is detected. |
void |
remove(int index)
Remove the indexth component from this container. |
void |
remove(YogiComponent comp)
Remove a component from this container. |
void |
removeAll()
Removes all child components from this YogiComponent |
void |
removePropertyChangeListener(PropertyChangeListener oldPcl)
This method removes a PropertyChangeListener that may have been
registered previously. |
void |
repaint()
Marks this component as needing repainting. |
void |
repaint(int px,
int py,
int pWidth,
int pHeight)
This method marks the supplied region of this component as needing repainting. |
protected void |
repaintAfterRebounding(int oldX,
int oldY,
int oldWidth,
int oldHeight,
boolean mustRepaint)
Utility method for ensuring that a component's parent is properly repainted after any operation that may have exposed some part of it. |
boolean |
requestFocus()
Allows a component to request the focus of its focus-domain. |
boolean |
requestFocus(boolean global)
Allows a component to request the focus, either of its immediate focus-domain alone, or of the entire component hierarchy. |
void |
sendBackwards(YogiComponent c)
This method moves the given component one position backwards in the child components pile. |
void |
sendBehind(YogiComponent firstComp,
YogiComponent secondComp)
This method moves the first component to one position behind the second component. |
void |
sendToBack(YogiComponent c)
This method sends the given component to the bottom of the child components pile. |
void |
setActionListener(ActionListener actionListener)
Sets the ActionListener on the component. |
void |
setActive(boolean newActive)
Sets the "activity" state of the component. |
void |
setAlign(int align)
Sets the alignment currently associated with this component. |
void |
setBorderStyle(int style)
Set the style for the border of the component. |
void |
setBounds(int newX,
int newY,
int newWidth,
int newHeight)
Moves and resizes this component. |
void |
setColor(int index,
int newColor)
Sets the color value for the color associated with the given index. |
void |
setColors(java.lang.String colors)
Takes a semicolon-delimited list of colors (in String representation) and sets the corresponding elements in this component's colors set accordingly. |
void |
setContextEnabled(boolean newContextEnabled)
Forceably sets the contextEnabled flag for the current component. |
void |
setDefaultColor(int index)
This method resets the indexth color back to the UI delegate's default
value. |
void |
setEnabled(boolean newEnabled)
Sets this component's "enabled" state. |
void |
setFocusDomainRoot(boolean fd)
Configures whether this component is a focus-domain root. |
void |
setFocusIndex(int newIndex)
Sets this component's focus index. |
void |
setFocusTraversable(int newState)
Sets the focus-traversability of this component. |
void |
setFont(Font font)
Sets the current font to be used by this component. |
void |
setHotkey(int newKey)
Sets the hotkey to be associated with this component. |
void |
setId(java.lang.String id)
Sets the component's ID string. |
void |
setLocation(int newX,
int newY)
Sets the new (x, y) location of this component, relative to its parent. |
static boolean |
setNoFocus(YogiComponent fdRoot)
This method sets the focus-domain fdRoot to have no current focus. |
void |
setOpaque(boolean opaque)
Sets the opacity of this component. |
boolean |
setProperty(java.lang.String propertyName,
java.lang.String value)
The setProperty method is the top-level method for setting any
component property for a YoBean. |
void |
setSize(int newWidth,
int newHeight)
Sets the width and height of this component. |
void |
setUI(ComponentUI newUI)
Set this component's UI delegate. |
void |
setVisible(boolean newVisible)
Sets the visibility of this component. |
void |
setXInset(int xInset)
Sets the horizontal inset for this component. |
void |
setYInset(int yInset)
Sets the vertical inset for this component. |
protected void |
updateUI()
Sets the component's UI delegate based on the defaults set up for the current device type etc. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PROPERTY_ALIGN
public static final int PROPERTY_BORDER_STYLE
public static final int PROPERTY_BOUNDS
public static final int PROPERTY_COLOR
public static final int PROPERTY_CONTEXT_ENABLED
public static final int PROPERTY_ENABLED
public static final int PROPERTY_FOCUS
public static final int PROPERTY_FOCUS_INDEX
public static final int PROPERTY_FOCUS_TRAVERSABLE
public static final int PROPERTY_FONT
public static final int PROPERTY_HOTKEY
public static final int PROPERTY_LOCATION
public static final int PROPERTY_OPAQUE
public static final int PROPERTY_SIZE
public static final int PROPERTY_VISIBLE
public static final int PROPERTY_X_INSET
public static final int PROPERTY_Y_INSET
public static final int ALIGN_CENTER
YogiLabel.setAlign(int),
getAlign()public static final int ALIGN_LEFT
YogiLabel.setAlign(int),
getAlign()public static final int ALIGN_RIGHT
YogiLabel.setAlign(int),
getAlign()public static final int COLOR_BACKGROUND
setColor(int,int),
getColor(int)public static final int COLOR_FOREGROUND
setColor(int,int),
getColor(int)public static final int COLOR_BORDER
setColor(int,int),
getColor(int),
setBorderStyle(int)public static final int BORDER_NONE
setBorderStyle(int),
getBorderStyle()public static final int BORDER_PLAIN
setBorderStyle(int),
getBorderStyle()public static final int BORDER_SOLID
setBorderStyle(int),
getBorderStyle()public static final int BORDER_DOTTED
setBorderStyle(int),
getBorderStyle()public static final int BORDER_ROUNDED
setBorderStyle(int),
getBorderStyle()public static final int FOCUS_DEFAULT
setFocusTraversable(int),
isFocusTraversable()public static final int FOCUS_OFF
setFocusTraversable(int),
isFocusTraversable()public static final int FOCUS_ON
setFocusTraversable(int),
isFocusTraversable()| Constructor Detail |
public YogiComponent()
| Method Detail |
public java.lang.Object getTreeLock()
public final Point getGlobalLocation()
public final boolean contains(int xp,
int yp)
xp - the x coordinate of the point being testedyp - the y coordinate of the point being testedComponentUI.contains(com.yospace.yae.yogi.YogiComponent,int,int)
public final YogiComponent findComponentAt(int xp,
int yp)
xp - the x coordinate of a point in this component's coordinate spaceyp - the y coordinate of a point in this component's coordinate spacecontains(int,int)public int getX()
public int getY()
public final int getWidth()
ComponentUI.getDefaultWidth(com.yospace.yae.yogi.YogiComponent),
setSize(int,int)public final int getHeight()
ComponentUI.getDefaultHeight(com.yospace.yae.yogi.YogiComponent),
setSize(int,int)public Rectangle getBounds()
getX(),
getY(),
getWidth(),
getHeight()
public void setBounds(int newX,
int newY,
int newWidth,
int newHeight)
This method fires a PROPERTY_BOUNDS change event if the values change.
newX - the desired x value.newY - the desired y value.newWidth - the desired width, or -1 to restore to UI defaults.newHeight - the desired height, or -1 to restore to UI defaults.
public void setSize(int newWidth,
int newHeight)
This method fires a PROPERTY_SIZE change event if the value changes.
newWidth - the new width in pixels, or -1 to restore to UI defaults.newHeight - the new height in pixels, or -1 to restore to UI defaults.
public void setLocation(int newX,
int newY)
This method fires a PROPERTY_LOCATION change event if the value changes.
newX - the new x location in pixelsnewY - the new y location in pixelspublic int getAlign()
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHTpublic void setAlign(int align)
This method fires a PROPERTY_ALIGN change event if the value changes
align - the required alignment: one of
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHTpublic int getXInset()
ComponentUI.getDefaultXInset(com.yospace.yae.yogi.YogiComponent),
paintForeground(com.yospace.yae.yogi.Graphics),
getYInset()public int getYInset()
ComponentUI.getDefaultYInset(com.yospace.yae.yogi.YogiComponent),
paintForeground(com.yospace.yae.yogi.Graphics),
getXInset()public void setXInset(int xInset)
This method fires a PROPERTY_X_INSET change event if the value changes
xInset - the new horizontal inset value, or -1 to restore to UI delegate's default
value.ComponentUI.getDefaultXInset(com.yospace.yae.yogi.YogiComponent),
paintForeground(com.yospace.yae.yogi.Graphics),
setYInset(int),
getXInset()public void setYInset(int yInset)
This method fires a PROPERTY_X_INSET change event if the value changes
yInset - the new vertical inset value, or -1 to restore to UI delegate's default
value.ComponentUI.getDefaultXInset(com.yospace.yae.yogi.YogiComponent),
paintForeground(com.yospace.yae.yogi.Graphics),
setXInset(int),
getYInset()public final java.lang.String getId()
getComponent(java.lang.String),
setId(java.lang.String)public final void setId(java.lang.String id)
id - the new ID string, or nullgetComponent(java.lang.String),
getId()public final boolean isVisible()
setVisible(boolean)public final void setVisible(boolean newVisible)
This method fires a PROPERTY_VISIBLE change event if the value changes.
newVisible - the desired visibility of the component.isVisible()public final boolean isEnabled()
setEnabled(boolean)public final boolean isContextEnabled()
public final void setEnabled(boolean newEnabled)
This method fires a PROPERTY_ENABLED change event if the value changes.
newEnabled - the desired enablement state.isEnabled()public final void setContextEnabled(boolean newContextEnabled)
newContextEnabled - the desired state setting.isContextEnabled()public boolean isOpaque()
setOpaque(boolean)public void setOpaque(boolean opaque)
This method fires a PROPERTY_OPAQUE change event if the value changes.
opaque - the desired opacity of the component.isOpaque()public Font getFont()
ComponentUI.getDefaultFont(com.yospace.yae.yogi.YogiComponent),
setFont(com.yospace.yae.yogi.Font)public void setFont(Font font)
This method fires a PROPERTY_FONT change event if the value changes.
font - the new font to be used, or null to restore to the UI delegate's default font.ComponentUI.getDefaultFont(com.yospace.yae.yogi.YogiComponent),
getFont()public int getBorderStyle()
BORDER_NONE,
BORDER_PLAIN,
BORDER_SOLID,
BORDER_DOTTED,
BORDER_ROUNDEDComponentUI.getDefaultBorderStyle(com.yospace.yae.yogi.YogiComponent)public void setBorderStyle(int style)
BORDER_NONE,
BORDER_PLAIN,
BORDER_SOLID,
BORDER_DOTTED,
BORDER_ROUNDED.
This method fires a PROPERTY_BORDER_STYLE change event if the value changes.
style - the desired style for the border of the component, or -1 to
restore to UI delegate's default style.ComponentUI.getDefaultBorderStyle(com.yospace.yae.yogi.YogiComponent),
getBorderStyle()public ComponentUI getUI()
public void setUI(ComponentUI newUI)
newUI - the new UI delegate to be used - cannot be nullprotected void updateUI()
public void sendToBack(YogiComponent c)
c - the (child) component to be moved. If it is not an immediate child
of this component, then the method does nothing.public void bringToFront(YogiComponent c)
c - the (child) component to be moved. If it is not an immediate child
of this component, then the method does nothing.public void sendBackwards(YogiComponent c)
c - the (child) component to be moved. If it is not an immediate child
of this component, then the method does nothing.public void bringForwards(YogiComponent c)
c - the (child) component to be moved. If it is not an immediate child
of this component, then the method does nothing.
public void bringInFrontOf(YogiComponent firstComp,
YogiComponent secondComp)
firstComp - the (child) component to be moved.secondComp - the (child) component that the firstComp
should be moved ahead of in the z-ordering.
public void sendBehind(YogiComponent firstComp,
YogiComponent secondComp)
firstComp - the (child) component to be moved.secondComp - the (child) component that the firstComp
should be moved behind in the z-ordering.public YogiComponent getParent()
public final YogiComponent getParent(YogiRootWindow key)
key - the key (the unique YogiRootWindow Object).
public final YogiComponent getComponent(java.lang.String id)
throws java.lang.Exception
id - the ID to search for.java.lang.Exception - if no matching component is foundpublic final boolean containsComponent(YogiComponent c)
c - the component to find.public YogiComponent getComponent(int n)
nth immediate child of this one.n - the index of the child to be returnednth child component, or null if n is
out of range.public int getComponentIndex(YogiComponent yc)
yc - the component to find, or null.public int getComponentCount()
public void add(YogiComponent comp)
comp - the component to add.IllegalStateException - if the component comp already
has a parent.public void remove(YogiComponent comp)
comp - the component to remove. If the component
is not registered as a child, calls to this method have
no effect.public void remove(int index)
indexth component from this container.index - the index of the component to remove. If the component
index is out of range, calls to this method have no effect.public YogiComponent[] getComponents()
YogiComponents that have been added to this one.public void removeAll()
YogiComponentpublic void _debugPrintComponents()
public int getColor(int index)
index - the index in the color set to be returned. Should be one of
COLOR_BACKGROUND, COLOR_FOREGROUND or COLOR_BORDER, or
some sub-component specific value.ArrayIndexOutOfBoundsException - if the index is out of range for this componentIllegalStateException - if there is no associated UI for this component, and
a color index is requested that has not been set.public void setDefaultColor(int index)
indexth color back to the UI delegate's default
value.index - the color to be reset. Should be one of
COLOR_BACKGROUND, COLOR_FOREGROUND or COLOR_BORDER, or
some sub-component specific value.
public void setColor(int index,
int newColor)
This method fires a PROPERTY_COLOR change event if the value changes
index - the index number in the color array. Must be in the range 0 to 31.newColor - the color that that index should be set to.public void setColors(java.lang.String colors)
"red;green;;blue" will cause element 0 of the
color set to have the it's value set to ColorUtil.parseColor("red");
i.e. the integer representation of the color red. Similarly, element 1 of the color
set will be set to the numeric equivalent of the color "green". The numeric equivalent
of the color "blue" will be placed in element 3 of the color set, not element
2 as the double semicolon in the input string indicates that we should skip element
2 and move on to setting element 3.
The set of acceptable colors is defined in the ColorUtil
class.
colors - the String representation, including semicolon delimiters, of the values that
should be entered into the colors set.public final java.lang.String getColors()
The returned string has no trailing ';' chars, and will return an empty string
if there are no set colors. The color strings are those known about by the
ColorUtil class, so unknown
colors will appear as 0x-hexdigit strings.
public boolean setProperty(java.lang.String propertyName,
java.lang.String value)
setProperty method is the top-level method for setting any
component property for a YoBean. If extending a component and adding any new
set methods which set a new component property then this method
should be overridden. However, super.setProperty should always
be called first, before dealing with any new properties. For example:
public boolean setProperty(String propertyName, String value)
{
boolean success = super.setProperty(propertyName, value);
if (!success)
{
if (propertyName.equals(PROPERTY_TEXT))
{
setText(value);
success = true;
}
else if (propertyName.equals(PROPERTY_IMAGE))
{
setImage(value);
success = true;
}
else if (propertyName.equals(PROPERTY_TEXT_PLACEMENT))
{
setTextOnRight("right".equals(value));
success = true;
}
}
return success;
}
Where possible, use the PROPERTY_XXXX constants for the propertyName parameter,
as they dramatically improve the efficiency of this method. This method is a stub for YoBeans to extend and
should not be used for core YogiComponents.
propertyName - the code of the property to be setvalue - the new value as a Stringpublic void addPropertyChangeListener(PropertyChangeListener newPcl)
newPcl - the property change listener to be added. If it is already a listener,
then this method does nothing.public void removePropertyChangeListener(PropertyChangeListener oldPcl)
PropertyChangeListener that may have been
registered previously. If no such listener was registered, then this method does
nothing.oldPcl - the listener to be removed.public void firePropertyChangeEvent(int propertyCode)
PropertyChangeListeners to say that the specified
property has changed.propertyCode - the code for the property that has changed. For maximum efficiency, this should
be one of the PROPERTY_XXXXX constants.public void setActionListener(ActionListener actionListener)
YogiComponent provides a single reference to
a ActionListener, which can be notified when actions take place.actionListener - the new actionListener, or null (to unset it).fireActionPerformedEvent()public void fireActionPerformedEvent()
setActionListener(com.yospace.yae.yogi.ActionListener)
public boolean keyPressed(YogiComponent source,
int keyCode)
keyPressed method is called when a key pressed event is detected
and this component has the focus. Usually, event detection is performed
by the component's UI delegate, so this method should only be overridden for
very obscure, non-UI specific event handling.
The default implementation of this method in YogiComponent returns false.
source - the component that was in focus at the time of the event. This is almost
certainly "this" component; however, more elaborate Focus Managers may deviate from this.keyCode - the key that was pressed
public boolean keyRepeated(YogiComponent source,
int keyCode)
keyRepeated method is called when a key repeated event is detected
and this component has the focus. Usually, event detection is performed
by the component's UI delegate, so this method should only be overridden for
very obscure, non-UI specific event handling.
The default implementation of this method in YogiComponent returns false.
source - the component that was in focus at the time of the event. This is almost
certainly "this" component; however, more elaborate Focus Managers may deviate from this.keyCode - the key that was repeated
public boolean keyReleased(YogiComponent source,
int keyCode)
keyReleased method is called when a key released event is detected
and this component has the focus. Usually, event detection is performed
by the component's UI delegate, so this method should only be overridden for
very obscure, non-UI specific event handling.
The default implementation of this method in YogiComponent returns false.
source - the component that was in focus at the time of the event. This is almost
certainly "this" component; however, more elaborate Focus Managers may deviate from this.keyCode - the key that was released
public boolean pointerPressed(YogiComponent source,
int x,
int y)
pointerPressed method is called when a pointer pressed event is detected.
Usually, event detection is performed
by the component's UI delegate, so this method should only be overridden for
very obscure, non-UI specific event handling.
The default implementation of this method in YogiComponent returns false.
source - the component that was under the pointer. This is almost
certainly "this" component; however, more elaborate Focus Managers may deviate from this.x - the x coordinate of the pointer press, in this component's coordinate space.y - the y coordinate of the pointer p