|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.component.ChoiceField
net.rim.device.api.ui.component.ObjectChoiceField
public class ObjectChoiceField
Choice field that supports a list of object choices.
This class assumes that the contained object values can all provide
string representations of themselves to display in the list of choices (by
invocation of ChoiceField.toString()). We assume that this method of generating
displayable choices is inexpensive (that is, not new object creations).
Behaviour
A choice field that takes an array of Objects (for example,
Strings).
| Field Summary |
|---|
| Fields inherited from class net.rim.device.api.ui.component.ChoiceField |
|---|
CONTEXT_CHANGE_OPTION |
| Constructor Summary | ||
|---|---|---|
ObjectChoiceField()
Constructs a new, empty ObjectChoiceField instance. |
||
ObjectChoiceField(String label,
Object[] choices)
Constructs a new ObjectChoiceField instance. |
||
ObjectChoiceField(String label,
Object[] choices,
int initialIndex)
Constructs a new ObjectChoiceField instance and sets initially selected index. |
||
ObjectChoiceField(String label,
Object[] choices,
int initialIndex,
long style)
Constructs a new ObjectChoiceField instance of provided style and sets initially selected index. |
||
ObjectChoiceField(String label,
Object[] choices,
Object initialObject)
Constructs a new object choice field and sets initially selected object. |
||
ObjectChoiceField(String label,
Object[] choices,
Object initialObject,
long style)
Constructs a new object choice field and sets initially selected object. |
||
| Method Summary | ||
|---|---|---|
Object |
getChoice(int index)
Retrieves object by index. |
|
void |
setChoices(Object[] choices)
Provides a new list of choices for this field. |
|
| Methods inherited from class net.rim.device.api.ui.component.ChoiceField |
|---|
drawFocus, getAccessibleContext, getFocusRect, getHeightOfChoices, getLabel, getPreferredHeight, getPreferredWidth, getSelectedIndex, getSize, getWidthOfChoice, invokeAction, keyChar, keyControl, keyStatus, layout, makeContextMenu, moveFocus, onUnfocus, paint, setEditable, setLabel, setNumberOfChoices, setSelectedIndex, setSelectedIndex, setSelectedIndex, setSize, toString, touchEvent, trackwheelClick, trackwheelUnclick |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectChoiceField()
public ObjectChoiceField(String label,
Object[] choices)
label - Label for the field.choices - Array of objects for the field's list of choices.
public ObjectChoiceField(String label,
Object[] choices,
int initialIndex)
This method builds a new object choice field, and sets the initially selected value based on your index parameter. If the array of choices you provide is null, then this method ignores your index parameter, and sets the initially selected index to -1.
label - Label for this field.choices - Choices for this field; if this parameter is null, an
empty object choice field is created.initialIndex - Index of the initially selected value.
public ObjectChoiceField(String label,
Object[] choices,
int initialIndex,
long style)
This method builds a new object choice field of a specified style, and sets the initially selected value based on your index parameter. If the array of choices you provide is null, then this method ignores your index parameter, and sets the initially selected index to -1.
label - Label for this field.choices - Choices for this field; if this parameter is null, an
empty object choice field is created.initialIndex - Index of the initially selected value.style - Style value for the newly created field.
public ObjectChoiceField(String label,
Object[] choices,
Object initialObject)
This method builds a new object choice field, and sets the initially selected value to your provided initial object parameter.
label - Label for this field.choices - Choices for this field.initialObject - Object to make the initial selected
choice. To find a match for your initial object, this method invokes
ChoiceField.setSelectedIndex(Object).
public ObjectChoiceField(String label,
Object[] choices,
Object initialObject,
long style)
This method builds a new object choice field, and sets the initially selected value to your provided initial object parameter.
label - Label for this field.choices - Choices for this field.initialObject - Object to make the initial selected
choice. To find a match for your initial object, this method invokes
ChoiceField.setSelectedIndex(Object).style - Style value for the newly created field.| Method Detail |
|---|
public Object getChoice(int index)
getChoice in class ChoiceFieldindex - Index position in list of object you wish to retrieve.
ArrayIndexOutOfBoundsException - if the given index is less than 0 or greater than or equal to
the number of choices available.public void setChoices(Object[] choices)
Given a new array of choices, this method replaces this field's existing list with the one you provide. The selected choice is also reset to the first value in the new list (index zero).
choices - New list of choices for this field.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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.