SilverStream
Application Server 3.5

com.sssw.rt.jform
Class AgoDisplayValue

java.lang.Object
 |
 +--com.sssw.rt.jform.AgoDisplayValue

public class AgoDisplayValue
extends Object

AgoDisplayValue is a wrapper class for values in AgcJList, AgcJComboBox, and AgcJTree. It combines a display value (title) and a storage value (userdata). It allows list items to have a display value that is different from their underlying data value. For example, a list could display the text "East Region" with an underlying data value of 4.

You don't usually need to work with the AgoDisplayValue class. The methods for list classes let you add items by specifying a title and a data value and an AgoDisplayValue object is created and added to the list. When you use Swing methods to get items from the control's data model, the Object returned is an AgoDisplayValue and you can use the methods in this class to get the title and underlying data value.

This code creates an AgoDisplayValue object with "East Region" as the text and a storage value of 4.

  AgoDisplayValue item = new 
  		AgoDisplayValue( "East Region", new Integer(4) );
 


Constructor Summary
AgoDisplayValue(String title, Object userdata)
          Creates an AgoDisplayValue with the specified display text and userdata storage value.
 
Method Summary
static Object extractUserData(Object obj)
          Static helper method that allows you to work with any object in a list, whether or not it is an AgoDisplayValue object.
 Object getUserData()
          Gets the storage value for the AgoDisplayValue object.
 String toString()
          Gets the text that the AgoDisplayValue object displays in a list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgoDisplayValue

public AgoDisplayValue(String title,
                       Object userdata)
Creates an AgoDisplayValue with the specified display text and userdata storage value. When the list is bound to a database column and this AgoDisplayValue object is selected, the userdata value is stored in the database. If userdata is null, then title is used for both the display and storage value.
Parameters:
title - a String specifying the text that is displayed for the item in a list control
userdata - an Object whose value is the storage value for the list item
Method Detail

toString

public String toString()
Gets the text that the AgoDisplayValue object displays in a list.
Overrides:
toString in class Object
Returns:
a String object

getUserData

public Object getUserData()
Gets the storage value for the AgoDisplayValue object.
Returns:
an Object. If the AgoDisplayValue object has no underlying data value, returns the title String instead.

extractUserData

public static Object extractUserData(Object obj)
Static helper method that allows you to work with any object in a list, whether or not it is an AgoDisplayValue object. Call extractUserData() to get the "value" of the object, which is either the underlying storage value for an AgoDisplayValue object or the Object itself.
Parameters:
obj - an Object for which you want the storage value, if any
Returns:
an Object. If obj is an AgoDisplayValue, returns its userdata value. Otherwise, it just returns obj.

SilverStream
Application Server 3.5