com.cc.framework.ui.model.imp
Class KeyListDataModel

java.lang.Object
  extended bycom.cc.framework.ui.model.imp.KeyListDataModel
All Implemented Interfaces:
DataModel, ListDataModel, java.io.Serializable, VirtualDataModel

public abstract class KeyListDataModel
extends java.lang.Object
implements VirtualDataModel, ListDataModel, java.io.Serializable

ListDataModel which holds only a Key Set in Memory. The Display Beans are loaded as needed

Version:
$Revision: 1.10 $
Author:
Harald Schulz
See Also:
Serialized Form

Field Summary
private  int cache
          The List implements a very simple cache mechanism to prevent unnecessary loading
private  java.lang.Object cacheBean
          Cached row bean
private  java.util.Vector keySet
          The Set of Keys
private static long serialVersionUID
          Serial Version UID
 
Constructor Summary
KeyListDataModel()
           
 
Method Summary
 void clear()
          Clears the current keyset
protected abstract  java.util.Collection doFetchKeys()
          Overwrite this method to load the keyset
protected abstract  java.lang.Object doFetchRowBean(java.lang.Object key)
          Overwrite this method to load one single row bean
protected  void doSetup()
          This method is called first to do any initialization processing
 java.lang.Object getElementAt(int index)
          Returns the (row) object for the specified index.
private  java.lang.Object getRowBean(int index)
          Returns the row bean for the given index
 java.lang.String getUniqueKey(int index)
          Returns a unique key for the row which is specified by the index.
 void setupKeys()
          Use this method to set up the keys collection explicit
 int size()
          Returns the number of rows within the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

keySet

private java.util.Vector keySet
The Set of Keys


cache

private int cache
The List implements a very simple cache mechanism to prevent unnecessary loading


cacheBean

private java.lang.Object cacheBean
Cached row bean

Constructor Detail

KeyListDataModel

public KeyListDataModel()
Method Detail

doSetup

protected void doSetup()
                throws java.lang.Exception
This method is called first to do any initialization processing

Throws:
java.lang.Exception - Will be thrown in case of an error in the integration layer

doFetchKeys

protected abstract java.util.Collection doFetchKeys()
                                             throws java.lang.Exception
Overwrite this method to load the keyset

Returns:
Collection of keys
Throws:
java.lang.Exception - An error ocurred while loading the keyset

doFetchRowBean

protected abstract java.lang.Object doFetchRowBean(java.lang.Object key)
                                            throws java.lang.Exception
Overwrite this method to load one single row bean

Parameters:
key - The key
Returns:
row bean
Throws:
java.lang.Exception - An error ocurred while loading the row bean

clear

public void clear()
Clears the current keyset


setupKeys

public void setupKeys()
               throws java.lang.Exception
Use this method to set up the keys collection explicit

Throws:
java.lang.Exception - An error ocurred while loading the keyset

getRowBean

private java.lang.Object getRowBean(int index)
Returns the row bean for the given index

Parameters:
index - Element index
Returns:
row bean

getElementAt

public java.lang.Object getElementAt(int index)
Description copied from interface: ListDataModel
Returns the (row) object for the specified index. This can be a display object (view helper) whose properties will be accessed within the columns of a List- or TreeControl

Specified by:
getElementAt in interface ListDataModel
Parameters:
index - A zero based index
Returns:
A row object.
See Also:
ListDataModel.getElementAt(int)

getUniqueKey

public java.lang.String getUniqueKey(int index)
Description copied from interface: ListDataModel
Returns a unique key for the row which is specified by the index. This id will be attached in hyperlinks to identify the row/object. This can be a simple row index or a key which correspond to the primary key from the database.

Specified by:
getUniqueKey in interface ListDataModel
Parameters:
index - A zero based index
Returns:
The unique key
See Also:
ListDataModel.getUniqueKey(int)

size

public int size()
Description copied from interface: ListDataModel
Returns the number of rows within the list.

Specified by:
size in interface ListDataModel
Returns:
Number of rows
See Also:
ListDataModel.size()


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.