com.yospace.yae.yogi
Class YogiLabel

java.lang.Object
  |
  +--com.yospace.yae.yogi.YogiComponent
        |
        +--com.yospace.yae.yogi.YogiImageComponent
              |
              +--com.yospace.yae.yogi.YogiLabel
All Implemented Interfaces:
RendererFactory
Direct Known Subclasses:
AbstractMenu, YogiButton, YogiTextArea

public class YogiLabel
extends YogiImageComponent
implements RendererFactory

A basic graphical label component which has a text value (which can be aligned using the alignment values in YogiComponent), and an image (inheritted from YogiImageComponent). It then uses a corresponding UI which draws the text and image inside a graphical label.


Field Summary
static int PROPERTY_TEXT
          Constant for the text property
static int PROPERTY_TEXT_PLACEMENT
          Constant for the text placement property
 
Fields inherited from class com.yospace.yae.yogi.YogiImageComponent
PROPERTY_IMAGE
 
Fields inherited from class com.yospace.yae.yogi.YogiComponent
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, BORDER_DOTTED, BORDER_NONE, BORDER_PLAIN, BORDER_ROUNDED, BORDER_SOLID, COLOR_BACKGROUND, COLOR_BORDER, COLOR_FOREGROUND, FOCUS_DEFAULT, FOCUS_OFF, FOCUS_ON, PROPERTY_ALIGN, PROPERTY_BORDER_STYLE, PROPERTY_BOUNDS, PROPERTY_COLOR, PROPERTY_CONTEXT_ENABLED, PROPERTY_ENABLED, PROPERTY_FOCUS, PROPERTY_FOCUS_INDEX, PROPERTY_FOCUS_TRAVERSABLE, PROPERTY_FONT, PROPERTY_HOTKEY, PROPERTY_LOCATION, PROPERTY_OPAQUE, PROPERTY_SIZE, PROPERTY_VISIBLE, PROPERTY_X_INSET, PROPERTY_Y_INSET
 
Constructor Summary
YogiLabel()
          Default constructor sets up basic default model with the image and text both set to null.
YogiLabel(java.lang.String text, Image image)
          Create a YogiLabel with the given text and image.
 
Method Summary
 YogiComponent getCellRendererComponent(AbstractTable table, java.lang.Object value, boolean isSelected, boolean cellHasFocus)
          Provided to implement the RendererFactory interface.
 java.lang.String getText()
          Get the displayable text currently associated with the YogiLabel.
 boolean isTextOnRight()
          Returns whether the ordering is image then text.
 void setText(java.lang.String newText)
          Set the displayable text currently associated with the YogiLabel.
protected  void setTextImpl(java.lang.String newText)
          Implementation method for setting the text - note that setText() may be overridden by subclasses.
 void setTextOnRight(boolean textOnRight)
          Sets the left-to-right ordering of the text and image.
 
Methods inherited from class com.yospace.yae.yogi.YogiImageComponent
getImage, getImageName, setImage, setImage
 
Methods inherited from class com.yospace.yae.yogi.YogiComponent
_debugPrintComponents, add, addPropertyChangeListener, bringForwards, bringInFrontOf, bringToFront, contains, containsComponent, ensureVisible, ensureVisible, findComponentAt, findCurrentFocus, findFirstFocus, findFocusDomainRoot, findFocusDomainRootImpl, findHotkeyComponent, findNextFocus, fireActionPerformedEvent, firePropertyChangeEvent, getAlign, getBorderStyle, getBounds, getColor, getColors, getComponent, getComponent, getComponentCount, getComponentIndex, getComponents, getFocusBounds, getFocusIndex, getFont, getGlobalLocation, getHeight, getHotkey, getId, getParent, getParent, getTreeLock, getUI, getWidth, getX, getXInset, getY, getYInset, hasFocus, isActive, isContextEnabled, isEnabled, isFocusDomainRoot, isFocusTraversable, isOpaque, isVisible, keyPressed, keyReleased, keyRepeated, paint, paintBackground, paintBorder, paintForeground, pointerDragged, pointerPressed, pointerReleased, remove, remove, removeAll, removePropertyChangeListener, repaint, repaint, repaintAfterRebounding, requestFocus, requestFocus, sendBackwards, sendBehind, sendToBack, setActionListener, setActive, setAlign, setBorderStyle, setBounds, setColor, setColors, setContextEnabled, setDefaultColor, setEnabled, setFocusDomainRoot, setFocusIndex, setFocusTraversable, setFont, setHotkey, setId, setLocation, setNoFocus, setOpaque, setProperty, setSize, setUI, setVisible, setXInset, setYInset, updateUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_TEXT

public static final int PROPERTY_TEXT
Constant for the text property

PROPERTY_TEXT_PLACEMENT

public static final int PROPERTY_TEXT_PLACEMENT
Constant for the text placement property
Constructor Detail

YogiLabel

public YogiLabel()
Default constructor sets up basic default model with the image and text both set to null.

YogiLabel

public YogiLabel(java.lang.String text,
                 Image image)
Create a YogiLabel with the given text and image.
Parameters:
text - the text to be displayed.
image - the Image to be displayed.
Method Detail

getText

public java.lang.String getText()
Get the displayable text currently associated with the YogiLabel.
Returns:
the current text that the YogiLabel contains.

setText

public void setText(java.lang.String newText)
Set the displayable text currently associated with the YogiLabel. Calls repaint as default if the text has changed.
Parameters:
newText - the desired text for this label. Must not be null.

setTextImpl

protected final void setTextImpl(java.lang.String newText)
Implementation method for setting the text - note that setText() may be overridden by subclasses. Set the displayable text currently associated with the YogiLabel. Calls repaint as default if the text has changed.
Parameters:
newText - the desired text for this label. Must not be null.

setTextOnRight

public void setTextOnRight(boolean textOnRight)
Sets the left-to-right ordering of the text and image.

If the value changes, the component is repainted and a PROPERTY_TEXT_PLACEMENT change event is fired.

Parameters:
textOnRight - if true then the order will be image then text, else it will be text then image.

isTextOnRight

public boolean isTextOnRight()
Returns whether the ordering is image then text.
Returns:
true if the order is image then text, else false.

getCellRendererComponent

public YogiComponent getCellRendererComponent(AbstractTable table,
                                              java.lang.Object value,
                                              boolean isSelected,
                                              boolean cellHasFocus)
Provided to implement the RendererFactory interface. Returns a YogiLabel customised to the arguments passed from the AbstractTable subclass.
Specified by:
getCellRendererComponent in interface RendererFactory
Overrides:
getCellRendererComponent in class YogiImageComponent
Parameters:
table - The table for which the check box is rendering.
value - The object to be custom rendererd.
isSelected - The selected state of the object to be custom rendererd.
cellHasFocus - The focus state of the object to be custom rendererd.
Returns:
the custom rendered YogiLabel.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.