SPT Core API

com.sptci.echo2.binding
Class ListItem

java.lang.Object
  extended by com.sptci.echo2.binding.ListItem
All Implemented Interfaces:
Serializable, Cloneable, Comparable<ListItem>

public class ListItem
extends Object
implements Serializable, Comparable<ListItem>, Cloneable

A simple bean that represents an item that can be added to a ListModel.

Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: ListItem.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2006-01-31
See Also:
Serialized Form

Field Summary
protected  boolean selected
          A flag indicating whether the value is selected or not.
protected  String value
          The item or value stored in the list.
 
Constructor Summary
protected ListItem()
          Default constructor.
  ListItem(String value)
          Create a new instance of the bean using the specified object.
  ListItem(String value, boolean selected)
          Designated constructor.
 
Method Summary
 Object clone()
          Creates and returns a copy of this object.
 int compareTo(ListItem item)
          Implementation of the Comparable interface.
 boolean equals(Object object)
          Check the specified object with this object for equality.
 boolean getSelected()
          Returns selected.
 String getValue()
          Returns value.
 int hashCode()
          Return a hash code value for this object.
 boolean isSelected()
          Returns the status of selected.
 void setSelected(boolean selected)
          Set selected.
 void setValue(String value)
          Set value.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected String value
The item or value stored in the list.


selected

protected boolean selected
A flag indicating whether the value is selected or not.

Constructor Detail

ListItem

protected ListItem()
Default constructor. Cannot be initialised.


ListItem

public ListItem(String value)
Create a new instance of the bean using the specified object. Set the selected to false for the specified object.

Parameters:
value - The value to set.

ListItem

public ListItem(String value,
                boolean selected)
Designated constructor. Create a new bean using the specified values.

Parameters:
value - The value to set.
selected - The selected value to set.
Method Detail

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Returns:
String The string representation of the fields of the object.

equals

public boolean equals(Object object)
Check the specified object with this object for equality.

Overrides:
equals in class Object
Parameters:
object - The object that is to be checked for equality with.
Returns:
boolean Returns true if the object is of the same type as this object and has the same field values.

hashCode

public int hashCode()
Return a hash code value for this object.

Overrides:
hashCode in class Object
Returns:
int The hash code value.

compareTo

public int compareTo(ListItem item)
Implementation of the Comparable interface. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The comparison is done by comparing the hashCode() values of the objects.

Specified by:
compareTo in interface Comparable<ListItem>
Parameters:
item - - The object with which this class is to be compared.
Returns:
int - A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

clone

public Object clone()
             throws CloneNotSupportedException
Creates and returns a copy of this object. Implementation of the Cloneable interface. No special actions are performed. This method simply allows public access to the Object.clone method.

Overrides:
clone in class Object
Returns:
Object A clone of this instance.
Throws:
CloneNotSupportedException - If the super-class implementation throws an error.

getValue

public final String getValue()
Returns value.

Returns:
String The value/reference of/to value.

setValue

public void setValue(String value)
Set value.

Parameters:
value - The value to set.

getSelected

public final boolean getSelected()
Returns selected.

Returns:
boolean The value/reference of/to selected.

isSelected

public final boolean isSelected()
Returns the status of selected.

Returns:
boolean The value/reference of/to selected.

setSelected

public void setSelected(boolean selected)
Set selected.

Parameters:
selected - The value to set.

SPT Core API