com.sapportals.htmlb

Interface IListModel

All Known Implementing Classes:
DefaultListModel, JCOListModel

public interface IListModel

Base data model for DropdownListBox & ListBox

Copyright 2004 SAP AG


Method Summary
 void addItem(String key, String text)
          adds an item to the list of choices.
 void addSelection(String key)
          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 removeSelection(String key)
          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 nameOfTextColumn)
          sets the name of the column containing the visible texts if the list model is associated with a table.
 void setSelection(String key)
          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.
 

Method Detail

addItem

public void addItem(String key,
                    String text)
adds an item to the list of choices.

Parameters:
key - the key of the item
text - the visible text of the item

size

public int size()
gets the size of the list, i.e. the number of items.

Returns:
the current size of the list

getKeyByIndex

public String getKeyByIndex(int index)
gets the key of an item for a specified index.

Parameters:
index - the index of the item in the list
Returns:
the key for that index
Throws:
IndexOutOfBoundsException

getTextByIndex

public String getTextByIndex(int index)
gets the visible text of an item for a specified index.

Parameters:
index - the index of the item in the list
Returns:
the text for that index
Throws:
IndexOutOfBoundsException

getKeys

public Iterator getKeys()
gets an Iterator for all keys currently in the list

Returns:
an Iterator for the keys

getTextForKey

public String getTextForKey(String key)
gets the text associated with the key

Parameters:
key - the key of an item
Returns:
the text of that item

isSelected

public boolean isSelected(int index)
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.

Parameters:
index - the index of the item
Returns:
true if that item is currently selected
See Also:
isSelected(String)

isSelected

public boolean isSelected(String key)
determines if the item with the given key is currently selected.

Parameters:
key - the key of the item
Returns:
true if that item is currently selected

getNameOfKeyColumn

public String getNameOfKeyColumn()
gets the name of the column containing the key values if the list model is associated with a table.

Returns:
the column identifier of the key column

setNameOfKeyColumn

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

Parameters:
nameOfKeyColumn - the column identifier of the key column

getNameOfTextColumn

public String getNameOfTextColumn()
gets the name of the column containing the visible texts if the list model is associated with a table.

Returns:
the column identifier of the text column

setNameOfTextColumn

public void setNameOfTextColumn(String nameOfTextColumn)
sets the name of the column containing the visible texts if the list model is associated with a table.

Parameters:
nameOfTextColumn - the column identifier of the text column

setSelection

public void setSelection(String key)
sets the current selection to the item with the given key.

Parameters:
key - the key of the item to select

isSingleSelection

public 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.

Returns:
true if the model only allows single selection

setSingleSelection

public void setSingleSelection(boolean isSingleSelection)
sets the selection behaviour for the list model

Parameters:
isSingleSelection - true if the model should only allow single selection.

getSingleSelection

public String getSingleSelection()
gets the key of the currently selected item if the model is a single selection model.

Returns:
the key of the selected item

getMultiSelection

public String[] getMultiSelection()
gets the keys of the currently selected items if the model is a multi selection model.

Returns:
the keys of the selected item

addSelection

public void addSelection(String key)
adds the item with the given key to the selection. This should only work in single selection mode.

Parameters:
key - the key of the item to add to the selection

removeSelection

public void removeSelection(String key)
adds the item with the given key to the selection. This should only work in single selection mode.

Parameters:
key - the key of the item to remove from the selection


Copyright 2006 SAP AG Complete Copyright Notice