net.rim.device.api.lcdui
Class BlackBerryList

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Screen
          extended by javax.microedition.lcdui.List
              extended by net.rim.device.api.lcdui.BlackBerryList
All Implemented Interfaces:
Choice, Controllable

public class BlackBerryList
extends List
implements Controllable

The BlackBerryList class extends the functionality of the List class.

The BlackBerryList class implements Controllable and can be queried to retrieve BlackBerry-specific Controls. For instance, on devices which support a virtual keyboard, BlackBerryList.getControl(String) may return a VirtualKeyboardControl object.

Since:
BlackBerry API 4.7.0

Field Summary
 
Fields inherited from class javax.microedition.lcdui.List
SELECT_COMMAND
 
Fields inherited from interface javax.microedition.lcdui.Choice
EXCLUSIVE, IMPLICIT, MULTIPLE, POPUP, TEXT_WRAP_DEFAULT, TEXT_WRAP_OFF, TEXT_WRAP_ON
 
Constructor Summary
BlackBerryList(String title, int listType)
          Creates a new instance of a BlackBerryList.
BlackBerryList(String title, int listType, String[] stringElements, Image[] imageElements)
          Creates a new instance of a BlackBerryList
 
Method Summary
 Control getControl(String controlType)
          Obtain the object that implements the specified Control interface.
 Control[] getControls()
          Obtain the collection of Controls from the object that implements this interface.
 
Methods inherited from class javax.microedition.lcdui.List
append, delete, deleteAll, getFitPolicy, getFont, getImage, getSelectedFlags, getSelectedIndex, getString, insert, isSelected, removeCommand, set, setFitPolicy, setFont, setSelectCommand, setSelectedFlags, setSelectedIndex, size
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, setCommandListener, setTicker, setTitle, sizeChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

BlackBerryList

public BlackBerryList(String title,
                      int listType)
Creates a new instance of a BlackBerryList.

Throws:
IllegalArgumentException - if listType is not one of IMPLICIT, EXCLUSIVE, or MULTIPLE.
See Also:
List.List(String, int)
Since:
BlackBerry API 4.7.0

BlackBerryList

public BlackBerryList(String title,
                      int listType,
                      String[] stringElements,
                      Image[] imageElements)
Creates a new instance of a BlackBerryList

Throws:
NullPointerException - if stringElements is null
NullPointerException - if the stringElements array contains any null elements
IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements array
IllegalArgumentException - if listType is not one of IMPLICIT, EXCLUSIVE, or MULTIPLE.
IllegalArgumentException - if any image in the imageElements array is mutable
See Also:
List.List(String, int, String[], Image[])
Since:
BlackBerry API 4.7.0


Method Detail

getControls

public Control[] getControls()
Description copied from interface: Controllable
Obtain the collection of Controls from the object that implements this interface.

Since a single object can implement multiple Control interfaces, it's necessary to check each object against different Control types. For example:

Controllable controllable;
    :
Control cs[];
cs = controllable.getControls();
for (int i = 0; i < cs.length; i++) {
    if (cs[i] instanceof ControlTypeA)
        doSomethingA();
    if (cs[i] instanceof ControlTypeB)
        doSomethingB();
    // etc.
}

The list of Control objects returned will not contain any duplicates. And the list will not change over time.

If no Control is supported, a zero length array is returned.

Specified by:
getControls in interface Controllable
Returns:
the collection of Control objects.
See Also:
Controllable.getControls()
Since:
BlackBerry API 4.7.0

getControl

public Control getControl(String controlType)
Description copied from interface: Controllable
Obtain the object that implements the specified Control interface.

If the specified Control interface is not supported then null is returned.

If the Controllable supports multiple objects that implement the same specified Control interface, only one of them will be returned. To obtain all the Control's of that type, use the getControls method and check the list for the requested type.

Specified by:
getControl in interface Controllable
Parameters:
controlType - the class name of the Control. The class name should be given either as the fully-qualified name of the class; or if the package of the class is not given, the package javax.microedition.media.control is assumed.
Returns:
the object that implements the control, or null.
Throws:
IllegalArgumentException - Thrown if controlType is null.
See Also:
Controllable.getControl(String)
Since:
BlackBerry API 4.7.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