| java.lang.Object com.sun.svg.component.SVGList
All known Subclasses: com.sun.perseus.demo.ContactListSource,
SVGList | public class SVGList (Code) | | The SVGList class displays the items of an arbitrary long list
of data items in a limited number of visual elements. The list triggers
a scrolling effect to move up or down in the list and has a notion of
selected item (i.e., the one which reprents the current user selection).
The SVGList class facilitates creating a list where the
appearance of the list and the list animations are defined in SVG markup and
the data displayed by the list is controlled by the ListModel
implementation associated to the SVGList .
The conventions for the SVG this class can hook into are:
- The various elements which compose the list share the same identifier
prefix which is given to the SVGList at construction time (e.g., 'myList').
This prefix is call 'listIdPrefix' in the following.
- The animations which produce the list's scroll up effect are started by
the animation with id . The scroll down
effect animations are started with the animation with id:
.
- The SVG elements used to display the list items have an id of the form:
. The display items must be in consecutive
order starting at zero.
- The item which displays the currently selected item should have the
additional "_selectedItem" suffix, so its id should be formed as:
. If not selected item is
specified, the selected item index defaults to zero.
By default, SVGList assumes that the list items are SVG
elements. However, the list can be associated to a list item binders
to handle more sophisticated item rendering.
Example of SVG content which can be bound by this class:
item 0
item 1
item 2
item 3
item 4
item 4 details
item 5
item 6
item 7
item 8
item 8
|
Inner Class :public interface ListModel | |
Inner Class :public interface ListItemBinder | |
Inner Class :public class DefaultListItemBinder implements ListItemBinder | |
Field Summary | |
final public static String | SCROLL_DOWN_ANIM_SUFFIX Id suffix used for the list scrollDown animation effect. | final public static String | SCROLL_UP_ANIM_SUFFIX Id suffix used for the list scrollUp animation effect. | protected ListItemBinder | commonItemBinder The list item binder used to display common list elements. | protected int | curIndex Index of the currently selected list item. | protected String | listIdPrefix The prefix for the identifiers which make the various list elements. | protected Vector | listItems This vector holds all the SVGElement instances which represent
items in the list. | protected ListModel | listModel The model providing the list data. | protected int | nDisplayedItems The number of items displayed in the list. | protected SVGAnimationElement | scrollDownAnim The animation to play to scroll down the list. | protected SVGAnimationElement | scrollUpAnim The animation to play to scroll up the list. | protected ListItemBinder | selectedItemBinder The list item binder used to display the selected list element. | protected SVGElement | selectedItemDetails |
Constructor Summary | |
public | SVGList(ListModel listModel, String listIdPrefix) Creates a new instance of SVGList. |
Method Summary | |
public int | getCurIndex() Returns the current index in the list, in the [0, getSize()[ range. | public int | getFocusedIndex() Returns the index of the index in the list with focus. | public float | getPosition() Returns the current progress in the list, as a ration of the current
index over the number of list items. | public void | hookSkin(Document doc) Hooks the specified sking to the application. | public void | next() | public void | prev() | public void | scrollDown() | public void | scrollUp() | public void | setCommonItemBinder(ListItemBinder commonItemBinder) Sets a new ListItemBinder for rendering common list
entries. | public void | setCurIndex(int curIndex) Sets the new current index, i.e., the index of the first displayed
list item. | public void | setDataItems() Transfers list data to the XML UI. | public void | setSelectedIndex(int selectedIndex) Sets the index of the item with selection focus. | public void | setSelectedItemBinder(ListItemBinder selectedItemBinder) Sets a new ListItemBinder for rendering the selected list
entry. |
SCROLL_DOWN_ANIM_SUFFIX | final public static String SCROLL_DOWN_ANIM_SUFFIX(Code) | | Id suffix used for the list scrollDown animation effect.
|
SCROLL_UP_ANIM_SUFFIX | final public static String SCROLL_UP_ANIM_SUFFIX(Code) | | Id suffix used for the list scrollUp animation effect.
|
commonItemBinder | protected ListItemBinder commonItemBinder(Code) | | The list item binder used to display common list elements.
|
curIndex | protected int curIndex(Code) | | Index of the currently selected list item.
|
listIdPrefix | protected String listIdPrefix(Code) | | The prefix for the identifiers which make the various list elements.
|
listItems | protected Vector listItems(Code) | | This vector holds all the SVGElement instances which represent
items in the list.
|
listModel | protected ListModel listModel(Code) | | The model providing the list data.
|
nDisplayedItems | protected int nDisplayedItems(Code) | | The number of items displayed in the list.
|
scrollDownAnim | protected SVGAnimationElement scrollDownAnim(Code) | | The animation to play to scroll down the list.
|
scrollUpAnim | protected SVGAnimationElement scrollUpAnim(Code) | | The animation to play to scroll up the list.
|
selectedItemBinder | protected ListItemBinder selectedItemBinder(Code) | | The list item binder used to display the selected list element.
|
selectedItemDetails | protected SVGElement selectedItemDetails(Code) | | |
SVGList | public SVGList(ListModel listModel, String listIdPrefix)(Code) | | Creates a new instance of SVGList.
Parameters: listModel - - the ListModel which will provide the data for the list. Parameters: listIdPrefix - - the prefix used for the various elements which make thelist. |
getCurIndex | public int getCurIndex()(Code) | | Returns the current index in the list, in the [0, getSize()[ range.
the first shown list index. |
getFocusedIndex | public int getFocusedIndex()(Code) | | Returns the index of the index in the list with focus.
the index of the currently selected list index. |
getPosition | public float getPosition()(Code) | | Returns the current progress in the list, as a ration of the current
index over the number of list items.
|
hookSkin | public void hookSkin(Document doc)(Code) | | Hooks the specified sking to the application.
Parameters: doc - the new Document to hook into the application |
scrollDown | public void scrollDown()(Code) | | |
scrollUp | public void scrollUp()(Code) | | |
setCommonItemBinder | public void setCommonItemBinder(ListItemBinder commonItemBinder)(Code) | | Sets a new ListItemBinder for rendering common list
entries.
Parameters: commonItemBinder - - the new ListItemBinder to use when rendering common list elements. |
setCurIndex | public void setCurIndex(int curIndex)(Code) | | Sets the new current index, i.e., the index of the first displayed
list item.
Parameters: curIndex - - the index of the new first displayed list item. |
setDataItems | public void setDataItems()(Code) | | Transfers list data to the XML UI.
|
setSelectedIndex | public void setSelectedIndex(int selectedIndex)(Code) | | Sets the index of the item with selection focus.
Parameters: selectedIndex - - the index of the new currently focused list item. |
setSelectedItemBinder | public void setSelectedItemBinder(ListItemBinder selectedItemBinder)(Code) | | Sets a new ListItemBinder for rendering the selected list
entry.
Parameters: selectedItemBinder - - the new ListItemBinder to use when rendering the selected list element. |
|
|