com.sapportals.htmlb

Class JCOListModel

java.lang.Object
  extended bycom.sapportals.htmlb.JCOListModel
All Implemented Interfaces:
IListModel, Serializable

public class JCOListModel
extends Object
implements IListModel, Serializable

An implementation of a IListModel for DropdownListBox or Listbox that uses an underlying JCO.Table

Copyright 2004 SAP AG

See Also:
Serialized Form

Constructor Summary
JCOListModel(JCO.Table table)
           
 
Method Summary
 void addItem(String key, String text)
          adds an item to the list of choices.
 void addSelection(String selection)
          adds the item with the given key to the selection.
 String getKeyByIndex(int index)
          gets the key of an item for a specified index.
 Iterator getKeys()
          gets an Iterator for all keys currently in the list
 String[] getMultiSelection()
          gets the keys of the currently selected items if the model is a multi selection model.
 String getNameOfKeyColumn()
          gets the name of the column containing the key values if the list model is associated with a table.
 String getNameOfTextColumn()
          gets the name of the column containing the visible texts if the list model is associated with a table.
 String getSingleSelection()
          gets the key of the currently selected item if the model is a single selection model.
 String getTextByIndex(int index)
          gets the visible text of an item for a specified index.
 String getTextForKey(String key)
          gets the text associated with the key
 boolean isSelected(int index)
          determines if the item at the given index is currently selected.
 boolean isSelected(String key)
          determines if the item with the given key is currently selected.
 boolean isSingleSelection()
          determines if the model is a single selection model, i.e. allows only a single item to be selected at any given time.
 void removeItem(String key)
           
 void removeSelection(String selection)
          adds the item with the given key to the selection.
 void setNameOfKeyColumn(String nameOfKeyColumn)
          sets the name of the column containing the key values if the list model is associated with a table.
 void setNameOfTextColumn(String nameOfValueColumn)
          sets the name of the column containing the visible texts if the list model is associated with a table.
 void setSelection(String selection)
          sets the current selection to the item with the given key.
 void setSingleSelection(boolean isSingleSelection)
          sets the selection behaviour for the list model
 int size()
          gets the size of the list, i.e. the number of items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCOListModel

public JCOListModel(JCO.Table table)
Method Detail

addItem

public void addItem(String key,
                    String text)
Description copied from interface: IListModel
adds an item to the list of choices.

Specified by:
addItem in interface IListModel
Parameters:
key - the key of the item
text - the visible text of the item

size

public int size()
Description copied from interface: IListModel
gets the size of the list, i.e. the number of items.

Specified by:
size in interface IListModel
Returns:
the current size of the list

getKeyByIndex

public String getKeyByIndex(int index)
Description copied from interface: IListModel
gets the key of an item for a specified index.

Specified by:
getKeyByIndex in interface IListModel
Parameters:
index - the index of the item in the list
Returns:
the key for that index

getTextByIndex

public String getTextByIndex(int index)
Description copied from interface: IListModel
gets the visible text of an item for a specified index.

Specified by:
getTextByIndex in interface IListModel
Parameters:
index - the index of the item in the list
Returns:
the text for that index

getKeys

public Iterator getKeys()
Description copied from interface: IListModel
gets an Iterator for all keys currently in the list

Specified by:
getKeys in interface IListModel
Returns:
an Iterator for the keys

getTextForKey

public String getTextForKey(String key)
Description copied from interface: IListModel
gets the text associated with the key

Specified by:
getTextForKey in interface IListModel
Parameters:
key - the key of an item
Returns:
the text of that item

isSelected

public boolean isSelected(int index)
Description copied from interface: IListModel
determines if the item at the given index is currently selected. Checking for the selection via the index is not supported for reconstructed Lists. Use isSelected(String key) instead.

Specified by:
isSelected in interface IListModel
Parameters:
index - the index of the item
Returns:
true if that item is currently selected
See Also:
IListModel.isSelected(String)

isSelected

public boolean isSelected(String key)
Description copied from interface: IListModel
determines if the item with the given key is currently selected.

Specified by:
isSelected in interface IListModel
Parameters:
key - the key of the item
Returns:
true if that item is currently selected

getNameOfKeyColumn

public String getNameOfKeyColumn()
Description copied from interface: IListModel
gets the name of the column containing the key values if the list model is associated with a table.

Specified by:
getNameOfKeyColumn in interface IListModel
Returns:
the column identifier of the key column

setNameOfKeyColumn

public void setNameOfKeyColumn(String nameOfKeyColumn)
Description copied from interface: IListModel
sets the name of the column containing the key values if the list model is associated with a table.

Specified by:
setNameOfKeyColumn in interface IListModel
Parameters:
nameOfKeyColumn - the column identifier of the key column

getNameOfTextColumn

public String getNameOfTextColumn()
Description copied from interface: IListModel
gets the name of the column containing the visible texts if the list model is associated with a table.

Specified by:
getNameOfTextColumn in interface IListModel
Returns:
the column identifier of the text column

setNameOfTextColumn

public void setNameOfTextColumn(String nameOfValueColumn)
Description copied from interface: IListModel
sets the name of the column containing the visible texts if the list model is associated with a table.

Specified by:
setNameOfTextColumn in interface IListModel
Parameters:
nameOfValueColumn - the column identifier of the text column

setSelection

public void setSelection(String selection)
Description copied from interface: IListModel
sets the current selection to the item with the given key.

Specified by:
setSelection in interface IListModel
Parameters:
selection - the key of the item to select

isSingleSelection

public boolean isSingleSelection()
Description copied from interface: IListModel
determines if the model is a single selection model, i.e. allows only a single item to be selected at any given time.

Specified by:
isSingleSelection in interface IListModel
Returns:
true if the model only allows single selection

setSingleSelection

public void setSingleSelection(boolean isSingleSelection)
Description copied from interface: IListModel
sets the selection behaviour for the list model

Specified by:
setSingleSelection in interface IListModel
Parameters:
isSingleSelection - true if the model should only allow single selection.

getSingleSelection

public String getSingleSelection()
Description copied from interface: IListModel
gets the key of the currently selected item if the model is a single selection model.

Specified by:
getSingleSelection in interface IListModel
Returns:
the key of the selected item

getMultiSelection

public String[] getMultiSelection()
Description copied from interface: IListModel
gets the keys of the currently selected items if the model is a multi selection model.

Specified by:
getMultiSelection in interface IListModel
Returns:
the keys of the selected item

addSelection

public void addSelection(String selection)
Description copied from interface: IListModel
adds the item with the given key to the selection. This should only work in single selection mode.

Specified by:
addSelection in interface IListModel
Parameters:
selection - the key of the item to add to the selection

removeSelection

public void removeSelection(String selection)
Description copied from interface: IListModel
adds the item with the given key to the selection. This should only work in single selection mode.

Specified by:
removeSelection in interface IListModel
Parameters:
selection - the key of the item to remove from the selection

removeItem

public void removeItem(String key)


Copyright 2006 SAP AG Complete Copyright Notice