be.six.reports.util
Class ListItem

java.lang.Object
  extended by be.six.reports.util.ListItem
All Implemented Interfaces:
java.lang.Comparable<ListItem>

public class ListItem
extends java.lang.Object
implements java.lang.Comparable<ListItem>

A Generic ListItem. Is used in a Vector so list items can be shown in a user interface element. Defines an sorting order on the string representation of the value of a ListItem.

Author:
Joren Six

Constructor Summary
ListItem(java.lang.Object key, java.lang.String value)
          Creates a new list item.
 
Method Summary
 int compareTo(ListItem o)
           
static java.util.Vector<ListItem> convertDatabaseResult(DatabaseResult result)
          Converts a DatabaseResult to a list of ListItems.
 java.lang.Object getKey()
           
 java.lang.String getValue()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListItem

public ListItem(java.lang.Object key,
                java.lang.String value)
Creates a new list item.

Parameters:
key - The key of the item.
value - The value of the item. The value should have a string representation.
Method Detail

toString

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

getKey

public java.lang.Object getKey()
Returns:
The key of the item.

getValue

public java.lang.String getValue()
Returns:
The value, name of the item.

convertDatabaseResult

public static java.util.Vector<ListItem> convertDatabaseResult(DatabaseResult result)
Converts a DatabaseResult to a list of ListItems. Uses the object in the first column as key, the object in the second column as value.

Parameters:
result - the result to convert.
Returns:
A Vector of ListItems.

compareTo

public int compareTo(ListItem o)
Specified by:
compareTo in interface java.lang.Comparable<ListItem>