common-util

local.tomas.faces.ui
Class EntitySelectListHandler<K,E>

java.lang.Object
  extended by local.tomas.faces.ui.EntitySelectListHandler<K,E>
Type Parameters:
K - key type
E - type of objects to select from

public abstract class EntitySelectListHandler<K,E>
extends Object

Abstract base class for select list handler. A select list handler is used to let the user select from a list of objects.

Author:
tomas

Constructor Summary
EntitySelectListHandler()
           
 
Method Summary
protected abstract  List<E> getBaseList()
          Get base list.
 K getFirstItemKey()
          Get key of first item.
 String getFirstItemLabel()
          Get label of first item.
 E getItem(K key)
          Get item for key.
protected abstract  K getKey(E entity)
          Get key for entity.
protected abstract  String getLabel(E entity)
          Get label for entity.
 List<javax.faces.model.SelectItem> getSelectList()
          Get select list used for display.
 void reset()
          Reset the instance.
 void setFirstItemKey(K firstItemKey)
          Set key of first item.
 void setFirstItemLabel(String firstItemLabel)
          Set label of first item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntitySelectListHandler

public EntitySelectListHandler()
Method Detail

getFirstItemKey

public K getFirstItemKey()
Get key of first item.

Returns:
Returns key of first item.

setFirstItemKey

public void setFirstItemKey(K firstItemKey)
Set key of first item.

Parameters:
firstItemKey - key of first item to set.

getFirstItemLabel

public String getFirstItemLabel()
Get label of first item.

Returns:
Returns the name of the fist item.

setFirstItemLabel

public void setFirstItemLabel(String firstItemLabel)
Set label of first item.

Parameters:
firstItemLabel - The label to set.

getItem

public E getItem(K key)
Get item for key.

Parameters:
key - the key
Returns:
The item

getSelectList

public List<javax.faces.model.SelectItem> getSelectList()
Get select list used for display.

Returns:
The select list.

reset

public void reset()
Reset the instance. Clear the map.


getKey

protected abstract K getKey(E entity)
Get key for entity.

Parameters:
entity - The entity.
Returns:
The key.

getLabel

protected abstract String getLabel(E entity)
Get label for entity.

Parameters:
entity - The entity.
Returns:
The label.

getBaseList

protected abstract List<E> getBaseList()
Get base list.

Returns:
The list.

common-util

Copyright © 2007 null. All Rights Reserved.