gumbo.visualize.data.client
Class ClientLabelGraphic

java.lang.Object
  |
  +--gumbo.visualize.data.client.ClientLabelGraphic
All Implemented Interfaces:
DataModelListener, Graphic, LabelGraphic

public class ClientLabelGraphic
extends java.lang.Object
implements LabelGraphic, DataModelListener

A wrapper for a label graphic that allows updates of the label according to client data. The identity (equals(), hashCode()) is that of the target.

Version:
$Revision: 1.1 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Constructor Summary
ClientLabelGraphic(LabelGraphic target)
          Creates an instance with the specified wrapper target.
 
Method Summary
 boolean clientDataChanged(java.lang.Object clientData)
          Updates this label according to the client data.
 void clientDataChanged(java.lang.Object source, DataModel target)
          Called after a change occurs in the client data of the target data model, such as when a new (possibly null) client data object is set or the state of the current client data object changes.
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getGraphic()
          Returns the target graphic object represented by this proxy interface, which may be needed to take advantage of native graphic capabilities.
 javax.swing.Icon getIcon()
          Gets the label text.
 java.lang.String getText()
          Gets the label text.
 int hashCode()
           
 void setIcon(javax.swing.Icon icon)
          Sets the label icon.
 void setText(java.lang.String text)
          Sets the label text.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClientLabelGraphic

public ClientLabelGraphic(LabelGraphic target)
Creates an instance with the specified wrapper target.

Parameters:
target - Reference to the target. Never null.
Method Detail

clientDataChanged

public boolean clientDataChanged(java.lang.Object clientData)
Updates this label according to the client data. If the client data is unrecognized, nothing happens and returns false. Default implementation: If the client data is a ClientData.Map and contains ClientData.LABEL_KEY, the label's text and icon are updated; if a ClientLabel, its label text and icon are updated; if a String the label text is updated; and, if an Icon, the label icon is updated.

Parameters:
clientData - The new client data. None if null.
Returns:
True if the client data was recognized, otherwise false.

clientDataChanged

public void clientDataChanged(java.lang.Object source,
                              DataModel target)
Description copied from interface: DataModelListener
Called after a change occurs in the client data of the target data model, such as when a new (possibly null) client data object is set or the state of the current client data object changes.

Specified by:
clientDataChanged in interface DataModelListener
Parameters:
source - The source object sending the event. Never null.
target - The affected data model. Never null.

getIcon

public javax.swing.Icon getIcon()
Description copied from interface: LabelGraphic
Gets the label text.

Specified by:
getIcon in interface LabelGraphic
Returns:
The icon. None if null

getText

public java.lang.String getText()
Description copied from interface: LabelGraphic
Gets the label text.

Specified by:
getText in interface LabelGraphic
Returns:
The text. None if null.

setIcon

public void setIcon(javax.swing.Icon icon)
Description copied from interface: LabelGraphic
Sets the label icon. Depending on the implementation, may do nothing or throw an exception if an icon is not supported.

Specified by:
setIcon in interface LabelGraphic
Parameters:
icon - The new icon. None if null.

setText

public void setText(java.lang.String text)
Description copied from interface: LabelGraphic
Sets the label text. Depending on the implementation, may support HTML and multiple lines (see JLabel), or leading white space (see JTextField).

Specified by:
setText in interface LabelGraphic
Parameters:
text - The new text. None if null.

getGraphic

public java.lang.Object getGraphic()
Description copied from interface: Graphic
Returns the target graphic object represented by this proxy interface, which may be needed to take advantage of native graphic capabilities.

Specified by:
getGraphic in interface Graphic
Returns:
The target graphic object. Possibly this object (self-proxy, direct implementation), but never null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object