com.sun.lwuit
Class List

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.List
All Implemented Interfaces:
Animation, StyleListener
Direct Known Subclasses:
ComboBox, Spinner

public class List
extends Component

A set of elements that is rendered using a ListCellRenderer and are extracted via the ListModel.

A list can represent many UI concepts ranging from a carousel to a "todo" checklist, this is made possible thanks to extensive use of Swing's style of MVC. Specifically a list component is relatively simple, it invokes the model in order to extract the displayed/selected information and shows it to the user by invoking the cell renderer.

The list class itself is completely decoupled from everything, thus it allows us to extract its content from any source (e.g. network, storage etc.) and display the information in any form (e.g. checkboxed elemenents, icons etc.).

See Also:
com.sun.lwuit.list

Field Summary
static int FIXED_CENTER
          Indicates the list selection is fixed into place at the center of the list
static int FIXED_LEAD
          Indicates the list selection is fixed into place at the top of the list or at the left of the list
static int FIXED_NONE
          Indicates the list isn't fixed and that selection is movable
static int FIXED_NONE_CYCLIC
          Indicates that the list is not fixed in place but cycles its elements
static int FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE
          Indicates the list selection will only reach the edge when there are no more elements in the list.
static int FIXED_TRAIL
          Indicates the list selection is fixed into place at the bottom of the list or at the right of the list
static int HORIZONTAL
          Indicates the list orientation is HORIZONTAL
static int VERTICAL
          Indicates the list orientation is VERTICAL
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
List()
          Creates a new instance of List with an empty default model
List(ListModel model)
          Creates a new instance of List with the given model
List(java.lang.Object[] items)
          Creates a new instance of List
List(java.util.Vector items)
          Creates a new instance of List
 
Method Summary
 void addActionListener(ActionListener l)
          Allows binding a listener to user selection actions
 void addItem(java.lang.Object item)
          Allows adding an element to a list if the underlying model supports this, notice that it is an optional operation and if the model does not support it (default list model does) then this operation may failed.
 void addSelectionListener(SelectionListener l)
          Invoked to indicate interest in future selection events
 boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
protected  void fireActionEvent()
          This method allows us to detect an action event internally without implementing the action listener interface.
protected  void fireClicked()
          When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly.
 java.util.Vector getActionListeners()
          This method allows extracting the action listeners from the current list
 int getFixedSelection()
          Indicates whether selection is fixable to place in which case all the elements in the list move and selection stays in place.
protected  int getGridPosX()
          This method should be implemented correctly by subclasses to make snap to grid functionality work as expected.
protected  int getGridPosY()
          This method should be implemented correctly by subclasses to make snap to grid functionality work as expected.
 java.lang.String getHint()
          Returns the hint text
 Image getHintIcon()
          Returns the hint icon
 int getItemGap()
          Returns the gap between items
 int getListSizeCalculationSampleCount()
          Indicates the number of elements the list should check to determine the element sizes.
 int getMinElementHeight()
          Minimum number of elements shown in a list, this member is used to calculate the list preferred size.
 ListModel getModel()
          Returns the model underlying the list
 int getOrientation()
          Returns the list orientation
 ListCellRenderer getRenderer()
          Returns the renderer which is used to draw list elements
 java.lang.Object getRenderingPrototype()
          See set rendering prototype
 int getSelectedIndex()
          Returns the current selected offset in the list
 java.lang.Object getSelectedItem()
          Returns the current selected item in the list or null for no selection
 Rectangle getSelectedRect()
          Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior and are not containers (currently only List) this method allows returning the position of the selection itself which is useful for things such as the popup dialog and similar UI's that need to reference the position of the selection externally
 int getSideGap()
          Returns the gap to be left for the side scrollbar on the Y axis.
protected  Rectangle getVisibleBounds()
          Returns the component bounds for scrolling which might differ from the getBounds for large components e.g. list.
 boolean isCommandList()
          Indicates that the list should be treated as a list of commands, if the user "clicks" a command from the list its action performed method is invoked.
static boolean isDefaultFireOnClick()
          Default value for the fire on click behavior
