|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.ui.model.imp.VirtualKeyListDataModel
List Data Model for Key lists with a very large or unknown number of keys.
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 boolean |
keepKeys
This flag directs the list not to flush the keyset cache when a new keyset is loaded. |
private java.util.Vector |
keyset
The elements of the currently loaded keyset |
private int |
keysetIndex
This is the index of the first key in the keyset. |
private int |
keysetSize
This member holds the size of the keyset. |
private static long |
serialVersionUID
Serial Version UID |
private int |
size
The total number of elements. |
private int |
threshold
Number of overlapping keys between keysets to reduce page filtering |
Constructor Summary | |
VirtualKeyListDataModel()
Constructor |
|
VirtualKeyListDataModel(int keysetSize,
boolean keepKeys)
Constructor |
Method Summary | |
int |
capacity()
Returns the current capacity of this VirtualKeyListDataModel. |
void |
clear()
Clears the current list |
protected void |
clearKeyset()
Removes all elements from the keyset. |
protected abstract java.util.Collection |
doFetchKeyset(int startIndex,
int keyCount)
This method reads a keyset into memory |
protected abstract java.lang.Object |
doFetchRowBean(java.lang.Object key)
Overwrite this method to load one single row bean |
protected int |
doFetchSize()
This method is called to fetch the actual keyset size. |
protected void |
doSetup()
This method is called first to do any initialization processing |
private void |
fetchKeyset(int index)
This method is called when the next keyset is to be loaded into memory |
java.lang.Object |
getElementAt(int index)
Returns the (row) object for the specified index. |
java.lang.Object |
getElementFromKeyset(int index)
Returns a Element of the keyset |
int |
getKeysetIndex()
Returns the Index of the first element in the keyset |
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. |
private int |
mapIndexToKeyset(int index)
This method maps an absolute index to a relative index in the keyset. |
void |
setKeysetSize(int i)
Sets the keyset size to the specified value. |
void |
setSize(int i)
Sets the number of total available keys in this list. |
void |
setThreshold(int i)
Sets the threshold value. |
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 |
private static final long serialVersionUID
private boolean keepKeys
private int keysetSize
private int threshold
private int size
-1
when the correct number is unknown
private int keysetIndex
private java.util.Vector keyset
private int cache
private java.lang.Object cacheBean
Constructor Detail |
public VirtualKeyListDataModel()
public VirtualKeyListDataModel(int keysetSize, boolean keepKeys)
keysetSize
- The number of keys that should
be fetched at a timekeepKeys
- Set to true
when all
keys should be kept in memory. Set to false
when only a number of keysetSize
keys
should be kept in memory (default)Method Detail |
public void clear()
protected void clearKeyset()
private void fetchKeyset(int index) throws java.lang.Exception
index
- Start Index
java.lang.Exception
- Will be thrown in case of
an error in the integration layerprotected void doSetup() throws java.lang.Exception
java.lang.Exception
- Will be thrown in case of
an error in the integration layerprotected int doFetchSize() throws java.lang.Exception
java.lang.Exception
- Will be thrown in case of
an error in the integration layerprotected abstract java.util.Collection doFetchKeyset(int startIndex, int keyCount) throws java.lang.Exception
startIndex
- Index of the first keykeyCount
- Number of keys to read
java.lang.Exception
- Will be thrown in case of
an error in the integration layerprotected abstract java.lang.Object doFetchRowBean(java.lang.Object key) throws java.lang.Exception
key
- The key
java.lang.Exception
- An error occurred while loading the
row beanprivate int mapIndexToKeyset(int index) throws java.lang.Exception
index
- the absolute index
-1
when the index could not
be matched
java.lang.Exception
- Will be thrown in case of
an error in the integration layerpublic java.lang.Object getElementAt(int index)
ListDataModel
getElementAt
in interface ListDataModel
index
- A zero based index
ListDataModel.getElementAt(int)
public java.lang.String getUniqueKey(int index)
ListDataModel
getUniqueKey
in interface ListDataModel
index
- A zero based index
ListDataModel.getUniqueKey(int)
private java.lang.Object getRowBean(int index)
index
- Element index
public java.lang.Object getElementFromKeyset(int index)
index
- Element index in the keyset
public int size()
ListDataModel
size
in interface ListDataModel
ListDataModel.size()
public int capacity()
public void setSize(int i)
i
- Number of keys or -1
when
the number is unknownpublic int getKeysetIndex()
public void setKeysetSize(int i)
i
- new keyset sizepublic void setThreshold(int i)
i
- new threshold value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |