com.google.code.validationframework.swing.decoration
Class IconComponentDecoration

java.lang.Object
  extended by com.google.code.validationframework.swing.decoration.AbstractComponentDecoration
      extended by com.google.code.validationframework.swing.decoration.IconComponentDecoration
All Implemented Interfaces:
com.google.code.validationframework.api.common.Disposable

public class IconComponentDecoration
extends AbstractComponentDecoration

Component decoration showing an icon, possibly with a tooltip.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.code.validationframework.swing.decoration.AbstractComponentDecoration
AbstractComponentDecoration.DecorationPainter
 
Field Summary
static AnchorLink DEFAULT_ANCHOR_LINK_WITH_OWNER
          Default anchor link with the owner component on which the decorator will be attached.
 
Fields inherited from class com.google.code.validationframework.swing.decoration.AbstractComponentDecoration
decorationPainter
 
Constructor Summary
IconComponentDecoration(JComponent owner)
          Constructor specifying the component to be decorated.
IconComponentDecoration(JComponent owner, AnchorLink anchorLinkWithOwner)
          Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).
IconComponentDecoration(JComponent owner, AnchorLink anchorLinkWithOwner, Icon icon)
          Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).
IconComponentDecoration(JComponent owner, Icon icon)
          Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).
 
Method Summary
 void dispose()
           
 AnchorLink getAnchorLinkWithToolTip()
          Gets the anchor link used to slave the tooltip to this decoration.
protected  int getHeight()
          Returns the height of the decoration.
 Icon getIcon()
          Gets the decoration icon.
 String getToolTipText()
          Gets the text for the tooltip to be used on this decoration.
protected  int getWidth()
          Returns the width of the decoration.
 void paint(Graphics g)
          Paints the decoration in the specified graphics.
 void setAnchorLinkWithToolTip(AnchorLink anchorLinkWithToolTip)
          Sets the anchor link used to slave the tooltip to this decoration.
 void setIcon(Icon icon)
          Sets the decoration.
 void setToolTipText(String text)
          Sets the text for the tooltip to be used on this decoration.
 void setVisible(boolean visible)
          Sets the visibility of the decoration.
 
Methods inherited from class com.google.code.validationframework.swing.decoration.AbstractComponentDecoration
followAndRepaint, followDecoratedComponent, getAnchorLink, getClippingAncestor, getDecoratedComponent, isVisible, setAnchorLink, setClippingAncestor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ANCHOR_LINK_WITH_OWNER

public static final AnchorLink DEFAULT_ANCHOR_LINK_WITH_OWNER
Default anchor link with the owner component on which the decorator will be attached.

Constructor Detail

IconComponentDecoration

public IconComponentDecoration(JComponent owner)
Constructor specifying the component to be decorated.

Parameters:
owner - Component to be decorated.

IconComponentDecoration

public IconComponentDecoration(JComponent owner,
                               AnchorLink anchorLinkWithOwner)
Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).

Parameters:
owner - Component to be decorated.
anchorLinkWithOwner - Anchor link between the decorated component and the decoration icon.

IconComponentDecoration

public IconComponentDecoration(JComponent owner,
                               Icon icon)
Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).

Parameters:
owner - Component to be decorated.
icon - Decoration icon.

IconComponentDecoration

public IconComponentDecoration(JComponent owner,
                               AnchorLink anchorLinkWithOwner,
                               Icon icon)
Constructor specifying the component to be decorated and the anchor link with its owner (the decorated component).

Parameters:
owner - Component to be decorated.
anchorLinkWithOwner - Anchor link between the decorated component and the decoration icon.
icon - Decoration icon.
Method Detail

dispose

public void dispose()
Specified by:
dispose in interface com.google.code.validationframework.api.common.Disposable
Overrides:
dispose in class AbstractComponentDecoration
See Also:
AbstractComponentDecoration.dispose()

getIcon

public Icon getIcon()
Gets the decoration icon.

Returns:
Decoration icon attached to the owner component.

setIcon

public void setIcon(Icon icon)
Sets the decoration.

Parameters:
icon - Decoration icon to be attached to the owner component.

getToolTipText

public String getToolTipText()
Gets the text for the tooltip to be used on this decoration.

Returns:
Tooltip text for this decoration, or null.

setToolTipText

public void setToolTipText(String text)
Sets the text for the tooltip to be used on this decoration.

Parameters:
text - Tooltip text for this decoration, or null if this decoration should have no tooltip.

getAnchorLinkWithToolTip

public AnchorLink getAnchorLinkWithToolTip()
Gets the anchor link used to slave the tooltip to this decoration.

Returns:
Anchor link used to slave the tooltip to this decoration.

setAnchorLinkWithToolTip

public void setAnchorLinkWithToolTip(AnchorLink anchorLinkWithToolTip)
Sets the anchor link used to slave the tooltip to this decoration.

Parameters:
anchorLinkWithToolTip - Anchor link to be used to slave the tooltip to this decoration.

setVisible

public void setVisible(boolean visible)
Description copied from class: AbstractComponentDecoration
Sets the visibility of the decoration.

Overrides:
setVisible in class AbstractComponentDecoration
Parameters:
visible - True to make the decoration visible, false to make it invisible.
See Also:
AbstractComponentDecoration.setVisible(boolean)

getWidth

protected int getWidth()
Description copied from class: AbstractComponentDecoration
Returns the width of the decoration.

Specified by:
getWidth in class AbstractComponentDecoration
Returns:
Unclipped width of the decoration.
See Also:
AbstractComponentDecoration.getWidth()

getHeight

protected int getHeight()
Description copied from class: AbstractComponentDecoration
Returns the height of the decoration.

Specified by:
getHeight in class AbstractComponentDecoration
Returns:
Unclipped height of the decoration.
See Also:
AbstractComponentDecoration.getHeight()

paint

public void paint(Graphics g)
Description copied from class: AbstractComponentDecoration
Paints the decoration in the specified graphics.

Specified by:
paint in class AbstractComponentDecoration
Parameters:
g - Graphics to paint the decoration to.
See Also:
AbstractComponentDecoration.paint(Graphics)


Copyright © 2013. All Rights Reserved.