|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.Container
de.enough.polish.ui.ChoiceGroup
public class ChoiceGroup
A ChoiceGroup is a group of selectable elements intended to be
placed within a Form. The group may be created with a mode that requires a
single choice to be made or that allows multiple choices. The
implementation is responsible for providing the graphical representation of
these modes and must provide visually different graphics for different
modes. For example, it might use "radio buttons" for the
single choice
mode and "check boxes" for the multiple choice mode.
Note: most of the essential methods have been
specified in the Choice interface.
| Field Summary | |
|---|---|
protected int |
choiceType
|
static Command |
MARK_COMMAND
|
static Command |
UNMARK_COMMAND
|
| Fields inherited from class de.enough.polish.ui.Container |
|---|
allowCycling, autoFocusEnabled, autoFocusIndex, containerView, enableScrolling, focusAllStyle, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressTime, lastPointerPressY, lastPointerPressYOffset, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollHeight, scrollSmooth, targetYOffset, yOffset |
| Fields inherited from interface de.enough.polish.ui.Choice |
|---|
EXCLUSIVE, IMPLICIT, MULTIPLE, POPUP, TEXT_WRAP_DEFAULT, TEXT_WRAP_OFF, TEXT_WRAP_ON |
| Constructor Summary | |
|---|---|
ChoiceGroup(String label,
int choiceType)
Creates a new, empty ChoiceGroup, specifying its
title and its type. |
|
ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items,
Style style)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items,
Style style,
boolean allowImplicit)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements,
Style style)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements,
Style style,
boolean allowImplicit)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
ChoiceGroup(String label,
int choiceType,
Style style)
Creates a new, empty ChoiceGroup, specifying its
title and its type. |
|
| Method Summary | |
|---|---|
int |
append(ChoiceItem item)
Appends a ChoiceItem to this choice group. |
int |
append(ChoiceItem item,
Style elementStyle)
Appends a ChoiceItem to this choice group. |
int |
append(String stringPart,
Image imagePart)
Appends an element to the ChoiceGroup. |
int |
append(String stringPart,
Image imagePart,
Style elementStyle)
Appends an element to the ChoiceGroup. |
protected static ChoiceItem[] |
buildChoiceItems(String[] stringElements,
Image[] imageElements,
int choiceType,
Style style)
Builds an array of ChoiceItems out of
an array of Strings and Images,
specifying the choiceType and style
common to any ChoiceItem in the resulting array. |
void |
clear()
Removes all items from this container. |
void |
commandAction(Command c,
Item item)
Called by the system to indicate that a command has been invoked on a particular item. |
protected String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected Image |
createPopupImage()
Creates or returns the default image for popup groups. |
void |
defocus(Style originalStyle)
Removes the focus from this item. |
void |
delete(int elementNum)
Deletes the element referenced by elementNum. |
void |
deleteAll()
Deletes all elements from this ChoiceGroup. |
protected Style |
focus(Style focusStyle,
int direction)
Focuses this item. |
int |
getFitPolicy()
Gets the application's preferred policy for fitting Choice element contents to the available screen space. |
Font |
getFont(int elementNum)
Gets the application's preferred font for rendering the specified element of this Choice. |
Image |
getImage(int elementNum)
Gets the Image part of the element referenced by
elementNum. |
ChoiceItem |
getItem(int elementNum)
Gets the ChoiceItem of the element referenced by
elementNum. |
int |
getSelectedFlags(boolean[] selectedArray_return)
Queries the state of a ChoiceGroup and returns the state of
all elements in the
boolean array
selectedArray_return. |
int |
getSelectedIndex()
Returns the index number of an element in the ChoiceGroup that is
selected. |
String |
getString(int elementNum)
Gets the String part of the element referenced by
elementNum. |
int |
getType()
Retrieves the choice type of this group |
protected boolean |
handleCommand(Command cmd)
Tries to handle the specified command. |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
protected boolean |
handleKeyReleased(int keyCode,
int gameAction)
Handles the key-released event. |
protected boolean |
handleNavigate(int keyCode,
int gameAction)
Handles a keyPressed or keyRepeated event for navigating in the container. |
protected boolean |
handlePointerPressed(int relX,
int relY)
Handles the event when a pointer has been pressed at the specified position. |
protected boolean |
handlePointerReleased(int relX,
int relY)
Handles the event when a pointer has been released at the specified position. |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
init(int firstLineWidth,
int availWidth,
int availHeight)
Initializes this item. |
protected void |
initContent(int firstLineWidth,
int availWidth,
int availHeight)
Initialises this item. |
void |
insert(int elementNum,
ChoiceItem item)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
void |
insert(int elementNum,
ChoiceItem item,
Style elementStyle)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
void |
insert(int elementNum,
String stringPart,
Image imagePart)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
void |
insert(int elementNum,
String stringPart,
Image imagePart,
Style elementStyle)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
boolean |
isInContentArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's (visible) content area. |
boolean |
isInItemArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's area including paddings, margins and label. |
boolean |
isPopupClosed()
Checks if the popup window is currently closed for a POPUP ChoiceGroup. |
boolean |
isSelected(int elementNum)
Gets a boolean value indicating whether this element is selected. |
void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints the content of this item. |
protected void |
selectChoiceItem(ChoiceItem item,
boolean isSelected)
Selects a choice item. |
void |
set(int elementNum,
String stringPart,
Image imagePart)
Sets the String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element. |
void |
set(int elementNum,
String stringPart,
Image imagePart,
Style elementStyle)
Sets the String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element. |
void |
setDefaultCommand(Command cmd)
Sets the command for selecting this (and opening this POPUP) choicegroup. |
void |
setFitPolicy(int fitPolicy)
Sets the application's preferred policy for fitting Choice element contents to the available screen space. |
void |
setFont(int elementNum,
Font font)
Sets the application's preferred font for rendering the specified element of this Choice. |
void |
setItemCommandListener(ItemCommandListener l)
Sets a listener for Commands to this Item,
replacing any previous
ItemCommandListener. |
void |
setItemsList(ArrayList itemsList)
Sets a list of items for this container. |
protected void |
setSelectCommand(Command command)
Sets the select command for this choice group. |
void |
setSelectedFlags(boolean[] selectedArray)
Attempts to set the selected state of every element in the ChoiceGroup. |
void |
setSelectedIndex(int elementNum,
boolean selected)
For ChoiceGroup objects of type
MULTIPLE, this simply sets an
individual element's selected state. |
void |
setStyle(Style style,
boolean resetStyle)
Sets the style of this item for animatable CSS attributes. |
void |
setStyleWithBackground(Style style,
boolean ignoreBackground)
Sets the style of this container. |
protected void |
updateInternalPosition(Item item)
Updates the internal position of this container according to the specified item's one |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface de.enough.polish.ui.Choice |
|---|
size |
| Field Detail |
|---|
public static Command MARK_COMMAND
public static Command UNMARK_COMMAND
protected int choiceType
| Constructor Detail |
|---|
public ChoiceGroup(String label,
int choiceType)
ChoiceGroup, specifying its
title and its type.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
choice type is not allowed within a ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUP
IllegalArgumentException - - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
Style style)
ChoiceGroup, specifying its
title and its type.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
choice type is not allowed within a ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstyle - the CSS style for this item
IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The stringElements array must be non-null and
every array element
must also be non-null. The length of the
stringElements array
determines the number of elements in the ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup elements have no images.
If the
imageElements array is non-null, it must be the
same length as the
stringElements array. Individual elements of the
imageElements array
may be null in order to indicate the absence of an
image for the
corresponding ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elements
NullPointerException - if stringElements is null or 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
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements,
Style style)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The stringElements array must be non-null and
every array element
must also be non-null. The length of the
stringElements array
determines the number of elements in the ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup elements have no images.
If the
imageElements array is non-null, it must be the
same length as the
stringElements array. Individual elements of the
imageElements array
may be null in order to indicate the absence of an
image for the
corresponding ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementsstyle - The CSS style for this item
NullPointerException - if stringElements is null or 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
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements,
Style style,
boolean allowImplicit)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The stringElements array must be non-null and
every array element
must also be non-null. The length of the
stringElements array
determines the number of elements in the ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup elements have no images.
If the
imageElements array is non-null, it must be the
same length as the
stringElements array. Individual elements of the
imageElements array
may be null in order to indicate the absence of an
image for the
corresponding ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementsstyle - The CSS style for this itemallowImplicit - true when the Choice.IMPLICIT choiceType is also allowed
NullPointerException - if stringElements is null or 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
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elements
NullPointerException - if items is null
or if getText() for one of the ChoiceItem in the array
retuns a null String.
IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items,
Style style)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elementsstyle - The CSS style for this item
NullPointerException - if items is null
or if getText() for one of the ChoiceItem in the array
retuns a null String.
IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public ChoiceGroup(String label,
int choiceType,
ChoiceItem[] items,
Style style,
boolean allowImplicit)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elementsstyle - The CSS style for this itemallowImplicit - true when the Choice.IMPLICIT choiceType is also allowed
IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP| Method Detail |
|---|
protected static ChoiceItem[] buildChoiceItems(String[] stringElements,
Image[] imageElements,
int choiceType,
Style style)
ChoiceItems out of
an array of Strings and Images,
specifying the choiceType and style
common to any ChoiceItem in the resulting array.
stringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementschoiceType - EXCLUSIVE, MULTIPLE, or POPUPstyle - The CSS style for this item
NullPointerException - if stringElements is null or if the stringElements array contains any null elements
IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements arrayChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUPprotected Image createPopupImage()
public String getString(int elementNum)
String part of the element referenced by
elementNum.
getString in interface ChoiceelementNum - the index of the element to be queried
IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getImage(int)public Image getImage(int elementNum)
Image part of the element referenced by
elementNum.
getImage in interface ChoiceelementNum - the number of the element to be queried
IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getString(int)public ChoiceItem getItem(int elementNum)
ChoiceItem of the element referenced by
elementNum.
elementNum - the number of the element to be queried
IndexOutOfBoundsException - if elementNum is invalid
public int append(String stringPart,
Image imagePart)
ChoiceGroup.
append in interface ChoicestringPart - the string part of the element to be addedimagePart - the image part of the element to be added, or null if there is no image part
NullPointerException - if stringPart is nullin interface Choice
public int append(String stringPart,
Image imagePart,
Style elementStyle)
ChoiceGroup.
stringPart - the string part of the element to be addedimagePart - the image part of the element to be added, or null if there is no image partelementStyle - the style for the appended ChoiceItem
NullPointerException - if stringPart is nullin interface Choicepublic int append(ChoiceItem item)
item - the item
public int append(ChoiceItem item,
Style elementStyle)
item - the itemelementStyle - the style of the item, ignored when null
public void insert(int elementNum,
String stringPart,
Image imagePart)
ChoiceGroup just prior to
the element specified.
insert in interface ChoiceelementNum - the index of the element where insertion is to occurstringPart - the string part of the element to be insertedimagePart - the image part of the element to be inserted, or null if there is no image part
IndexOutOfBoundsException - if elementNum is invalid
NullPointerException - if stringPart is nullin interface Choice
public void insert(int elementNum,
String stringPart,
Image imagePart,
Style elementStyle)
ChoiceGroup just prior to
the element specified.
elementNum - the index of the element where insertion is to occurstringPart - the string part of the element to be insertedimagePart - the image part of the element to be inserted, or null if there is no image partelementStyle - the style for the inserted ChoiceItem
IndexOutOfBoundsException - if elementNum is invalid
NullPointerException - if stringPart is nullin interface Choice
public void insert(int elementNum,
ChoiceItem item)
ChoiceGroup just prior to
the element specified.
elementNum - the index of the element where insertion is to occuritem - ChoiceItem of the element to be inserted
IndexOutOfBoundsException - if elementNum is invalid
public void insert(int elementNum,
ChoiceItem item,
Style elementStyle)
ChoiceGroup just prior to
the element specified.
elementNum - the index of the element where insertion is to occuritem - ChoiceItem of the element to be insertedelementStyle - the style for the inserted ChoiceItem
IndexOutOfBoundsException - if elementNum is invalid
public void set(int elementNum,
String stringPart,
Image imagePart)
String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element.
set in interface ChoiceelementNum - - the index of the element to be setstringPart - - the string part of the new elementimagePart - - the image part of the element, or null if there is no image part
IndexOutOfBoundsException - - if elementNum is invalid
NullPointerException - - if stringPart is nullin interface Choice
public void set(int elementNum,
String stringPart,
Image imagePart,
Style elementStyle)
String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element.
elementNum - the index of the element to be setstringPart - the string part of the new elementimagePart - the image part of the element, or null if there is no image partelementStyle - the style for the new list element.
IndexOutOfBoundsException - if elementNum is invalid
NullPointerException - if stringPart is nullin interface Choicepublic void delete(int elementNum)
elementNum.
delete in interface ChoiceelementNum - the index of the element to be deleted
IndexOutOfBoundsException - if elementNum is invalidin interface Choicepublic void deleteAll()
ChoiceGroup.
deleteAll in interface Choicein interface Choicepublic void clear()
Container
clear in class Containerpublic boolean isSelected(int elementNum)
isSelected in interface ChoiceelementNum - the index of the element to be queried
IndexOutOfBoundsException - if elementNum is invalidin interface Choicepublic int getSelectedIndex()
ChoiceGroup that is
selected. For ChoiceGroup objects of type
EXCLUSIVE and POPUP
there is at most one element selected, so
this method is useful for determining the user's choice.
Returns -1 if
there are no elements in the ChoiceGroup.
For ChoiceGroup objects of type
MULTIPLE, this always
returns -1 because no
single value can in general represent the state of such a
ChoiceGroup.
To get the complete state of a MULTIPLE
Choice, see getSelectedFlags.
getSelectedIndex in interface Choicein interface Choice,
setSelectedIndex(int, boolean)public int getSelectedFlags(boolean[] selectedArray_return)
ChoiceGroup and returns the state of
all elements in the
boolean array
selectedArray_return. Note: this
is a result parameter.
It must be at least as long as the size
of the ChoiceGroup as returned by size().
If the array is longer, the extra
elements are set to false.
For ChoiceGroup objects of type
MULTIPLE, any
number of elements may be selected and set to true in the result
array. For ChoiceGroup objects of type
EXCLUSIVE and POPUP
exactly one element will be selected, unless there are
zero elements in the ChoiceGroup.
getSelectedFlags in interface ChoiceselectedArray_return - array to contain the results
IllegalArgumentException - if selectedArray_return is shorter than the size of the ChoiceGroup
NullPointerException - if selectedArray_return is nullin interface Choice,
setSelectedFlags(boolean[])
public void setSelectedIndex(int elementNum,
boolean selected)
ChoiceGroup objects of type
MULTIPLE, this simply sets an
individual element's selected state.
For ChoiceGroup objects of type
EXCLUSIVE and POPUP, this can be used only to
select an element. That is, the selected parameter must
be true . When an element is selected, the previously
selected element is deselected. If selected is
false , this call is ignored.
For both list types, the elementNum parameter
must be within
the range
[0..size()-1], inclusive.
setSelectedIndex in interface ChoiceelementNum - the number of the element. Indexing of the elements is zero-basedselected - the new state of the element true=selected, false=not selected
IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getSelectedIndex()public void setSelectedFlags(boolean[] selectedArray)
ChoiceGroup. The array
must be at least as long as the size of the
ChoiceGroup. If the array is
longer, the additional values are ignored.
For ChoiceGroup objects of type
MULTIPLE, this sets the selected
state of every
element in the Choice. An arbitrary number of
elements may be selected.
For ChoiceGroup objects of type
EXCLUSIVE and POPUP, exactly one array
element must have the value true. If no element is
true,
the first element
in the Choice will be selected. If two or more
elements are true, the
implementation will choose the first true element
and select it.
setSelectedFlags in interface ChoiceselectedArray - an array in which the method collect the selection status
IllegalArgumentException - if selectedArray is shorter than the size of the ChoiceGroup
NullPointerException - if the selectedArray is nullin interface Choice,
getSelectedFlags(boolean[])public void setFitPolicy(int fitPolicy)
Choice element contents to the available screen space. The set policy applies for all
elements of the Choice object. Valid values are
Choice.TEXT_WRAP_DEFAULT,
Choice.TEXT_WRAP_ON,
and Choice.TEXT_WRAP_OFF.
Fit policy is a hint, and the
implementation may disregard the application's preferred policy.
The J2ME Polish implementation always uses the TEXT_WRAP_ON policy.
setFitPolicy in interface ChoicefitPolicy - preferred content fit policy for choice elementsin interface Choice,
getFitPolicy()public int getFitPolicy()
Choice element contents to the available screen space. The value returned is the
policy that had been set by the application, even if that value had
been disregarded by the implementation.
getFitPolicy in interface Choicein interface Choice,
setFitPolicy(int)
public void setFont(int elementNum,
Font font)
Choice.
An element's font is a hint, and the implementation may disregard
the application's preferred font.
The J2ME Polish implementation uses the font defined by the appropriate
CSS style and ignores the font which is set here.
setFont in interface ChoiceelementNum - the index of the element, starting from zerofont - the preferred font to use to render the element
IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getFont(int)public Font getFont(int elementNum)
Choice. The
value returned is the font that had been set by the application,
even if that value had been disregarded by the implementation.
If no font had been set by the application, or if the application
explicitly set the font to null, the value is the default
font chosen by the implementation.
The elementNum parameter must be within the range
[0..size()-1], inclusive.
getFont in interface ChoiceelementNum - the index of the element, starting from zero
IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
setFont(int elementNum, Font font)protected void hideNotify()
Containerpaint() calls will be made on this item
until after a showNotify() has been called again.
The container implementation calls hideNotify() on the embedded items.
hideNotify in class Container
public void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Item
paintContent in class Containerx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.
protected void init(int firstLineWidth,
int availWidth,
int availHeight)
Item
init in class ItemfirstLineWidth - the maximum width of the first lineavailWidth - the maximum width of any following linesavailHeight - the maximum height that can be used without scrollingItem.initContent(int, int, int),
ItemView.initContent(Item, int, int, int)
protected void initContent(int firstLineWidth,
int availWidth,
int availHeight)
Item
initContent in class ContainerfirstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelsItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeightprotected void updateInternalPosition(Item item)
Container
updateInternalPosition in class Containeritem - the (assumed focused) itemprotected String createCssSelector()
Item
createCssSelector in class Containerpublic boolean isPopupClosed()
protected boolean handleKeyPressed(int keyCode,
int gameAction)
Item
handleKeyPressed in class ContainerkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleNavigate(int keyCode,
int gameAction)
Container
handleNavigate in class ContainerkeyCode - the code of the keypress/keyrepeat eventgameAction - the associated game action
protected void selectChoiceItem(ChoiceItem item,
boolean isSelected)
item - the itemisSelected - true when it should be marked as selected
protected boolean handleKeyReleased(int keyCode,
int gameAction)
Item
handleKeyReleased in class ContainerkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
Item.handleKeyPressed(int, int)
protected boolean handlePointerPressed(int relX,
int relY)
Item
handlePointerPressed in class ContainerrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
protected boolean handlePointerReleased(int relX,
int relY)
Item
handlePointerReleased in class ContainerrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
public boolean isInContentArea(int relX,
int relY)
Item
isInContentArea in class ItemrelX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
Item.initContent(int, int, int)
public boolean isInItemArea(int relX,
int relY)
Item
isInItemArea in class ContainerrelX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
Item.initContent(int, int, int)protected void setSelectCommand(Command command)
command - the new select commandpublic void setDefaultCommand(Command cmd)
setDefaultCommand in class Itemcmd - the new command for selecting this choice grouppublic void defocus(Style originalStyle)
Item
defocus in class ContaineroriginalStyle - the original style which will be restored.
protected Style focus(Style focusStyle,
int direction)
Item
focus in class ContainerfocusStyle - the style which is used to indicate the focused statedirection - the direction from which this item is focused,
either Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT or 0.
When 0 is given, the direction is unknown.
public void setStyleWithBackground(Style style,
boolean ignoreBackground)
Container
setStyleWithBackground in class Containerstyle - the styleignoreBackground - when true is given, the background and border-settings
will be ignored.
public void setStyle(Style style,
boolean resetStyle)
Item
setStyle in interface UiElementsetStyle in class Containerstyle - the new style for this element.resetStyle - true when style settings should be resetted. This is not the case
when styles are animated, for example.
public void commandAction(Command c,
Item item)
ItemCommandListener
commandAction in interface ItemCommandListenerc - the Command that was invokeditem - the Item on which the command was invokedprotected boolean handleCommand(Command cmd)
Item
handleCommand in class Containercmd - the command
public void setItemCommandListener(ItemCommandListener l)
ItemCommands to this Item,
replacing any previous
ItemCommandListener. A null reference
is allowed and has the effect of removing any existing listener.
When no listener is registered, J2ME Polish notifies the
command-listener of the current screen, when an item command
has been selected.
It is illegal to call this method if this Item
is contained within an Alert.
setItemCommandListener in class Iteml - the new listener, or null.public void setItemsList(ArrayList itemsList)
Container
setItemsList in class ContaineritemsList - the list of items to setpublic int getType()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||