Package org.zkoss.bind.proxy
Class ListModelListProxy<E>
- java.lang.Object
-
- org.zkoss.zul.AbstractListModel<E>
-
- org.zkoss.zul.ListModelList<E>
-
- org.zkoss.bind.proxy.ListModelListProxy<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,javassist.util.proxy.Proxy
,FormProxyObject
,Pageable
,Selectable<E>
,Sortable<E>
,ListModel<E>
,PageableModel
public class ListModelListProxy<E> extends ListModelList<E> implements javassist.util.proxy.Proxy, FormProxyObject, java.io.Serializable
A ListModelList Proxy- Since:
- 9.6.0
- Author:
- jameschu
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.zkoss.zul.AbstractListModel
AbstractListModel.DefaultSelectionControl<E>
-
-
Field Summary
-
Fields inherited from class org.zkoss.zul.ListModelList
_list
-
Fields inherited from class org.zkoss.zul.AbstractListModel
_selection
-
Fields inherited from interface org.zkoss.zul.PageableModel
INTERNAL_EVENT
-
-
Constructor Summary
Constructors Constructor Description ListModelListProxy(ListModelList<E> origin, java.lang.annotation.Annotation[] callerAnnots)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, E element)
boolean
add(E o)
boolean
addAll(int index, java.util.Collection<? extends E> c)
boolean
addAll(java.util.Collection<? extends E> c)
void
addListDataListener(ListDataListener l)
Adds a listener to the list that's notified each time a change to the data model occurs.void
addPagingEventListener(PagingListener l)
Adds a listener to the list of listeners to be notified when a PagingEvent happens outside of standard Paging componentboolean
addToSelection(E obj)
Add the specified object into selection.void
cacheSavePropertyBinding(java.lang.String property, SavePropertyBinding s)
Cache save property binding by property stringvoid
clear()
void
clearSelection()
Change the selection to the empty set.java.lang.Object
clone()
java.util.Set<Pair<java.lang.String,SavePropertyBinding>>
collectCachedSavePropertyBinding()
Collect all of collect cached save property bindingsboolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
protected <T> T
createProxyObject(T t)
boolean
equals(java.lang.Object o)
E
get(int index)
int
getActivePage()
Returns the active page (starting from 0).ListModelList<E>
getCache()
E
getElementAt(int j)
Returns the value at the specified index.java.util.List<E>
getInnerList()
Get the inner real List.ListModelList<E>
getOriginObject()
Returns the origin object.int
getPageCount()
Returns the number of pages.int
getPageSize()
Returns the number of items per page.java.util.Set<E>
getSelection()
Returns the current selection.SelectionControl
getSelectionControl()
Returns the selection control for the selection model, if any.int
getSize()
Returns the length of the list.java.lang.String
getSortDirection(java.util.Comparator<E> cmpr)
Returns the sort direction of this model for the given comparator.int
hashCode()
int
indexOf(java.lang.Object o)
boolean
isEmpty()
boolean
isFormDirty()
Returns whether the form proxy object is dirty or not, including all of its attributes.boolean
isSelected(java.lang.Object obj)
Returns whether an object is selected.boolean
isSelectionEmpty()
Returns true if the selection is currently empty.java.util.Iterator<E>
iterator()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<E>
listIterator()
java.util.ListIterator<E>
listIterator(int index)
boolean
notifyChange(E element)
Notifies a change of the same element to trigger an event ofListDataEvent.CONTENTS_CHANGED
.void
onDataChange(java.lang.Object o)
void
onDirtyChange()
E
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
removeFromSelection(java.lang.Object obj)
Remove the specified object from selection.void
removeListDataListener(ListDataListener l)
Removes a listener from the list that's notified each time a change to the data model occurs.void
removePagingEventListener(PagingListener l)
Removes a listener from the list of listeners to be notified when a PagingEvent happens outside of standard Paging componentvoid
removeRange(int fromIndex, int toIndex)
Remove from fromIndex(inclusive) to toIndex(exclusive).void
resetFromOrigin()
Resets all of the changes of this form from the origin object.boolean
retainAll(java.util.Collection<?> c)
E
set(int index, E element)
void
setActivePage(int pg)
Sets the active page (starting from 0).protected void
setDirty(boolean d)
void
setFormOwner(java.lang.Object owner, FormBinding binding)
Sets the owner of this form with its binding.void
setHandler(javassist.util.proxy.MethodHandler mi)
void
setMultiple(boolean multiple)
Sets the selection mode to be multiple.void
setPageSize(int size)
Sets the number of items per page.void
setPath(java.lang.String property, ProxyNode parent)
Set the property of current form proxy object and it's creatorvoid
setSelection(java.util.Collection<? extends E> selection)
Replace the current selection with the given set.void
setSelectionControl(SelectionControl ctrl)
Sets the selection control for the selection modelint
size()
void
sort()
Sort the data model by default or assigned comparator.void
sort(java.util.Comparator<E> cmpr, boolean ascending)
Sorts the data.java.util.List<E>
subList(int fromIndex, int toIndex)
void
submitToOrigin(BindContext ctx)
Saves all of the changes of this form to the origin object.protected static boolean
testEquals(java.lang.Object e, java.lang.Object o)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
java.lang.String
toString()
-
Methods inherited from class org.zkoss.zul.ListModelList
fireSelectionEvent
-
Methods inherited from class org.zkoss.zul.AbstractListModel
fireEvent, getListDataListeners, getTotalSize, isMultiple, newEmptySelection, readSelection, removeAllSelection, retainAllSelection, writeSelection
-
-
-
-
Constructor Detail
-
ListModelListProxy
public ListModelListProxy(ListModelList<E> origin, java.lang.annotation.Annotation[] callerAnnots)
-
-
Method Detail
-
getCache
public ListModelList<E> getCache()
-
onDirtyChange
public void onDirtyChange()
-
onDataChange
public void onDataChange(java.lang.Object o)
-
setDirty
protected void setDirty(boolean d)
-
addListDataListener
public void addListDataListener(ListDataListener l)
Description copied from class:AbstractListModel
Adds a listener to the list that's notified each time a change to the data model occurs.- Specified by:
addListDataListener
in interfaceListModel<E>
- Overrides:
addListDataListener
in classAbstractListModel<E>
-
removeListDataListener
public void removeListDataListener(ListDataListener l)
Description copied from class:AbstractListModel
Removes a listener from the list that's notified each time a change to the data model occurs.- Specified by:
removeListDataListener
in interfaceListModel<E>
- Overrides:
removeListDataListener
in classAbstractListModel<E>
-
getSelection
public java.util.Set<E> getSelection()
Description copied from class:AbstractListModel
Returns the current selection. It is readonly. Don't modify it directly- Specified by:
getSelection
in interfaceSelectable<E>
- Overrides:
getSelection
in classAbstractListModel<E>
- Returns:
- the current selection.
-
setSelection
public void setSelection(java.util.Collection<? extends E> selection)
Description copied from class:AbstractListModel
Replace the current selection with the given set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
setSelection
in interfaceSelectable<E>
- Overrides:
setSelection
in classAbstractListModel<E>
-
isSelected
public boolean isSelected(java.lang.Object obj)
Description copied from class:AbstractListModel
Returns whether an object is selected.- Specified by:
isSelected
in interfaceSelectable<E>
- Overrides:
isSelected
in classAbstractListModel<E>
-
isSelectionEmpty
public boolean isSelectionEmpty()
Description copied from class:AbstractListModel
Returns true if the selection is currently empty.- Specified by:
isSelectionEmpty
in interfaceSelectable<E>
- Overrides:
isSelectionEmpty
in classAbstractListModel<E>
-
addToSelection
public boolean addToSelection(E obj)
Description copied from class:AbstractListModel
Add the specified object into selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
addToSelection
in interfaceSelectable<E>
- Overrides:
addToSelection
in classAbstractListModel<E>
- Parameters:
obj
- the object to be as selection.- Returns:
- true if it is added successfully; false if
obj
is not part of the data, or was already selected.
-
removeFromSelection
public boolean removeFromSelection(java.lang.Object obj)
Description copied from class:AbstractListModel
Remove the specified object from selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
removeFromSelection
in interfaceSelectable<E>
- Overrides:
removeFromSelection
in classAbstractListModel<E>
- Parameters:
obj
- the object to be remove from selection.- Returns:
- whether it is removed successfully
-
clearSelection
public void clearSelection()
Description copied from class:AbstractListModel
Change the selection to the empty set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
clearSelection
in interfaceSelectable<E>
- Overrides:
clearSelection
in classAbstractListModel<E>
-
setMultiple
public void setMultiple(boolean multiple)
Description copied from class:AbstractListModel
Sets the selection mode to be multiple.- Specified by:
setMultiple
in interfaceSelectable<E>
- Overrides:
setMultiple
in classAbstractListModel<E>
-
setSelectionControl
public void setSelectionControl(SelectionControl ctrl)
Description copied from interface:Selectable
Sets the selection control for the selection model- Specified by:
setSelectionControl
in interfaceSelectable<E>
- Overrides:
setSelectionControl
in classAbstractListModel<E>
-
getSelectionControl
public SelectionControl getSelectionControl()
Description copied from interface:Selectable
Returns the selection control for the selection model, if any.- Specified by:
getSelectionControl
in interfaceSelectable<E>
- Overrides:
getSelectionControl
in classAbstractListModel<E>
-
getPageSize
public int getPageSize()
Description copied from interface:Pageable
Returns the number of items per page.Default: 20.
- Specified by:
getPageSize
in interfacePageable
- Overrides:
getPageSize
in classAbstractListModel<E>
-
setPageSize
public void setPageSize(int size) throws WrongValueException
Description copied from interface:Pageable
Sets the number of items per page.- Specified by:
setPageSize
in interfacePageable
- Overrides:
setPageSize
in classAbstractListModel<E>
- Throws:
WrongValueException
-
getPageCount
public int getPageCount()
Description copied from interface:Pageable
Returns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCount
in interfacePageable
- Overrides:
getPageCount
in classAbstractListModel<E>
-
getActivePage
public int getActivePage()
Description copied from interface:Pageable
Returns the active page (starting from 0).- Specified by:
getActivePage
in interfacePageable
- Overrides:
getActivePage
in classAbstractListModel<E>
-
setActivePage
public void setActivePage(int pg) throws WrongValueException
Description copied from interface:Pageable
Sets the active page (starting from 0).- Specified by:
setActivePage
in interfacePageable
- Overrides:
setActivePage
in classAbstractListModel<E>
- Throws:
WrongValueException
-
addPagingEventListener
public void addPagingEventListener(PagingListener l)
Description copied from interface:PageableModel
Adds a listener to the list of listeners to be notified when a PagingEvent happens outside of standard Paging component- Specified by:
addPagingEventListener
in interfacePageableModel
- Overrides:
addPagingEventListener
in classAbstractListModel<E>
-
removePagingEventListener
public void removePagingEventListener(PagingListener l)
Description copied from interface:PageableModel
Removes a listener from the list of listeners to be notified when a PagingEvent happens outside of standard Paging component- Specified by:
removePagingEventListener
in interfacePageableModel
- Overrides:
removePagingEventListener
in classAbstractListModel<E>
-
removeRange
public void removeRange(int fromIndex, int toIndex)
Description copied from class:ListModelList
Remove from fromIndex(inclusive) to toIndex(exclusive). If fromIndex equals toIndex, this methods do nothing.- Overrides:
removeRange
in classListModelList<E>
- Parameters:
fromIndex
- the begin index (inclusive) to be removed.toIndex
- the end index (exclusive) to be removed.
-
getInnerList
public java.util.List<E> getInnerList()
Description copied from class:ListModelList
Get the inner real List.- Overrides:
getInnerList
in classListModelList<E>
-
getSize
public int getSize()
Description copied from interface:ListModel
Returns the length of the list.
-
getElementAt
public E getElementAt(int j)
Description copied from interface:ListModel
Returns the value at the specified index.- Specified by:
getElementAt
in interfaceListModel<E>
- Overrides:
getElementAt
in classListModelList<E>
-
add
public boolean add(E o)
- Specified by:
add
in interfacejava.util.Collection<E>
- Specified by:
add
in interfacejava.util.List<E>
- Overrides:
add
in classListModelList<E>
-
add
public void add(int index, E element)
- Specified by:
add
in interfacejava.util.List<E>
- Overrides:
add
in classListModelList<E>
-
notifyChange
public boolean notifyChange(E element)
Description copied from class:ListModelList
Notifies a change of the same element to trigger an event ofListDataEvent.CONTENTS_CHANGED
.- Overrides:
notifyChange
in classListModelList<E>
- Returns:
- true if the element exists
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
- Specified by:
addAll
in interfacejava.util.Collection<E>
- Specified by:
addAll
in interfacejava.util.List<E>
- Overrides:
addAll
in classListModelList<E>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends E> c)
- Specified by:
addAll
in interfacejava.util.List<E>
- Overrides:
addAll
in classListModelList<E>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<E>
- Specified by:
clear
in interfacejava.util.List<E>
- Overrides:
clear
in classListModelList<E>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<E>
- Specified by:
contains
in interfacejava.util.List<E>
- Overrides:
contains
in classListModelList<E>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<E>
- Specified by:
containsAll
in interfacejava.util.List<E>
- Overrides:
containsAll
in classListModelList<E>
-
get
public E get(int index)
- Specified by:
get
in interfacejava.util.List<E>
- Overrides:
get
in classListModelList<E>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<E>
- Overrides:
indexOf
in classListModelList<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<E>
- Specified by:
isEmpty
in interfacejava.util.List<E>
- Overrides:
isEmpty
in classListModelList<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<E>
- Overrides:
lastIndexOf
in classListModelList<E>
-
listIterator
public java.util.ListIterator<E> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<E>
- Overrides:
listIterator
in classListModelList<E>
-
listIterator
public java.util.ListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<E>
- Overrides:
listIterator
in classListModelList<E>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<E>
- Specified by:
remove
in interfacejava.util.List<E>
- Overrides:
remove
in classListModelList<E>
-
remove
public E remove(int index)
- Specified by:
remove
in interfacejava.util.List<E>
- Overrides:
remove
in classListModelList<E>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<E>
- Specified by:
removeAll
in interfacejava.util.List<E>
- Overrides:
removeAll
in classListModelList<E>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<E>
- Specified by:
retainAll
in interfacejava.util.List<E>
- Overrides:
retainAll
in classListModelList<E>
-
iterator
public java.util.Iterator<E> iterator()
-
set
public E set(int index, E element)
- Specified by:
set
in interfacejava.util.List<E>
- Overrides:
set
in classListModelList<E>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<E>
- Specified by:
size
in interfacejava.util.List<E>
- Overrides:
size
in classListModelList<E>
-
subList
public java.util.List<E> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<E>
- Overrides:
subList
in classListModelList<E>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<E>
- Specified by:
toArray
in interfacejava.util.List<E>
- Overrides:
toArray
in classListModelList<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<E>
- Specified by:
toArray
in interfacejava.util.List<E>
- Overrides:
toArray
in classListModelList<E>
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<E>
- Specified by:
equals
in interfacejava.util.List<E>
- Overrides:
equals
in classListModelList<E>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<E>
- Specified by:
hashCode
in interfacejava.util.List<E>
- Overrides:
hashCode
in classListModelList<E>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classListModelList<E>
-
sort
public void sort(java.util.Comparator<E> cmpr, boolean ascending)
Description copied from class:ListModelList
Sorts the data.
-
sort
public void sort()
Description copied from interface:Sortable
Sort the data model by default or assigned comparator. Notice that the default implementation does nothing, the model which implements Sortable need to implement this method.- Specified by:
sort
in interfaceSortable<E>
- Overrides:
sort
in classListModelList<E>
- See Also:
Sortable.sort(Comparator, boolean)
-
getSortDirection
public java.lang.String getSortDirection(java.util.Comparator<E> cmpr)
Description copied from interface:Sortable
Returns the sort direction of this model for the given comparator. It must be one of "ascending", "descending" and "natural".Default: "natural".
- Specified by:
getSortDirection
in interfaceSortable<E>
- Overrides:
getSortDirection
in classListModelList<E>
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classListModelList<E>
-
setHandler
public void setHandler(javassist.util.proxy.MethodHandler mi)
- Specified by:
setHandler
in interfacejavassist.util.proxy.Proxy
-
getOriginObject
public ListModelList<E> getOriginObject()
Description copied from interface:FormProxyObject
Returns the origin object.- Specified by:
getOriginObject
in interfaceFormProxyObject
-
resetFromOrigin
public void resetFromOrigin()
Description copied from interface:FormProxyObject
Resets all of the changes of this form from the origin object.- Specified by:
resetFromOrigin
in interfaceFormProxyObject
-
submitToOrigin
public void submitToOrigin(BindContext ctx)
Description copied from interface:FormProxyObject
Saves all of the changes of this form to the origin object.- Specified by:
submitToOrigin
in interfaceFormProxyObject
-
isFormDirty
public boolean isFormDirty()
Description copied from interface:FormProxyObject
Returns whether the form proxy object is dirty or not, including all of its attributes.- Specified by:
isFormDirty
in interfaceFormProxyObject
-
setFormOwner
public void setFormOwner(java.lang.Object owner, FormBinding binding)
Description copied from interface:FormProxyObject
Sets the owner of this form with its binding.- Specified by:
setFormOwner
in interfaceFormProxyObject
- Parameters:
owner
- the object associated with this form.
-
setPath
public void setPath(java.lang.String property, ProxyNode parent)
Description copied from interface:FormProxyObject
Set the property of current form proxy object and it's creator- Specified by:
setPath
in interfaceFormProxyObject
- Parameters:
property
- p the propertyparent
- parent the parent proxy node
-
cacheSavePropertyBinding
public void cacheSavePropertyBinding(java.lang.String property, SavePropertyBinding s)
Description copied from interface:FormProxyObject
Cache save property binding by property string- Specified by:
cacheSavePropertyBinding
in interfaceFormProxyObject
- Parameters:
property
- the property of save property bindings
- the save property binding
-
collectCachedSavePropertyBinding
public java.util.Set<Pair<java.lang.String,SavePropertyBinding>> collectCachedSavePropertyBinding()
Description copied from interface:FormProxyObject
Collect all of collect cached save property bindings- Specified by:
collectCachedSavePropertyBinding
in interfaceFormProxyObject
-
testEquals
protected static boolean testEquals(java.lang.Object e, java.lang.Object o)
-
createProxyObject
protected <T> T createProxyObject(T t)
-
-