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.
 TableController getController()
          Returns a reference to the underlying TableController object of this SimpleList.
 int getFocusRow()
          Get the row number that has focus.
 TableModel getModel()
          Returns a reference to the underlying TableModel object of this SimpleList.
 TableView getView()
          Returns a reference to the underlying TableView object of this SimpleList.
 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(Command command)
          Set the command that will be executed when a row is clicked on.
 void setCommand(CommandHandler command, ReadOnlyCommandMetadata metadata, Object context)
          Deprecated. Use SimpleList.setCommand(Command command) and SimpleList.setCommandContext(Object commandContext) instead.
 void setCommandContext(Object commandContext)
          Sets command context to be executed when a row is 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)
Deprecated. Use SimpleList.setCommand(Command command) and SimpleList.setCommandContext(Object commandContext) instead.

Set the command that will be executed when a row is 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

setCommand

public void setCommand(Command command)
Set the command that will be executed when a row is clicked on. For more information, see Command Framework API.

Parameters:
command - Command to execute when a row is clicked.
Since:
BlackBerry API 7.0.0

setCommandContext

public void setCommandContext(Object commandContext)
Sets command context to be executed when a row is clicked on.

Parameters:
commandContext - Command context to use when the Command instance is executed.
Since:
BlackBerry API 7.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

getModel

public TableModel getModel()
Returns a reference to the underlying TableModel object of this SimpleList.

Returns:
The TableModel object that corresponds to this SimpleList object.
Since:
BlackBerry API 7.0.0

getView

public TableView getView()
Returns a reference to the underlying TableView object of this SimpleList.

Returns:
The TableView object that corresponds to this SimpleList object.
Since:
BlackBerry API 7.0.0

getController

public TableController getController()
Returns a reference to the underlying TableController object of this SimpleList.

Returns:
The TableController object that corresponds to this SimpleList object.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal