| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.nokia.mid.ui.PopupListItem
com.nokia.mid.ui.PopupList
public class PopupList
This class implements a popup list which can be populated by text of list elements. The list items to be added to the list must be of type PopupListItem. A client only needs to implement the PopupListListener interface in order to receive list events. There is only one type of list:
Contextual menu is the default type and cannot be nested and it doesn't have a header.
Normally the list would be used like so:
 PopupList list1 = new PopupList();
 PopupListItem item1 = new PopupListItem("Item1");
 PopupListItem item2 = new PopupListItem("Item1", image1);
 list1.appendItem(item1);
 list1.appendItem(item2);
 list1.setVisible(true);
 
 Notes: due to different device UI style implementation, some features might not be supported. e.g. icon or mark may not be shown in popup list item; popuplist may not be nested.
| Field Summary | |
|---|---|
| static int | CONTEXTUAL_MENUPopupList type is contextual menu | 
| static int | LIST_DIALOGPopupList type is list dialog | 
| static int | TAIL_LEFTPopupList Tail Style indicating that the tail should point to the left action button. | 
| static int | TAIL_NONEPopupList Tail Style indicating that the list should have no tail. | 
| static int | TAIL_PARENTPopupList Tail Style indicating that the tail should point to the parent list item. | 
| static int | TAIL_RIGHTPopupList Tail Style indicating that the tail should point to the right action button. | 
| Constructor Summary | |
|---|---|
| PopupList()This constructor instantiates a PopupList instance. | |
| PopupList(java.lang.String itemText)This constructor instantiates a PopupList instance with itemText set. | |
| PopupList(java.lang.String itemText,
          int listType)This constructor instantiates a PopupList instance with the itemText set as provided and depending on the listType value it is a contextual menu or a list dialog | |
| Method Summary | |
|---|---|
|  void | appendItem(PopupListItem item)This method will append an item to the list. | 
|  PopupListItem | getItem(int index)Returns the item specified by the index from the popuplist. | 
|  void | insertItem(PopupListItem item,
           int index)This method will insert an item to the list at the give index. | 
|  void | removeItem(PopupListItem item)This will remove the item from the popuplist. | 
|  void | removeItemAt(int index)This will remove the item specified by the index from the popuplist. | 
|  void | setItemText(java.lang.String text)Deprecated. will be removed soon, use the setText instead of | 
|  void | setListener(PopupListListener listener)This method sets the PopupListListener for this list. | 
|  void | setListYPos(int yPos)Sets the y coordinate where the contextual menu should be shown. | 
|  void | setTailStyle(int style)This sets the tail style for the contextual menu. | 
|  void | setText(java.lang.String text)This method sets the PopupList item text. | 
|  void | setVisible(boolean visible)This sets the list visible or hidden. | 
|  int | size()This will return the size of the popuplist. | 
| Methods inherited from class com.nokia.mid.ui.PopupListItem | 
|---|
| getIcon, getText, hasMarking, isMarked, setHasMarking, setIcon, setMarked | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int CONTEXTUAL_MENU
public static final int LIST_DIALOG
public static final int TAIL_LEFT
public static final int TAIL_RIGHT
public static final int TAIL_NONE
public static final int TAIL_PARENT
| Constructor Detail | 
|---|
public PopupList()
public PopupList(java.lang.String itemText)
itemText - the itemText to be set
public PopupList(java.lang.String itemText,
                 int listType)
          throws PopupListException
itemText - the itemText set for the listlistType - the type of popuplist can be CONTEXTUAL_MENU or LIST_DIALOG
PopupListException - if the type is not one of the allowed constants| Method Detail | 
|---|
public void setListener(PopupListListener listener)
listener - the listener to be set or null to remove the listener
public void appendItem(PopupListItem item)
                throws java.lang.NullPointerException,
                       PopupListException
item - The PopupListItem to append to the list.
java.lang.NullPointerException - if item is null
PopupListException - if the item is a PopupList instance which is already attached elsewhere
public void insertItem(PopupListItem item,
                       int index)
                throws java.lang.NullPointerException,
                       PopupListException,
                       java.lang.IndexOutOfBoundsException
item - The PopupListItem to append to the list.index - where to insert the item
java.lang.NullPointerException - if item is null
PopupListException - if the item is a PopupList instance which is already attached elsewhere
java.lang.IndexOutOfBoundsExceptionpublic void removeItem(PopupListItem item)
item - The PopupListItem to be removed. If the item is not found, nothing happens.
public void removeItemAt(int index)
                  throws java.lang.IndexOutOfBoundsException
index - to be removed
java.lang.IndexOutOfBoundsException - if the index is not within limitspublic int size()
public PopupListItem getItem(int index)
                      throws java.lang.IndexOutOfBoundsException
index - to be returned
java.lang.IndexOutOfBoundsException - if the index is not within limitspublic void setItemText(java.lang.String text)
text - The item text to set for the PopupList.public void setText(java.lang.String text)
setText in class PopupListItemtext - The item text to set for the PopupList.
java.lang.NullPointerException - if itemText is null
public void setVisible(boolean visible)
                throws PopupListException,
                       java.lang.IllegalStateException
visible - true: list is shown, false: list is hidden.
java.lang.IllegalStateException - if the list is set to visible, but it is empty
PopupListException
public void setTailStyle(int style)
                  throws PopupListException
style - The tail style to set.
java.lang.IllegalArgumentException - if tail style is not valid.
PopupListException
public void setListYPos(int yPos)
                 throws PopupListException
yPos - the coordinate where the contextual menu should be shown
PopupListException - if the yPos is negative| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||