ice.ri.enhancedawt.iscl
Class SkinnableLabel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended byice.ri.enhancedawt.iscl.SkinnableLabel
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable, Skinnable

public class SkinnableLabel
extends Canvas
implements Skinnable

* A custom skinnable label. There is a single image associted with WTLabel, that can be either * * *

NOTE: this is a light weight component. if the parent of the WRButton is * not a WRPanel, there might be some flickering * @author Ofer Shai

See Also:
Serialized Form

Nested Class Summary
protected  class SkinnableLabel.LabelSkin
           
 
Nested classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String BACKGROUND_IMAGE
          * the file name for the disabled image - "background"
static int CENTER
          * indicates that the text of the label should be centered
static String DEFAULT_SKIN
           
static int LEFT
          * indicates that the text of the label should be on the left of the label
protected  Skin m_skin
          * the skin directory structure
protected  String m_skinName
           
static int RIGHT
          * indicates that the text of the label should be on the right of the label
static int STRETCH
          * the background image should be stretched to the size of the panel
static int TILE
          * the background image should be tiled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SkinnableLabel()
          * default constructor.
SkinnableLabel(Image p_background)
          * Creates a label with the specified background image * @param p_background the background image
SkinnableLabel(String text)
          * Creates a label with the specified text.
SkinnableLabel(String p_text, Image p_background)
          * Creates a label with the specified text and background image.
SkinnableLabel(String p_text, Image p_background, int p_alignment)
          * creates a label with the specified text, background image, and alignment * @param p_background the background image.
SkinnableLabel(String text, String skin)
          * Creates a label with the specified text and background.
SkinnableLabel(String text, String skin, int alignment)
          * creates a label with the specified text, background image, and alignment * @param p_background the path and name of the background image.
 
Method Summary
 int getAlignment()
          * gets the alignment of the text.
 int getDisplayMode()
          * @return an integer representing how the image is displayed * @see setDisplaymode
 int getIndent()
          * @return the indent in pixels of the label's text from its aligned edge.
 Dimension getPreferredSize()
          * gets the preferred size of the panel.
 String getSkin()
          * gets the directory structure that is used to look up the images.
 SkinManager getSkinManager()
           
 String getText()
          * @return the text currently displayed by the lable
 boolean isTransparent()
          * finds out if the label's background is transparent.
 void paint(Graphics g)
          * overriden method from Component.
 void setAlignment(int p_alignment)
          * set the alignment of the text of the label.
 void setDisplayMode(int p_newMode)
          * changes the way the background image is displayed * @param p_newMode the way the background image should be displayed.
 void setIndent(int p_indent)
          * sets the indent of the label's text from its aligned edge.
 void setPreferredSize(Dimension prefSize)
          * sets the preferred size of the component.
 void setSkin(String skinName)
          * Sets all the necessary images through a directory structure and predetermined names.
 void setSkinManager(SkinManager skinManager)
           
 void setText(String text)
          * changes the text the label is showing * @param p_text the new text to show on the label
 void setTransparent(boolean p_transparent)
          * sets the label's background to be transparent.
 void update(Graphics g)
          * overriden method from component
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
* indicates that the text of the label should be centered

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
* indicates that the text of the label should be on the right of the label

See Also:
Constant Field Values

LEFT

public static final int LEFT
* indicates that the text of the label should be on the left of the label

See Also:
Constant Field Values

STRETCH

public static final int STRETCH
* the background image should be stretched to the size of the panel

See Also:
Constant Field Values

TILE

public static final int TILE
* the background image should be tiled

See Also:
Constant Field Values

BACKGROUND_IMAGE

public static final String BACKGROUND_IMAGE
* the file name for the disabled image - "background"

See Also:
Constant Field Values

m_skin

protected Skin m_skin
* the skin directory structure


DEFAULT_SKIN

public static final String DEFAULT_SKIN
See Also:
Constant Field Values

