com.sybase.uep.bobclient.controls
Class ListFieldControl

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.component.ListField
          extended by com.sybase.uep.bobclient.controls.ListFieldControl
All Implemented Interfaces:
Control

public class ListFieldControl
extends net.rim.device.api.ui.component.ListField
implements Control

List Field Control class Contains the list of ListItems

Author:
tdang

Field Summary
 
Fields inherited from class net.rim.device.api.ui.component.ListField
MULTI_SELECT, NO_ALTED_PAGE_UP_DOWN, NON_CONTIGUOUS_SELECT, ROW_HEIGHT_FONT
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Constructor Summary
ListFieldControl(long style)
          Constructor to create List Field Control
 
Method Summary
 void addListItem(ListItem listItem)
          Add ListItem to the list field
 void addMenuItem(net.rim.device.api.ui.MenuItem menu)
          Add Menu Item
 void addMenuSeperator()
          Add menu seperator
 void clearMenuItems()
          Remove all the menu items
protected  void drawFocus(net.rim.device.api.ui.Graphics graphics, boolean on)
          (non-Javadoc)
 void drawListItem(net.rim.device.api.ui.Graphics g, int index, boolean focus)
          Draw the list item
 int getColSpan()
          (non-Javadoc)
 int getControlID()
          Returns the control's ID
 ICustomEventsDelegate getCustomEventsDelegate()
          Returns the control's custom events delegate
 long getHorizontalAlignment()
          (non-Javadoc)
 ListItem getListItemAt(int index)
          Retrieve the ListItem by index
 ListItem[] getListItems()
          Retrieve the ListItems
 java.lang.String getName()
          (non-Javadoc)
 int getPreferredHeight()
          (non-Javadoc)
 int getPreferredWidth()
          (non-Javadoc)
 int getRowSpan()
          (non-Javadoc)
 java.lang.Object getValue()
          (non-Javadoc)
 long getVerticalAlignment()
          (non-Javadoc)
 int getYLocation(int index)
          Retrieve the Y location of the next list item to be drawn
protected  void layout(int width, int height)
          (non-Javadoc)
protected  void makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
          (non-Javadoc)
protected  int moveFocus(int amount, int status, int time)
          (non-Javadoc)
protected  void moveFocus(int x, int y, int status, int time)
          (non-Javadoc)
protected  boolean navigationClick(int status, int time)
          (non-Javadoc)
protected  boolean navigationMovement(int dx, int dy, int status, int time)
          (non-Javadoc)
protected  boolean navigationUnclick(int status, int time)
          (non-Javadoc)
protected  void onFocus(int direction)
          (non-Javadoc)
protected  void onUnfocus()
          (non-Javadoc)
protected  void paint(net.rim.device.api.ui.Graphics g)
          (non-Javadoc)
 void refresh()
          (non-Javadoc)
 void refreshFooter(java.lang.String valueToBeDisplay)
          Refresh the footer field from the screen that contains the text of the list item.
 void removeAllListItems()
          Remove all the ListItems
 void setBackgroundColor(int bgcolor)
          (non-Javadoc)
 void setColSpan(int colspan)
          (non-Javadoc)
 void setControlID(int controlID)
          Sets the control's ID
 void setCustomEventsDelegate(ICustomEventsDelegate delegate, int eventsFlags)
          Sets the control's custom events delegate for the given events
 void setFooterField(FooterField field)
          Set the footer field
 void setLayoutHeight(int height)
          (non-Javadoc)
 void setLayoutWidth(int width)
          (non-Javadoc)
 void setListItems(ListItem[] list)
          Set list items
 void setListItems(java.util.Vector items)
          Set list items
 void setRowSpan(int rowspan)
          (non-Javadoc)
protected  boolean touchEvent(net.rim.device.api.ui.TouchEvent message)
          (non-Javadoc)
 
Methods inherited from class net.rim.device.api.ui.component.ListField
delete, getAccessibleContext, getCallback, getEmptyString, getEmptyStringStyle, getFocusRect, getRowHeight, getRowHeight, getSelectedIndex, getSelection, getSize, getVisibleLinesPageDown, indexOfList, insert, invalidate, invalidate, invalidateRange, isEmpty, keyChar, keyControl, setCallback, setEmptyString, setEmptyString, setRowHeight, setRowHeight, setSearchable, setSelectedIndex, setSize, setSize
 
Methods inherited from class net.rim.device.api.ui.Field
drawHighlightRegion, fieldChangeNotify, focusAdd, focusChangeNotify, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getScreen, getState, getStyle, getTop, getVisualState, getWidth, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isFocus, isFocusable, isMuddy, isPasteable, isSelectable, isSelecting, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, keyDown, keyRepeat, keyStatus, keyUp, makeContextMenu, onDisplay, onExposed, onMenuDismissed, onMenuDismissed, onObscured, onUndisplay, onVisibilityChange, paintBackground, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setFont, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListFieldControl

