|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.PopupListItem com.nokia.mid.ui.PopupList
This class implements a popup list which can be populated by various types of list elements. The list items to be added to the list must be of type PopupListItem. PopupList instances can be nested if the list is contextual menu. So if nested a list into another one an item in a PopupList can open up into a new "sublist". A client only need to implement the PopupListListener interface in order to receive list events. There are two types of lists:
Contextual menu is the default one and can be nested and it doesn't have a header
List dialog shows a header and cannot be nested.
To be able to nest an contextual menu into another one PopupList inherits from PopupListItem. However the icon and marking related functions doesn't result in appearance changes only text changes are visible
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);
This example creates a PopupList with 2 different items and with a sublist.
PopupList list1 = new PopupList();
PopupList list2 = new PopupList();
list2.setItemText("Sublist");
PopupListItem item1 = new PopupListItem("Text");
PopupListItem item2 = new PopupListItem("Text", image1);
PopupListItem item3 = new PopupListItem("Text2");
PopupListItem item4 = new PopupListItem("Text3", image1);
list1.appendItem(item1);
list1.appendItem(item2);
list1.appendItem(list2);
list2.appendItem(item3);
list2.appendItem(item4);
list1.setVisible(true);
Field Summary | |
static int |
CONTEXTUAL_MENU
PopupList type is contextual menu |
static int |
LIST_DIALOG
PopupList type is list dialog |
static int |
TAIL_LEFT
PopupList Tail Style indicating that the tail should point to the left action button. |
static int |
TAIL_NONE
PopupList Tail Style indicating that the list should have no tail. |
static int |
TAIL_PARENT
PopupList Tail Style indicating that the tail should point to the parent list item. |
static int |
TAIL_RIGHT
PopupList 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 setpublic 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 constantsMethod Detail |
public void setListener(PopupListListener listener)
listener
- the listener to be set or null to remove the listenerpublic 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
orpublic 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
orjava.lang.IndexOutOfBoundsException
- if index is invalidpublic 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 PopupListItem
text
- The item text to set for the PopupList.
java.lang.NullPointerException
- if itemText is nullpublic void setVisible(boolean visible) throws PopupListException, java.lang.IllegalStateException
visible
- true: list is shown, false: list is hidden.
java.lang.IllegalStateException
- if list is set to visible on an unsupported displayable or 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 |