net.rim.device.api.ui.component.table
Class SimpleList

java.lang.Object
  extended by net.rim.device.api.ui.component.table.SimpleList

public class SimpleList
extends Object

The SimpleList class provides an API that makes it more convenient to access the Table API Model-View-Controller structure to make a list of Strings, one on top of the other. The SimpleList can have add, delete and set operations on its data.

Since:
BlackBerry API 6.0.0

Constructor Summary
SimpleList(Manager manager)
          Creates a SimpleList instance and adds the relevant material to a provided manager.
 
Method Summary
 void add(String data)
          Adds a String of data to the bottom of the SimpleList and updates the screen accordingly.
 void add(String data, int index)
          Adds a String of data at a specific position in the SimpleList and updates the screen accordingly.
 String get(int index)
          Retrieves a String stored at a specific position in the SimpleList.
 int getFocusRow()
          Get the row number that has focus.
 void remove(int index)
          Removes a String of data at a specific position in the SimpleList and updates the screen accordingly.
 void set(int index, String data)
          Overwrites a String stored a specific position in the SimpleList with a given String.
 void setCommand(CommandHandler command, ReadOnlyCommandMetadata metadata, Object context)
          Set the command that will be executed when a row in a SimpleList field clicked on.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

SimpleList

public SimpleList(Manager manager)
Creates a SimpleList instance and adds the relevant material to a provided manager.

Parameters:
manager - The Manager object that will hold the contents of a SimpleList
Since:
BlackBerry API 6.0.0


Method Detail

add

public void add(String data)
Adds a String of data to the bottom of the SimpleList and updates the screen accordingly.

Parameters:
data - A String that will be added to the bottom of the list.
Throws:
IllegalArgumentException - if a null value is provided instead of a valid string. Note: An empty String is considered a valid argument.
Since:
BlackBerry API 6.0.0

add

public void add(String data,
                int index)
Adds a String of data at a specific position in the SimpleList and updates the screen accordingly.

Parameters:
data - A String to be added to the list.
index - An integer specifying the row at which the new String should be inserted.
Throws:
IllegalArgumentException - if a null value is provided instead of a valid string or if the index provided is either less than zero or greater than the current TableModel size. Note: An empty String is considered a valid argument.
Since:
BlackBerry API 6.0.0

remove

public void remove(int index)
Removes a String of data at a specific position in the SimpleList and updates the screen accordingly.

Parameters:
index - An integer specifying the row position of the String that is to be removed.
Throws:
IllegalArgumentException - if the index provided is not a valid row in the TableModel
Since:
BlackBerry API 6.0.0

get

public String get(int index)
Retrieves a String stored at a specific position in the SimpleList.

Parameters:
index - An integer specifying the row position of the String that is to be retrieved.
Returns:
The String object that is present at the specified row position.
Throws:
IllegalArgumentException - if the index provided is not a valid row in the TableModel
Since:
BlackBerry API 6.0.0

set

public void set(int index,
                String data)
Overwrites a String stored a specific position in the SimpleList with a given String.

Parameters:
index - An integer specifying the row position of the String that is to be retrieved.
data - A String object that will replace the existing one.
Throws:
IllegalArgumentException - if the index provided is not a valid row in the TableModel
Since:
BlackBerry API 6.0.0

setCommand

public void setCommand(CommandHandler command,
                       ReadOnlyCommandMetadata metadata,
                       Object context)
Set the command that will be executed when a row in a SimpleList field clicked on.

Parameters:
command - The command to execute when a row is clicked.
metadata - The metadata that goes with the provided command.
context - The context object that goes with the provided command.
Since:
BlackBerry API 6.0.0

getFocusRow

public int getFocusRow()
Get the row number that has focus.

Returns:
The row number that has focus.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.