public ListFieldControl(long style)
Constructor to create List Field Control

Parameters:
style - long value for the style of this label control eg. Field.FIELD_LEFT, Field.FIELD_RIGHT, Field.FIELD_HCENTER, etc.
See Also:
Field
Method Detail

setLayoutWidth

public void setLayoutWidth(int width)
(non-Javadoc)

Specified by:
setLayoutWidth in interface Control
Parameters:
width - int value of the available layout width
See Also:
Control.setLayoutWidth(int width)

getPreferredWidth

public int getPreferredWidth()
(non-Javadoc)

Specified by:
getPreferredWidth in interface Control
Overrides:
getPreferredWidth in class net.rim.device.api.ui.component.ListField
Returns:
int value of the available layout width
See Also:
Control.getPreferredWidth()

setLayoutHeight

public void setLayoutHeight(int height)
(non-Javadoc)

Specified by:
setLayoutHeight in interface Control
Parameters:
height - int value of the available layout height
See Also:
Control.setLayoutHeight(int height)

getPreferredHeight

public int getPreferredHeight()
(non-Javadoc)

Specified by:
getPreferredHeight in interface Control
Overrides:
getPreferredHeight in class net.rim.device.api.ui.Field
Returns:
int value of the available layout height
See Also:
Control.getPreferredHeight()

getValue

public java.lang.Object getValue()
(non-Javadoc)

Specified by:
getValue in interface Control
Returns:
Object of the value set for this control
See Also:
Control.getValue()

getName

public java.lang.String getName()
(non-Javadoc)

Specified by:
getName in interface Control
Returns:
String value of the key name
See Also:
Control.getName()

setColSpan

public void setColSpan(int colspan)
(non-Javadoc)

Specified by:
setColSpan in interface Control
Parameters:
colspan - int value of the column span
See Also:
Control.setColSpan(int colspan)

getColSpan

public int getColSpan()
(non-Javadoc)

Specified by:
getColSpan in interface Control
Returns:
int value of the column span
See Also:
Control.getColSpan()

setRowSpan

public void setRowSpan(int rowspan)
(non-Javadoc)

Specified by:
setRowSpan in interface Control
Parameters:
rowspan - int value of the row span
See Also:
Control.setRowSpan(int rowspan)

getRowSpan

public int getRowSpan()
(non-Javadoc)

Specified by:
getRowSpan in interface Control
Returns:
int value of the row span
See Also:
Control.getRowSpan()

getHorizontalAlignment

public long getHorizontalAlignment()
(non-Javadoc)

Specified by:
getHorizontalAlignment in interface Control
Returns:
long value of the horizontal alignment. Possible values could be Field.FIELD_HCENTER, Field.FIELD_RIGHT, or Field.FIELD_LEFT
See Also:
Control.getHorizontalAlignment()

getVerticalAlignment

public long getVerticalAlignment()
(non-Javadoc)

Specified by:
getVerticalAlignment in interface Control
Returns:
long value of the vertical alignment Possible values could be Field.FIELD_TOP, Field.FIELD_BOTTOM, or Field.FIELD_VCENTER
See Also:
Control.getVerticalAlignment()

refresh

public void refresh()
(non-Javadoc)

Specified by:
refresh in interface Control
See Also:
Control.refresh()

setBackgroundColor

public void setBackgroundColor(int bgcolor)
(non-Javadoc)

Specified by:
setBackgroundColor in interface Control
Parameters:
bgcolor - int value of the color in HEX. For example: 0x00000000, 0x00FF0000, 0x00FFFFFF
See Also:
Control.setBackgroundColor(int bgcolor)

removeAllListItems

public void removeAllListItems()
Remove all the ListItems


addListItem

public void addListItem(ListItem listItem)
Add ListItem to the list field

Parameters:
listItem - ListItem object that contains the label and action
See Also:
ListItem

getListItems

public ListItem[] getListItems()
Retrieve the ListItems

Returns:
ListItem array list of ListItem objects
See Also:
ListItem

getListItemAt

public ListItem getListItemAt(int index)
Retrieve the ListItem by index

Parameters:
index - int value for the index location of the ListItem
Returns:
ListItem list item object
See Also:
ListItem

addMenuItem

public void addMenuItem(net.rim.device.api.ui.MenuItem menu)
Add Menu Item

Parameters:
menu - new MenuItem

addMenuSeperator

public void addMenuSeperator()
Add menu seperator