static boolean isDefaultIgnoreFocusComponentWhenUnfocused()
          Indicates whether the list should not paint the focus component if the list itself has no focus.
 boolean isIgnoreFocusComponentWhenUnfocused()
          Indicates whether the list should not paint the focus component if the list itself has no focus.
 boolean isMutableRendererBackgrounds()
          Indicates that the background of a cell renderer might mutate between one entry and the next, it is recommended that this flag remains false for performance reasons.
 boolean isNumericKeyActions()
          Indicate whether pressing the number keys should trigger an action
 boolean isScrollableX()
          Indicates whether the component should/could scroll on the X axis
 boolean isScrollableY()
          Indicates whether the component should/could scroll on the Y axis
protected  boolean isSelectableInteraction()
          This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.
protected  boolean isTactileTouch(int x, int y)
          Elaborate components might not provide tactile feedback for all their areas (e.g.
 void keyPressed(int keyCode)
          If this Component is focused, the key pressed event will call this method
 void keyReleased(int keyCode)
          If this Component is focused, the key released event will call this method
protected  void laidOut()
          This is a callback method to inform the Component when it's been laidout on the parent Container
protected  void listSelectionChanged(int oldSelected, int newSelected)
          Callback to allow subclasses to react to a selection change in the model
protected  void longPointerPress(int x, int y)
          If this Component is focused this method is invoked when the user presses and holds the pointer on the Component
protected  void modelChanged(int status, int index)
          Callback to allow subclasses to react to a change in the model
 void paint(Graphics g)
          This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
protected  java.lang.String paramString()
          Returns a string representing the state of this component.
 void pointerDragged(int x, int y)
          If this Component is focused, the pointer dragged event will call this method
 void pointerHover(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerHoverReleased(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerPressed(int x, int y)
          If this Component is focused, the pointer pressed event will call this method
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method
 void refreshTheme()
          Makes sure the component is up to date with the current style object
 void removeActionListener(ActionListener l)
          Allows binding a listener to user selection actions
 void removeSelectionListener(SelectionListener l)
          Invoked to indicate no further interest in future selection events
 void scrollRectToVisible(Rectangle rect)
          Makes sure the selected index is visible if it is not in the current view rect the list will scroll so it fits within
 void setCommandList(boolean commandList)
          Indicates that the list should be treated as a list of commands, if the user "clicks" a command from the list its action performed method is invoked.
static void setDefaultFireOnClick(boolean aDefaultFireOnClick)
          Default value for the fire on click behavior
static void setDefaultIgnoreFocusComponentWhenUnfocused(boolean aDefaultIgnoreFocusComponentWhenUnfocused)
          Indicates whether the list should not paint the focus component if the list itself has no focus.
 void setFireOnClick(boolean fireOnClick)
          This method determines if the List fires the action event when the pointer was clicked on one of the items, or only if the item was the selected item By default the value is true, this setting is only relevant for none fixed Lists
 void setFixedSelection(int fixedSelection)
          Indicates whether selection is fixable to place in which case all the elements in the list move and selection stays in place.
 void setHandlesInput(boolean b)
          Prevents key events from being grabbed for focus traversal.
 void setHint(java.lang.String hint)
          Sets the TextArea hint text, the hint text is displayed on the TextArea When there is no text in the TextArea
 void setHint(java.lang.String hint, Image icon)
          Sets the TextArea hint text and Icon, the hint text and icon are displayed on the TextArea when there is no text in the TextArea
 void setHintIcon(Image icon)
          Sets the TextArea hint icon, the hint is displayed on the TextArea When there is no text in the TextArea
 void setIgnoreFocusComponentWhenUnfocused(boolean ignoreFocusComponentWhenUnfocused)
          Indicates whether the list should not paint the focus component if the list itself has no focus.
 void setInputOnFocus(boolean inputOnFocus)
          A list can start handling input implicitly upon gaining focus, this can make for a more intuitive UI when no other focus elements exist or when their use case is infrequent.
 void setItemGap(int itemGap)
          Set the gap between items
 void setListCellRenderer(ListCellRenderer renderer)
          Deprecated. use setRenderer instead, this method was deprecated to confirm better to JavaBean convention of having the getter/setter with the same name
 void setListSizeCalculationSampleCount(int listSizeCalculationSampleCount)
          Indicates the number of elements the list should check to determine the element sizes.
 void setMinElementHeight(int minElementHeight)
          Minimum number of elements shown in a list, this member is used to calculate the list preferred size.
 void setModel(ListModel model)
          Replaces/sets the model underlying the list
 void setMutableRendererBackgrounds(boolean mutableRendererBackgrounds)
          Indicates that the background of a cell renderer might mutate between one entry and the next, it is recommended that this flag remains false for performance reasons.
 void setNumericKeyActions(boolean numericKeyActions)
          Indicate whether pressing the number keys should trigger an action
 void setOrientation(int orientation)
          Sets the list orientation HORIZONTAL or VERTICAL
 void setPaintFocusBehindList(boolean paintFocusBehindList)
          This method determines if the animated focus is drawn on top of the List or behind the List when moving.
 void setRenderer(ListCellRenderer renderer)
          Sets the renderer which is used to draw list elements
 void setRenderingPrototype(java.lang.Object renderingPrototype)
          The rendering prototype is optionally used in calculating the size of the List and is recommended for performance reasons.
 void setScrollToSelected(boolean scrollToSelected)
          This flag indicates to the List if the List should scroll to the selected element when it's been initialized.
 void setSelectedIndex(int index)
          Sets the current selected offset in the list, by default this implementation will scroll the list to the selection if the selection is outside of the screen
 void setSelectedIndex(int index, boolean scrollToSelection)
          Sets the current selected offset in the list
 void setSelectedItem(java.lang.Object item)
          Sets the current selected item in the list
 void setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
          Indicates the values within the component have changed and preferred size should be recalculated
 int size()
          Returns the number of elements in the list, shorthand for getModel().getSize()
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, longKeyPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIXED_NONE

public static final int FIXED_NONE
Indicates the list isn't fixed and that selection is movable

See Also:
Constant Field Values

FIXED_NONE_CYCLIC

public static final int FIXED_NONE_CYCLIC
Indicates that the list is not fixed in place but cycles its elements

See Also:
Constant Field Values

FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE

public static final int FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE
Indicates the list selection will only reach the edge when there are no more elements in the list.

See Also:
Constant Field Values

FIXED_LEAD

public static final int FIXED_LEAD
Indicates the list selection is fixed into place at the top of the list or at the left of the list

See Also:
Constant Field Values

FIXED_TRAIL

public static final int FIXED_TRAIL
Indicates the list selection is fixed into place at the bottom of the list or at the right of the list

See Also:
Constant Field Values

FIXED_CENTER

public static final int FIXED_CENTER
Indicates the list selection is fixed into place at the center of the list

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Indicates the list orientation is VERTICAL

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
Indicates the list orientation is HORIZONTAL

See Also:
Constant Field Values
Constructor Detail

List

public List(java.util.Vector items)
Creates a new instance of List

Parameters:
items - set of items placed into the list model

List

public List(java.lang.Object[] items)
Creates a new instance of List

Parameters:
items - set of items placed into the list model

List

public List()
Creates a new instance of List with an empty default model


List

public List(ListModel model)
Creates a new instance of List with the given model

Parameters:
model - the model instance
Method Detail

isDefaultIgnoreFocusComponentWhenUnfocused

public static boolean isDefaultIgnoreFocusComponentWhenUnfocused()
Indicates whether the list should not paint the focus component if the list itself has no focus.

Returns:
the defaultIgnoreFocusComponentWhenUnfocused

setDefaultIgnoreFocusComponentWhenUnfocused

public static void setDefaultIgnoreFocusComponentWhenUnfocused(boolean aDefaultIgnoreFocusComponentWhenUnfocused)
Indicates whether the list should not paint the focus component if the list itself has no focus.

Parameters:
aDefaultIgnoreFocusComponentWhenUnfocused - the defaultIgnoreFocusComponentWhenUnfocused to set

isDefaultFireOnClick

public static boolean isDefaultFireOnClick()
Default value for the fire on click behavior

Returns:
the defaultFireOnClick

setDefaultFireOnClick

public static void setDefaultFireOnClick(boolean aDefaultFireOnClick)
Default value for the fire on click behavior

Parameters:
aDefaultFireOnClick - the defaultFireOnClick to set

laidOut

protected void laidOut()
Description copied from class: Component
This is a callback method to inform the Component when it's been laidout on the parent Container

Overrides:
laidOut in class Component

modelChanged

protected void modelChanged(int status,
                            int index)
Callback to allow subclasses to react to a change in the model

Parameters:
status - the type data change; REMOVED, ADDED or CHANGED
index - item index in a list model

listSelectionChanged

protected void listSelectionChanged(int oldSelected,
                                    int newSelected)
Callback to allow subclasses to react to a selection change in the model

Parameters:
oldSelected - the old selection value
newSelected - the new selection value

getSideGap

public int getSideGap()
Description copied from class: Component
Returns the gap to be left for the side scrollbar on the Y axis. This method is used by layout managers to determine the room they should leave for the scrollbar. (note: side scrollbar rather than left scrollbar is used for a future version that would support bidi).

Overrides:
getSideGap in class Component
Returns:
the gap to be left for the side scrollbar on the Y axis

isScrollableY

public boolean isScrollableY()
Description copied from class: Component
Indicates whether the component should/could scroll on the Y axis

Overrides:
isScrollableY in class Component
Returns:
whether the component is scrollable on the X axis

isScrollableX

public boolean isScrollableX()
Description copied from class: Component
Indicates whether the component should/could scroll on the X axis

Overrides:
isScrollableX in class Component
Returns:
whether the component is scrollable on the X axis

getMinElementHeight

public int getMinElementHeight()
Minimum number of elements shown in a list, this member is used to calculate the list preferred size. If the number of elements in the model is smaller than this then this value is used in the calculations.

Returns:
the minimum number of elements

setMinElementHeight

public void setMinElementHeight(int minElementHeight)
Minimum number of elements shown in a list, this member is used to calculate the list preferred size. If the number of elements in the model is smaller than this then this value is used in the calculations.

Parameters:
minElementHeight - the minimum number of elements

size

public int size()
Returns the number of elements in the list, shorthand for getModel().getSize()

Returns:
the number of elements in the list

getSelectedIndex

public int getSelectedIndex()
Returns the current selected offset in the list

Returns:
the current selected offset in the list

setSelectedIndex

public void setSelectedIndex(int index)
Sets the current selected offset in the list, by default this implementation will scroll the list to the selection if the selection is outside of the screen

Parameters:
index - the current selected offset in the list

getVisibleBounds

protected Rectangle getVisibleBounds()
Description copied from class: Component
Returns the component bounds for scrolling which might differ from the getBounds for large components e.g. list.

Overrides:
getVisibleBounds in class Component
Returns:
the component bounds
See Also:
Component.getX(), Component.getY()

setSelectedIndex

public void setSelectedIndex(int index,
                             boolean scrollToSelection)
Sets the current selected offset in the list

Parameters:
index - the current selected offset in the list
scrollToSelection - indicates whether scrolling to selection should occur if the selection is outside of view

getSelectedItem

public java.lang.Object getSelectedItem()
Returns the current selected item in the list or null for no selection

Returns:
the current selected item in the list

setSelectedItem

public void setSelectedItem(java.lang.Object item)
Sets the current selected item in the list

Parameters:
item - the current selected item in the list

getModel

public ListModel getModel()
Returns the model underlying the list

Returns:
the model underlying the list

setShouldCalcPreferredSize

public void setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
Description copied from class: Component
Indicates the values within the component have changed and preferred size should be recalculated

Overrides:
setShouldCalcPreferredSize in class Component
Parameters:
shouldCalcPreferredSize - indicate whether this component need to recalculate his preferred size

setModel

public void setModel(ListModel model)
Replaces/sets the model underlying the list

Parameters:
model - the new model underlying the list

isNumericKeyActions

public boolean isNumericKeyActions()
Indicate whether pressing the number keys should trigger an action

Returns:
true if pressing the number keys should trigger an action

setNumericKeyActions

public void setNumericKeyActions(boolean numericKeyActions)
Indicate whether pressing the number keys should trigger an action

Parameters:
numericKeyActions - true to trigger an action on number keys

isCommandList

public boolean isCommandList()
Indicates that the list should be treated as a list of commands, if the user "clicks" a command from the list its action performed method is invoked.

Returns:
true if the list is treated as a command list

setCommandList

public void setCommandList(boolean commandList)
Indicates that the list should be treated as a list of commands, if the user "clicks" a command from the list its action performed method is invoked.

Parameters:
commandList - true for the list to be treated as a command list

isIgnoreFocusComponentWhenUnfocused

public boolean isIgnoreFocusComponentWhenUnfocused()
Indicates whether the list should not paint the focus component if the list itself has no focus.

Returns:
the ignoreFocusComponentWhenUnfocused

setIgnoreFocusComponentWhenUnfocused

public void setIgnoreFocusComponentWhenUnfocused(boolean ignoreFocusComponentWhenUnfocused)
Indicates whether the list should not paint the focus component if the list itself has no focus.

Parameters:
ignoreFocusComponentWhenUnfocused - true to ignore the focus component false otherwise

isMutableRendererBackgrounds

public boolean isMutableRendererBackgrounds()
Indicates that the background of a cell renderer might mutate between one entry and the next, it is recommended that this flag remains false for performance reasons.

Returns:
the value of the flag

setMutableRendererBackgrounds

public void setMutableRendererBackgrounds(boolean mutableRendererBackgrounds)
Indicates that the background of a cell renderer might mutate between one entry and the next, it is recommended that this flag remains false for performance reasons.

Parameters:
mutableRendererBackgrounds - the new value for the flag

getListSizeCalculationSampleCount

public int getListSizeCalculationSampleCount()
Indicates the number of elements the list should check to determine the element sizes. This is ignored when a rendering prototype is present.

Returns:
the listSizeCalculationSampleCount

setListSizeCalculationSampleCount

public void setListSizeCalculationSampleCount(int listSizeCalculationSampleCount)
Indicates the number of elements the list should check to determine the element sizes. This is ignored when a rendering prototype is present.

Parameters:
listSizeCalculationSampleCount - the listSizeCalculationSampleCount to set

setRenderer

public void setRenderer(ListCellRenderer renderer)
Sets the renderer which is used to draw list elements

Parameters:
renderer - cell renderer instance

setListCellRenderer

public void setListCellRenderer(ListCellRenderer renderer)
Deprecated. use setRenderer instead, this method was deprecated to confirm better to JavaBean convention of having the getter/setter with the same name

Sets the renderer which is used to draw list elements

Parameters:
renderer - cell renderer instance

getRenderer

public ListCellRenderer getRenderer()
Returns the renderer which is used to draw list elements

Returns:
the renderer which is used to draw list elements

getOrientation

public int getOrientation()
Returns the list orientation

Returns:
the list orientation HORIZONTAL or VERTICAL
See Also:
HORIZONTAL, VERTICAL

refreshTheme

public void refreshTheme()
Description copied from class: Component
Makes sure the component is up to date with the current style object

Overrides:
refreshTheme in class Component

setOrientation

public void setOrientation(int orientation)
Sets the list orientation HORIZONTAL or VERTICAL

Parameters:
orientation - the list orientation HORIZONTAL or VERTICAL
See Also:
HORIZONTAL, VERTICAL

scrollRectToVisible

public void scrollRectToVisible(Rectangle rect)
Makes sure the selected index is visible if it is not in the current view rect the list will scroll so it fits within

Parameters:
rect - the rectangle area to scroll to

setHandlesInput

public void setHandlesInput(boolean b)
Description copied from class: Component
Prevents key events from being grabbed for focus traversal. E.g. a list component might use the arrow keys for internal navigation so it will switch this flag to true in order to prevent the focus manager from moving to the next component.

Overrides:
setHandlesInput in class Component
Parameters:
b - indicates whether key events can be grabbed for focus traversal

fireClicked

protected void fireClicked()
Description copied from class: Component
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly. When overriding this method you should also override isSelectableInteraction to indicate that a command is placed appropriately on top of the fire key for 3 soft button phones.

Overrides:
fireClicked in class Component

isSelectableInteraction

protected boolean isSelectableInteraction()
Description copied from class: Component
This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.

Overrides:
isSelectableInteraction in class Component
Returns:
true if this is a selectable interaction

keyReleased

public void keyReleased(int keyCode)
Description copied from class: Component
If this Component is focused, the key released event will call this method

Overrides:
keyReleased in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

keyPressed

public void keyPressed(int keyCode)
Description copied from class: Component
If this Component is focused, the key pressed event will call this method

Overrides:
keyPressed in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

paint

public void paint(Graphics g)
Description copied from class: Component
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

Specified by:
paint in interface Animation
Overrides:
paint in class Component
Parameters:
g - the component graphics

addSelectionListener

public void addSelectionListener(SelectionListener l)
Invoked to indicate interest in future selection events

Parameters:
l - the selection listener to be added

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
Invoked to indicate no further interest in future selection events

Parameters:
l - the selection listener to be removed

addActionListener

public void addActionListener(ActionListener l)
Allows binding a listener to user selection actions

Parameters:
l - the action listener to be added

getActionListeners

public java.util.Vector getActionListeners()
This method allows extracting the action listeners from the current list

Returns:
vector containing the action listeners on the list

removeActionListener

public void removeActionListener(ActionListener l)
Allows binding a listener to user selection actions

Parameters:
l - the action listener to be removed

fireActionEvent

protected void fireActionEvent()
Description copied from class: Component
This method allows us to detect an action event internally without implementing the action listener interface.


setInputOnFocus

public void setInputOnFocus(boolean inputOnFocus)
A list can start handling input implicitly upon gaining focus, this can make for a more intuitive UI when no other focus elements exist or when their use case is infrequent. However, it might be odd in some cases where the list "steals" focus.

Parameters:
inputOnFocus - true is a list can start handling input implicitly upon gaining focus

setPaintFocusBehindList

public void setPaintFocusBehindList(boolean paintFocusBehindList)
This method determines if the animated focus is drawn on top of the List or behind the List when moving.

Parameters:
paintFocusBehindList -

getItemGap

public int getItemGap()
Returns the gap between items

Returns:
the gap between items

setItemGap

public void setItemGap(int itemGap)
Set the gap between items

Parameters:
itemGap - the gap between items

setRenderingPrototype

public void setRenderingPrototype(java.lang.Object renderingPrototype)
The rendering prototype is optionally used in calculating the size of the List and is recommended for performance reasons. You should invoke it with an object representing a theoretical value in the list which will be used to calculate the size required for each element in the list.

This allows list size calculations to work across look and feels and allows developers to predetermin size for list elements.

e.g. For a list of Strings which you would like to always be 5 characters wide you can use a prototype "XXXXX" which would use the preferred size of the XXXXX String to determine the size of the list element. E.g. for a list of dates you can use new Date(30, 12, 00) etc..

Parameters:
renderingPrototype - a value that can be passed to the renderer to indicate the preferred size of a list component.

getRenderingPrototype

public java.lang.Object getRenderingPrototype()
See set rendering prototype

Returns:
the value of the rendering prototype
See Also:
setRenderingPrototype(java.lang.Object)

longPointerPress

protected void longPointerPress(int x,
                                int y)
Description copied from class: Component
If this Component is focused this method is invoked when the user presses and holds the pointer on the Component

Overrides:
longPointerPress in class Component

pointerPressed

public void pointerPressed(int x,
                           int y)
Description copied from class: Component
If this Component is focused, the pointer pressed event will call this method

Overrides:
pointerPressed in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerHover

public void pointerHover(int[] x,
                         int[] y)
Description copied from class: Component
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

Overrides:
pointerHover in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerDragged

public void pointerDragged(int x,
                           int y)
Description copied from class: Component
If this Component is focused, the pointer dragged event will call this method

Overrides:
pointerDragged in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

getSelectedRect

public Rectangle getSelectedRect()
Description copied from class: Component
Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior and are not containers (currently only List) this method allows returning the position of the selection itself which is useful for things such as the popup dialog and similar UI's that need to reference the position of the selection externally

Overrides:
getSelectedRect in class Component
Returns:
the bounds of the component with absolute screen coordinates

setFireOnClick

public void setFireOnClick(boolean fireOnClick)
This method determines if the List fires the action event when the pointer was clicked on one of the items, or only if the item was the selected item By default the value is true, this setting is only relevant for none fixed Lists

Parameters:
fireOnClick -

pointerHoverReleased

public void pointerHoverReleased(int[] x,
                                 int[] y)
Description copied from class: Component
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

Overrides:
pointerHoverReleased in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method

Overrides:
pointerReleased in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class Component
Returns:
the calculated preferred size based on component content

addItem

public void addItem(java.lang.Object item)
Allows adding an element to a list if the underlying model supports this, notice that it is an optional operation and if the model does not support it (default list model does) then this operation may failed.

Parameters:
item - the item to be added to a list model

getFixedSelection

public int getFixedSelection()
Indicates whether selection is fixable to place in which case all the elements in the list move and selection stays in place.

Returns:
one of: FIXED_NONE, FIXED_TRAIL, FIXED_LEAD, FIXED_CENTER, FIXED_NONE_CYCLIC

setFixedSelection

public void setFixedSelection(int fixedSelection)
Indicates whether selection is fixable to place in which case all the elements in the list move and selection stays in place.

Parameters:
fixedSelection - one of: FIXED_NONE, FIXED_TRAIL, FIXED_LEAD, FIXED_CENTER, FIXED_NONE_CYCLIC

animate

public boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the Display class.

Specified by:
animate in interface Animation
Overrides:
animate in class Component
Returns:
true if a repaint is desired or false if no repaint is necessary

isTactileTouch

protected boolean isTactileTouch(int x,
                                 int y)
Description copied from class: Component
Elaborate components might not provide tactile feedback for all their areas (e.g. Lists) this method defaults to returning the value of isTactileTouch

Overrides:
isTactileTouch in class Component
Parameters:
x - the x position
y - the y position
Returns:
True if the device should vibrate

setScrollToSelected

public void setScrollToSelected(boolean scrollToSelected)
This flag indicates to the List if the List should scroll to the selected element when it's been initialized.

Parameters:
scrollToSelected - if true the List scrolls to the selected element when It's been initalized.

getGridPosY

protected int getGridPosY()
Description copied from class: Component
This method should be implemented correctly by subclasses to make snap to grid functionality work as expected. Returns the ideal grid Y position closest to the current Y position.

Overrides:
getGridPosY in class Component
Returns:
a valid Y position in the grid

getGridPosX

protected int getGridPosX()
Description copied from class: Component
This method should be implemented correctly by subclasses to make snap to grid functionality work as expected. Returns the ideal grid X position closest to the current X position.

Overrides:
getGridPosX in class Component
Returns:
a valid Y position in the grid

paramString

protected java.lang.String paramString()
Description copied from class: Component
Returns a string representing the state of this component. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class Component
Returns:
a string representation of this component's state

setHint

public void setHint(java.lang.String hint)
Sets the TextArea hint text, the hint text is displayed on the TextArea When there is no text in the TextArea

Parameters:
hint - the hint text to display

getHint

public java.lang.String getHint()
Returns the hint text

Returns:
the hint text or null

setHintIcon

public void setHintIcon(Image icon)
Sets the TextArea hint icon, the hint is displayed on the TextArea When there is no text in the TextArea

Parameters:
icon - the icon

getHintIcon

public Image getHintIcon()
Returns the hint icon

Returns:
the hint icon

setHint

public void setHint(java.lang.String hint,
                    Image icon)
Sets the TextArea hint text and Icon, the hint text and icon are displayed on the TextArea when there is no text in the TextArea

Parameters:
hint - the hint text to display
icon - the hint icon to display