generalDatabase.lookupTables
Class LookupList

java.lang.Object
  extended by generalDatabase.lookupTables.LookupList
All Implemented Interfaces:
java.lang.Cloneable

public class LookupList
extends java.lang.Object
implements java.lang.Cloneable

Handles information for a single list from the look up table

Author:
Doug Gillespie

Nested Class Summary
private  class LookupList.CodeComparatator
           
private  class LookupList.IdComparatator
           
private  class LookupList.OrderComparatator
           
private  class LookupList.TextComparatator
           
 
Field Summary
private  java.util.Vector<LookupItem> deletedItems
           
private  java.lang.String listTopic
           
private  java.util.Vector<LookupItem> lutList
           
 
Constructor Summary
LookupList(java.lang.String listTopic)
           
 
Method Summary
 void addItem(LookupItem lutItem)
          Add an item to the list
 java.lang.String checkRepeatCodes()
          Check for repeated codes
protected  LookupList clone()
           
 java.util.Vector<LookupItem> getDeletedItems()
           
protected  java.util.Vector<LookupItem> getList()
           
 java.lang.String getListTopic()
           
protected  java.util.Vector<LookupItem> getSelectedList()
           
 LookupItem removeItem(int lutItemIndex)
          Remove an item at a specified index in the list
 boolean removeItem(LookupItem lutItem)
          Remove the first occurrence of an item from the list
private  void setDeleted(LookupItem lutItem)
           
 void setListTopic(java.lang.String listTopic)
           
 void sortItemsByCode()
          Sort the items by the code value in the look up table (case insensitive)
 void sortItemsById()
          Sort the items by the database id value
 void sortItemsByOrder()
          Sort the items by the order value in the look up table
 void sortItemsByText()
          Sort the items by the text value in the look up table (case insensitive)
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lutList

private java.util.Vector<LookupItem> lutList

deletedItems

private java.util.Vector<LookupItem> deletedItems

listTopic

private java.lang.String listTopic
Constructor Detail

LookupList

public LookupList(java.lang.String listTopic)
Method Detail

getList

protected java.util.Vector<LookupItem> getList()
Returns:
the full list of LookupItems, including ones which are not currently selectable

getSelectedList

protected java.util.Vector<LookupItem> getSelectedList()
Returns:
the partial list of LookupItems, currently marked as selectable

addItem

public void addItem(LookupItem lutItem)
Add an item to the list

Parameters:
lutItem - item to add to the list

removeItem

public boolean removeItem(LookupItem lutItem)
Remove the first occurrence of an item from the list

Parameters:
lutItem - item to remove from the list
Returns:
true if the item was found and removed.

removeItem

public LookupItem removeItem(int lutItemIndex)
Remove an item at a specified index in the list

Parameters:
lutItemIndex - index of item to remove
Returns:
the removed item

setDeleted

private void setDeleted(LookupItem lutItem)

sortItemsById

public void sortItemsById()
Sort the items by the database id value


sortItemsByOrder

public void sortItemsByOrder()
Sort the items by the order value in the look up table


sortItemsByCode

public void sortItemsByCode()
Sort the items by the code value in the look up table (case insensitive)


sortItemsByText

public void sortItemsByText()
Sort the items by the text value in the look up table (case insensitive)


setListTopic

public void setListTopic(java.lang.String listTopic)

getListTopic

public java.lang.String getListTopic()

clone

protected LookupList clone()
Overrides:
clone in class java.lang.Object

checkRepeatCodes

public java.lang.String checkRepeatCodes()
Check for repeated codes

Returns:
null if there are no repeats or the repeated code if it's repeated.

getDeletedItems

public java.util.Vector<LookupItem> getDeletedItems()
Returns:
the deletedItems