clearMenuItems

public void clearMenuItems()
Remove all the menu items


makeContextMenu

protected void makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
(non-Javadoc)

Overrides:
makeContextMenu in class net.rim.device.api.ui.Field
See Also:
Field.makeContextMenu(ContextMenu menu)

getYLocation

public int getYLocation(int index)
Retrieve the Y location of the next list item to be drawn

Parameters:
index - int value for the current list item index to be drawn
Returns:
int value for the Y location

moveFocus

protected int moveFocus(int amount,
                        int status,
                        int time)
(non-Javadoc)

Overrides:
moveFocus in class net.rim.device.api.ui.component.ListField
See Also:
Field.moveFocus(int amount, int status, int time)

moveFocus

protected void moveFocus(int x,
                         int y,
                         int status,
                         int time)
(non-Javadoc)

Overrides:
moveFocus in class net.rim.device.api.ui.component.ListField
See Also:
Field.moveFocus( int x, int y, int status, int time )

drawFocus

protected void drawFocus(net.rim.device.api.ui.Graphics graphics,
                         boolean on)
(non-Javadoc)

Overrides:
drawFocus in class net.rim.device.api.ui.component.ListField
See Also:
Field.drawFocus(Graphics g, boolean on)

drawListItem

public void drawListItem(net.rim.device.api.ui.Graphics g,
                         int index,
                         boolean focus)
Draw the list item

Parameters:
graphics - Graphics object for drawing the focus.
index - int value for the row index to display.
focus - true if the list item is in focus, otherwise false
See Also:
Graphics

paint

protected void paint(net.rim.device.api.ui.Graphics g)
(non-Javadoc)

Overrides:
paint in class net.rim.device.api.ui.component.ListField
See Also:
Field.paint(Graphics g)

layout

protected void layout(int width,
                      int height)
(non-Javadoc)

Overrides:
layout in class net.rim.device.api.ui.component.ListField
See Also:
Field.layout(int width, int height)

onFocus

protected void onFocus(int direction)
(non-Javadoc)

Overrides:
onFocus in class net.rim.device.api.ui.component.ListField
See Also:
Field.onFocus(int direction)

onUnfocus

protected void onUnfocus()
(non-Javadoc)

Overrides:
onUnfocus in class net.rim.device.api.ui.Field
See Also:
Field.onUnfocus()

navigationClick

protected boolean navigationClick(int status,
                                  int time)
(non-Javadoc)

Overrides:
navigationClick in class net.rim.device.api.ui.Field
See Also:
Field.navigationClick(int status, int time)

navigationUnclick

protected boolean navigationUnclick(int status,
                                    int time)
(non-Javadoc)

Overrides:
navigationUnclick in class net.rim.device.api.ui.Field
See Also:
Field.navigationUnclick(int status, int time)

navigationMovement

protected boolean navigationMovement(int dx,
                                     int dy,
                                     int status,
                                     int time)
(non-Javadoc)

Overrides:
navigationMovement in class net.rim.device.api.ui.Field
See Also:
Field.navigationMovement(int dx, int dy, int status, int time)

touchEvent

protected boolean touchEvent(net.rim.device.api.ui.TouchEvent message)
(non-Javadoc)

Overrides:
touchEvent in class net.rim.device.api.ui.Field
See Also:
Field.touchEvent(TouchEvent message)

refreshFooter

public void refreshFooter(java.lang.String valueToBeDisplay)
Refresh the footer field from the screen that contains the text of the list item.

Parameters:
valueToBeDisplay - String value for the text to be display in the footer

setListItems

public void setListItems(java.util.Vector items)
Set list items

Parameters:
items - Vector list of ListItem
See Also:
ListItem

setListItems

public void setListItems(ListItem[] list)
Set list items

Parameters:
list - ListItem array list
See Also:
ListItem

setFooterField

public void setFooterField(FooterField field)
Set the footer field

Parameters:
{@link - FooterField} footer field to put the text of the textinput into. This is useful for long text, so it can be displayed in the footer. null value if there is no footer.
See Also:
FooterField

getCustomEventsDelegate

public ICustomEventsDelegate getCustomEventsDelegate()
Returns the control's custom events delegate

Returns:
the control's custom events delegate

setCustomEventsDelegate

public void setCustomEventsDelegate(ICustomEventsDelegate delegate,
                                    int eventsFlags)
Sets the control's custom events delegate for the given events

Parameters:
delegate - custom events delegate
eventsFlags - the events to set delegate to

getControlID

public int getControlID()
Returns the control's ID

Returns:
the control's Id

setControlID

public void setControlID(int controlID)
Sets the control's ID

Parameters:
controlId - control ID