m_skinName

protected String m_skinName
Constructor Detail

SkinnableLabel

public SkinnableLabel()
* default constructor.


SkinnableLabel

public SkinnableLabel(String text)
* Creates a label with the specified text. * @param p_text the text of the label.


SkinnableLabel

public SkinnableLabel(String text,
                      String skin)
* Creates a label with the specified text and background. * @param p_background the path and name of the background image. may be null * @param p_text the text to display


SkinnableLabel

public SkinnableLabel(String text,
                      String skin,
                      int alignment)
* creates a label with the specified text, background image, and alignment * @param p_background the path and name of the background image. * @param p_text the text to display * @param p_alignment the alignment of the label * @see setAlignment


SkinnableLabel

public SkinnableLabel(Image p_background)
* Creates a label with the specified background image * @param p_background the background image


SkinnableLabel

public SkinnableLabel(String p_text,
                      Image p_background)
* Creates a label with the specified text and background image. * @param p_text the text of the label. * @param p_background the background image


SkinnableLabel

public SkinnableLabel(String p_text,
                      Image p_background,
                      int p_alignment)
* creates a label with the specified text, background image, and alignment * @param p_background the background image. * @param p_text the text to display * @param p_alignment the alignment of the label * @see setAlignment

Method Detail

setSkinManager

public void setSkinManager(SkinManager skinManager)

getSkinManager

public SkinManager getSkinManager()

setSkin

public void setSkin(String skinName)
* Sets all the necessary images through a directory structure and predetermined names. * This method will look up the images through the string * "/images///.gif". * the image names can be looked up in under the protected fields. The images themselves are * loaded using PublicClassLoader. * @param skinName provides the directory structure in which to look for the images.

Specified by:
setSkin in interface Skinnable

getSkin

public String getSkin()
* gets the directory structure that is used to look up the images. * @return the directory structure used to look up the images.

Specified by:
getSkin in interface Skinnable

setAlignment

public void setAlignment(int p_alignment)
* set the alignment of the text of the label. * @param p_alignment can be WRLabel.RIGHT, WRLabel.LEFT, or WRLabel.CENTER


getAlignment

public int getAlignment()
* gets the alignment of the text. * @return WRLabel.RIGHT, WRLabel.LEFT, or WRLabel.CENTER.


setText

public void setText(String text)
* changes the text the label is showing * @param p_text the new text to show on the label


getText

public String getText()
* @return the text currently displayed by the lable


setDisplayMode

public void setDisplayMode(int p_newMode)
* changes the way the background image is displayed * @param p_newMode the way the background image should be displayed. should be one of * STRETCH, or TILE


getDisplayMode

public int getDisplayMode()
* @return an integer representing how the image is displayed * @see setDisplaymode


setTransparent

public void setTransparent(boolean p_transparent)
* sets the label's background to be transparent. * @param p_transparent true if the label should be transparent, false otherwise.


isTransparent

public boolean isTransparent()
* finds out if the label's background is transparent. * @return true if the label is transparent, false otherwise.


getPreferredSize

public Dimension getPreferredSize()
* gets the preferred size of the panel. If the preferred size has not been set otherwise, * then if there is a background image, the preferred size would be the dimensions of the * image. Otherwise it would be what is dictated by the layout manager. * @return the preferred size of the panel.


setPreferredSize

public void setPreferredSize(Dimension prefSize)
* sets the preferred size of the component. the method will also cause the component's * parent to be invalidated, thereby repainting and layout the component in its new preferred * size, if the button's parent's layout manager does so. * @param p_newSize the new size of the component


getIndent

public int getIndent()
* @return the indent in pixels of the label's text from its aligned edge.


setIndent

public void setIndent(int p_indent)
* sets the indent of the label's text from its aligned edge. * @param p_indent the indent in pixels


update

public void update(Graphics g)
* overriden method from component


paint

public void paint(Graphics g)
* overriden method from Component.