public class nUIListElement extends nUIElementDisplay implements IListRenderer
nUIElementDisplay
Objects. Typically these will be nUITableButton
s.
The width and height of the list can be set directly with nUIDisplayObject.setWidth(int)
and nUIDisplayObject.setHeight(int)
methods,
or allowed to auto-fill the inner area of the parent.Y_IDENTIFIER_PREV_BOTTOM
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 |
---|
nUIListElement()
The default
nUIListElement constructor. |
nUIListElement(java.util.Hashtable properties) |
nUIListElement(IListProvider delegate)
Create a
nUIListElement with an already-created delegate. |
nUIListElement(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 |
boolean |
getBgimageScroll()
Determine if the background Image will scroll along with the list's contents.
|
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.
|
boolean |
getHscrollable()
Determine if this list is allowed to scroll in a horizontal direction.
|
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 nUIListElement |
int |
getScrollPosition()
Get the current scroll position of this
nUIListElement in pixels. |
boolean |
getVscrollable()
Determine if this list is allowed to scroll in a vertical direction.
|
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
nUIListElement to the desired position. |
void |
scrollToRow(int row,
boolean animmated)
Scroll to a row in the list.
|
void |
setBgimageScroll(boolean bgimage_scroll)
Set if this list should scroll its background Image along with the contents.
|
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 |
setHscrollable(boolean hscrollable)
Set if this list should scroll in a horizontal direction.
|
void |
setListActionListener(IListActionListener listener) |
void |
setListListener(IListListener listener)
Set the
IListListener associated with this nUIListElement . |
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 |
setVscrollable(boolean vscrollable)
Set if this list should scroll in a vertical direction.
|
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
|
applyBackground, applyBackground, applyBackground
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 nUIListElement()
nUIListElement
constructor. Will be assigned a default ID of -1 (unidentified).
It is expected that setDelegate(IListProvider)
will be called shortly afterwards.public nUIListElement(java.util.Hashtable properties)
public nUIListElement(IListProvider delegate)
nUIListElement
with an already-created delegate. Will be assigned a default ID of -1 (unidentified).delegate
- the IListProvider
to use. Must not be null
.public nUIListElement(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 void setHscrollable(boolean hscrollable)
hscrollable
- set to true
to allow this list to scroll horizontally.public boolean getHscrollable()
true
if the list may scroll horizontally, or false
if it won't.public void setVscrollable(boolean vscrollable)
vscrollable
- set to true
to allow this list to scroll vertically.public boolean getVscrollable()
true
if the list may scroll vertically, false
otherwise.public void setBgimageScroll(boolean bgimage_scroll)
bgimage_scroll
- set to true
to enable background scrolling.public boolean getBgimageScroll()
true
if it will.public int getScrollPosition()
nUIListElement
in pixels.getScrollPosition
in interface IListRenderer
public void scrollTo(int scrollPosition, boolean animated)
nUIListElement
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 nUIListElement
.setListListener
in interface IListRenderer
listener
- - the listener to set.public IListListener getListListener()
IListListener
associated with this nUIListElement
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