public class nUIListView extends nUIViewDisplay implements IListRenderer
nUIViewDisplay
that displays a list of nUIElementDisplay
Objects.
Typically these will be nUITableButton
s. nUINavbuttonElement
s may be added to the header as with any normal
nUIViewDisplay
.COLOR_BACKGROUND_NORMAL, COLOR_BLACK, COLOR_FOREGROUND_DARK, COLOR_FOREGROUND_LIGHT, COLOR_FOREGROUND_NORMAL, COLOR_TRANSPARENT, COLOR_WHITE, DIMENSIONS_IDENTIFIER_PARENT_DIMENSIONS
ROW_ANIMATION_STYLE_NONE
Constructor and Description |
---|
nUIListView()
The default
nUIListView constructor. |
nUIListView(java.util.Hashtable properties) |
nUIListView(IListProvider delegate)
Create a
nUIListView with an already-created delegate. |
nUIListView(IListProvider delegate,
java.util.Hashtable properties) |
Modifier and Type | Method and Description |
---|---|
void |
deleteRow(int row,
int animationStyle)
Delete the row at the given index.
|
void |
deleteRows(int startRow,
int count,
int animationStyle)
Delete multiple rows from the list
|
void |
enablePullToRefresh(boolean enable)
Enable the pull-to-refresh mechanism for this
nUIListElement |
IListProvider |
getDelegate()
Get the current
IListProvider delegate for this list. |
int |
getFirstVisibleRow()
Gets the index of the current first visible row.
|
nUIDisplayObject |
getHeader()
Returns the current header.
|
int |
getLastVisibleRow()
Gets the index of the last row that's currently visible in the viewport.
|
IListActionListener |
getListActionListener() |
IListListener |
getListListener()
Get the current
IListListener associated with this nUIListView |
int |
getScrollPosition()
Get the current scroll position of this
nUIListElement in pixels. |
void |
hideSpinner(int type)
Hide the spinner associated with this list
|
void |
insertRow(int row,
int animationStyle)
Insert a row at the given index.
|
void |
insertRows(int startRow,
int count,
int animationStyle)
Insert a number of rows into the list
|
boolean |
isSpinnerVisible(int type)
Checks if the spinner is visible
|
void |
scrollTo(int scrollPosition,
boolean animated)
Scroll this
nUIListView to the desired position. |
void |
scrollToRow(int row,
boolean animmated)
Scroll to a row in the list.
|
void |
setCustomSpinner(int type,
nUIDisplayObject customSpinner)
Use a custom
nUIDisplayObject for the spinner. |
void |
setDelegate(IListProvider delegate)
Set the
IListProvider delegate for this list. |
void |
setHeader(nUIDisplayObject header)
Sets the header for the list view that will be scrolled together with content.
|
void |
setListActionListener(IListActionListener listener) |
void |
setListListener(IListListener listener)
Set the
IListListener associated with this nUIListView . |
void |
setScrollThreshold(int threshold)
Set the amonut of scroll that should be left remaining when
the
IListListener associated with this list should
get a notification. |
void |
showSpinner(int type)
Show the spinner to indicate background activity.
|
IListEditMode |
startEditMode(IListEditModeListener listener) |
void |
update()
Force a refresh of the entire list.
|
void |
updateRow(int row,
int animationStyle)
Update the row at the given index
|
void |
updateRows(int startRow,
int count,
int animationStyle)
Update a number of rows
|
getBgimageScroll, getHeaderBackground, getHeaderHeight, getHeadertext, getHscrollable, getInterElementYSpacing, getPopupDismissText, getVscrollable, onUISynced, setBgimageScroll, setHeaderBackground, setHeaderFgColor, setHeadertext, setHscrollable, setInterElementYSpacing, setPopupDismissText, setVscrollable, syncUI
getBackgroundDrawable, getBottom, getElementIdentifier, getFocusable, getGesturable, getHeight, getInnerHeight, getInnerWidth, getInnerX, getInnerY, getLeft, getMaxChildX, getMaxChildY, getProperties, getProperty, getRight, getScreenInnerX, getScreenInnerY, getScreenX, getScreenY, getTop, getTopLevelParentView, getTopLevelParentWindow, getTriggerable, getWidth, getX, getY, insertAtInternal, isEnabled, isVisible, onRemoved, remove, setBackgroundDrawable, setBottom, setElementIdentifier, setEnabled, setFocusable, setGesturable, setHeight, setInnerHeight, setInnerWidth, setInnerX, setInnerY, setLeft, setProperties, setProperty, setRight, setTop, setTriggerable, setVisible, setWidth, setX, setY
add, addEventListener, childElementAt, childIndexOf, getFirstChild, getId, getLastChild, getNextSibling, getParent, getPrevSibling, getTag, insertAfter, insertAt, insertBefore, outputChildHierarchy, remove, removeEventListener, replace, replace, setId, setTag, setUnlinkChildrenOnRemoval
public nUIListView()
nUIListView
constructor. Will be assigned a default ID of -1 (unidentified).
It is expected that setDelegate(IListProvider)
will be called shortly afterwards.public nUIListView(java.util.Hashtable properties)
public nUIListView(IListProvider delegate)
nUIListView
with an already-created delegate. Will be assigned a default ID of -1 (unidentified).delegate
- the IListProvider
to use. Must not be null
.public nUIListView(IListProvider delegate, java.util.Hashtable properties)
public void setDelegate(IListProvider delegate)
IListProvider
delegate for this list. Must not be null
.
If a delegate is not set for this Object before it is drawn on the screen for the first time,
it is assumed that an empty (zero-length) list is the intended behaviour.setDelegate
in interface IListRenderer
delegate
- The delegate to set.public IListProvider getDelegate()
IListProvider
delegate for this list.getDelegate
in interface IListRenderer
public int getScrollPosition()
nUIListElement
in pixels.getScrollPosition
in interface IListRenderer
public void scrollTo(int scrollPosition, boolean animated)
nUIListView
to the desired position.scrollTo
in interface IListRenderer
scrollPosition
- a position in pixelsanimated
- animate the scrolling, if the platform supports itpublic void scrollToRow(int row, boolean animmated)
scrollToRow
in interface IListRenderer
row
- the index of the desired rowanimmated
- animate the scrolling, if the platform supports it.public int getFirstVisibleRow()
getFirstVisibleRow
in interface IListRenderer
public void setScrollThreshold(int threshold)
IListListener
associated with this list should
get a notification.setScrollThreshold
in interface IListRenderer
threshold
- public void showSpinner(int type)
showSpinner
in interface IListRenderer
type
- the spinner type - either IListListener.POSITION_TOP
or POSITION_BOTTOM
public void hideSpinner(int type)
hideSpinner
in interface IListRenderer
type
- the spinner type - either IListListener.POSITION_TOP
or POSITION_BOTTOM
public int getLastVisibleRow()
getLastVisibleRow
in interface IListRenderer
public void setCustomSpinner(int type, nUIDisplayObject customSpinner)
nUIDisplayObject
for the spinner.setCustomSpinner
in interface IListRenderer
type
- the spinner type - either IListListener.POSITION_TOP
or POSITION_BOTTOM
customSpinner
- public void enablePullToRefresh(boolean enable)
nUIListElement
enablePullToRefresh
in interface IListRenderer
enable
- true if the pull-to-refresh mechanism should be enabled.public void setListListener(IListListener listener)
IListListener
associated with this nUIListView
.setListListener
in interface IListRenderer
listener
- - the listener to set.public IListListener getListListener()
IListListener
associated with this nUIListView
getListListener
in interface IListRenderer
public void deleteRow(int row, int animationStyle)
deleteRow
in interface IListRenderer
row
- the index of the row to delete.animationStyle
- public void insertRow(int row, int animationStyle)
insertRow
in interface IListRenderer
row
- the index of the row that's being insertedanimationStyle
- public void updateRow(int row, int animationStyle)
updateRow
in interface IListRenderer
row
- the index of the row to updateanimationStyle
- public void deleteRows(int startRow, int count, int animationStyle)
deleteRows
in interface IListRenderer
startRow
- the starting index of the first row to deletecount
- the number of rows to deleteanimationStyle
- public void insertRows(int startRow, int count, int animationStyle)
insertRows
in interface IListRenderer
startRow
- the starting index of the first rowcount
- the number of rows to insertanimationStyle
- public void updateRows(int startRow, int count, int animationStyle)
updateRows
in interface IListRenderer
startRow
- the starting index of the first rowcount
- the number of rows to updateanimationStyle
- public void update()
update
in interface IListRenderer
public void setHeader(nUIDisplayObject header)
IListRenderer
setHeader
in interface IListRenderer
header
- - header to be displayed at the top of the list view.public nUIDisplayObject getHeader()
IListRenderer
getHeader
in interface IListRenderer
null
if no header has been set.public void setListActionListener(IListActionListener listener)
setListActionListener
in interface IListRenderer
public IListActionListener getListActionListener()
getListActionListener
in interface IListRenderer
public boolean isSpinnerVisible(int type)
IListRenderer
isSpinnerVisible
in interface IListRenderer
type
- use IListListener.POSITION_TOP
to show the spinner at
the top, and IListListener.POSITION_BOTTOM
at the
bottom.public IListEditMode startEditMode(IListEditModeListener listener)
startEditMode
in interface IListRenderer