Class ListModelArrayProxy<E>
- java.lang.Object
-
- org.zkoss.zul.AbstractListModel<E>
-
- org.zkoss.zul.ListModelArray<E>
-
- org.zkoss.bind.proxy.ListModelArrayProxy<E>
-
- All Implemented Interfaces:
java.io.Serializable,javassist.util.proxy.Proxy,FormProxyObject,Pageable,Selectable<E>,Sortable<E>,ListModel<E>,PageableModel
public class ListModelArrayProxy<E> extends ListModelArray<E> implements javassist.util.proxy.Proxy, FormProxyObject, java.io.Serializable
A ListModelArray 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.ListModelArray
_array
-
Fields inherited from class org.zkoss.zul.AbstractListModel
_selection
-
Fields inherited from interface org.zkoss.zul.PageableModel
INTERNAL_EVENT
-
-
Constructor Summary
Constructors Constructor Description ListModelArrayProxy(ListModelArray<E> origin, java.lang.annotation.Annotation[] callerAnnots)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListDataListener(ListDataListener l)Adds a listener to the list that's notified each time a change to the data model occurs.voidaddPagingEventListener(PagingListener l)Adds a listener to the list of listeners to be notified when a PagingEvent happens outside of standard Paging componentvoidaddSelection(E obj)booleanaddToSelection(E obj)Add the specified object into selection.voidcacheSavePropertyBinding(java.lang.String property, SavePropertyBinding s)Cache save property binding by property stringvoidclearSelection()Change the selection to the empty set.java.lang.Objectclone()java.util.Set<Pair<java.lang.String,SavePropertyBinding>>collectCachedSavePropertyBinding()Collect all of collect cached save property bindingsprotected <T> TcreateProxyObject(T t)booleanequals(java.lang.Object o)protected voidfireSelectionEvent(E e)Selectable's implementor use only.Eget(int index)Get the value of this ListModelArray at specified index.intgetActivePage()Returns the active page (starting from 0).EgetElementAt(int j)Returns the value at the specified index.java.lang.Object[]getInnerArray()Get the inner real Object[].ListModelArray<E>getOriginObject()Returns the origin object.intgetPageCount()Returns the number of pages.intgetPageSize()Returns the number of items per page.java.util.Set<E>getSelection()Returns the current selection.SelectionControlgetSelectionControl()Returns the selection control for the selection model, if any.intgetSize()Returns the length of the list.java.lang.StringgetSortDirection(java.util.Comparator<E> cmpr)Returns the sort direction of this model for the given comparator.inthashCode()intindexOf(java.lang.Object elm)Returns the index of the specified element.booleanisFormDirty()Returns whether the form proxy object is dirty or not, including all of its attributes.booleanisSelected(java.lang.Object obj)Returns whether an object is selected.booleanisSelectionEmpty()Returns true if the selection is currently empty.booleannotifyChange(E element)Notifies a change of the same element to trigger an event ofListDataEvent.CONTENTS_CHANGED.voidonDataChange(java.lang.Object o)voidonDirtyChange()booleanremoveFromSelection(java.lang.Object obj)Remove the specified object from selection.voidremoveListDataListener(ListDataListener l)Removes a listener from the list that's notified each time a change to the data model occurs.voidremovePagingEventListener(PagingListener l)Removes a listener from the list of listeners to be notified when a PagingEvent happens outside of standard Paging componentvoidremoveSelection(java.lang.Object obj)voidresetFromOrigin()Resets all of the changes of this form from the origin object.voidset(int index, E value)Change content of the Array at specified index.voidsetActivePage(int pg)Sets the active page (starting from 0).protected voidsetDirty(boolean d)voidsetFormOwner(java.lang.Object owner, FormBinding binding)Sets the owner of this form with its binding.voidsetHandler(javassist.util.proxy.MethodHandler mi)voidsetMultiple(boolean multiple)Sets the selection mode to be multiple.voidsetPageSize(int size)Sets the number of items per page.voidsetPath(java.lang.String property, ProxyNode parent)Set the property of current form proxy object and it's creatorvoidsetSelection(java.util.Collection<? extends E> selection)Replace the current selection with the given set.voidsetSelectionControl(SelectionControl ctrl)Sets the selection control for the selection modelvoidsort()Sort the data model by default or assigned comparator.voidsort(java.util.Comparator<E> cmpr, boolean ascending)Sorts the data.voidsubmitToOrigin(BindContext ctx)Saves all of the changes of this form to the origin object.protected static booleantestEquals(java.lang.Object e, java.lang.Object o)java.lang.StringtoString()-
Methods inherited from class org.zkoss.zul.AbstractListModel
fireEvent, getListDataListeners, getTotalSize, isMultiple, newEmptySelection, readSelection, removeAllSelection, retainAllSelection, writeSelection
-
-
-
-
Constructor Detail
-
ListModelArrayProxy
public ListModelArrayProxy(ListModelArray<E> origin, java.lang.annotation.Annotation[] callerAnnots)
-
-
Method Detail
-
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:AbstractListModelAdds a listener to the list that's notified each time a change to the data model occurs.- Specified by:
addListDataListenerin interfaceListModel<E>- Overrides:
addListDataListenerin classAbstractListModel<E>
-
removeListDataListener
public void removeListDataListener(ListDataListener l)
Description copied from class:AbstractListModelRemoves a listener from the list that's notified each time a change to the data model occurs.- Specified by:
removeListDataListenerin interfaceListModel<E>- Overrides:
removeListDataListenerin classAbstractListModel<E>
-
getSelection
public java.util.Set<E> getSelection()
Description copied from class:AbstractListModelReturns the current selection. It is readonly. Don't modify it directly- Specified by:
getSelectionin interfaceSelectable<E>- Overrides:
getSelectionin classAbstractListModel<E>- Returns:
- the current selection.
-
setSelection
public void setSelection(java.util.Collection<? extends E> selection)
Description copied from class:AbstractListModelReplace the current selection with the given set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
setSelectionin interfaceSelectable<E>- Overrides:
setSelectionin classAbstractListModel<E>
-
isSelected
public boolean isSelected(java.lang.Object obj)
Description copied from class:AbstractListModelReturns whether an object is selected.- Specified by:
isSelectedin interfaceSelectable<E>- Overrides:
isSelectedin classAbstractListModel<E>
-
isSelectionEmpty
public boolean isSelectionEmpty()
Description copied from class:AbstractListModelReturns true if the selection is currently empty.- Specified by:
isSelectionEmptyin interfaceSelectable<E>- Overrides:
isSelectionEmptyin classAbstractListModel<E>
-
addToSelection
public boolean addToSelection(E obj)
Description copied from class:AbstractListModelAdd the specified object into selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
addToSelectionin interfaceSelectable<E>- Overrides:
addToSelectionin classAbstractListModel<E>- Parameters:
obj- the object to be as selection.- Returns:
- true if it is added successfully; false if
objis not part of the data, or was already selected.
-
removeFromSelection
public boolean removeFromSelection(java.lang.Object obj)
Description copied from class:AbstractListModelRemove the specified object from selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
removeFromSelectionin interfaceSelectable<E>- Overrides:
removeFromSelectionin 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:AbstractListModelChange the selection to the empty set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
clearSelectionin interfaceSelectable<E>- Overrides:
clearSelectionin classAbstractListModel<E>
-
setMultiple
public void setMultiple(boolean multiple)
Description copied from class:AbstractListModelSets the selection mode to be multiple.- Specified by:
setMultiplein interfaceSelectable<E>- Overrides:
setMultiplein classAbstractListModel<E>
-
getPageSize
public int getPageSize()
Description copied from interface:PageableReturns the number of items per page.Default: 20.
- Specified by:
getPageSizein interfacePageable- Overrides:
getPageSizein classAbstractListModel<E>
-
setPageSize
public void setPageSize(int size) throws WrongValueExceptionDescription copied from interface:PageableSets the number of items per page.- Specified by:
setPageSizein interfacePageable- Overrides:
setPageSizein classAbstractListModel<E>- Throws:
WrongValueException
-
getPageCount
public int getPageCount()
Description copied from interface:PageableReturns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCountin interfacePageable- Overrides:
getPageCountin classAbstractListModel<E>
-
getActivePage
public int getActivePage()
Description copied from interface:PageableReturns the active page (starting from 0).- Specified by:
getActivePagein interfacePageable- Overrides:
getActivePagein classAbstractListModel<E>
-
setActivePage
public void setActivePage(int pg) throws WrongValueExceptionDescription copied from interface:PageableSets the active page (starting from 0).- Specified by:
setActivePagein interfacePageable- Overrides:
setActivePagein classAbstractListModel<E>- Throws:
WrongValueException
-
setSelectionControl
public void setSelectionControl(SelectionControl ctrl)
Description copied from interface:SelectableSets the selection control for the selection model- Specified by:
setSelectionControlin interfaceSelectable<E>- Overrides:
setSelectionControlin classAbstractListModel<E>
-
getSelectionControl
public SelectionControl getSelectionControl()
Description copied from interface:SelectableReturns the selection control for the selection model, if any.- Specified by:
getSelectionControlin interfaceSelectable<E>- Overrides:
getSelectionControlin classAbstractListModel<E>
-
addPagingEventListener
public void addPagingEventListener(PagingListener l)
Description copied from interface:PageableModelAdds a listener to the list of listeners to be notified when a PagingEvent happens outside of standard Paging component- Specified by:
addPagingEventListenerin interfacePageableModel- Overrides:
addPagingEventListenerin classAbstractListModel<E>
-
removePagingEventListener
public void removePagingEventListener(PagingListener l)
Description copied from interface:PageableModelRemoves a listener from the list of listeners to be notified when a PagingEvent happens outside of standard Paging component- Specified by:
removePagingEventListenerin interfacePageableModel- Overrides:
removePagingEventListenerin classAbstractListModel<E>
-
get
public E get(int index)
Description copied from class:ListModelArrayGet the value of this ListModelArray at specified index.- Overrides:
getin classListModelArray<E>- Parameters:
index- the array index to be get value.
-
set
public void set(int index, E value)Description copied from class:ListModelArrayChange content of the Array at specified index.- Overrides:
setin classListModelArray<E>- Parameters:
index- the array index to be set the new value.
-
getInnerArray
public java.lang.Object[] getInnerArray()
Description copied from class:ListModelArrayGet the inner real Object[].- Overrides:
getInnerArrayin classListModelArray<E>
-
indexOf
public int indexOf(java.lang.Object elm)
Description copied from class:ListModelArrayReturns the index of the specified element.- Overrides:
indexOfin classListModelArray<E>
-
notifyChange
public boolean notifyChange(E element)
Description copied from class:ListModelArrayNotifies a change of the same element to trigger an event ofListDataEvent.CONTENTS_CHANGED.- Overrides:
notifyChangein classListModelArray<E>- Returns:
- true if the element exists
-
getSize
public int getSize()
Description copied from interface:ListModelReturns the length of the list.
-
getElementAt
public E getElementAt(int j)
Description copied from interface:ListModelReturns the value at the specified index.- Specified by:
getElementAtin interfaceListModel<E>- Overrides:
getElementAtin classListModelArray<E>
-
sort
public void sort(java.util.Comparator<E> cmpr, boolean ascending)
Description copied from class:ListModelArraySorts the data.
-
sort
public void sort()
Description copied from interface:SortableSort 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:
sortin interfaceSortable<E>- Overrides:
sortin classListModelArray<E>- See Also:
Sortable.sort(Comparator, boolean)
-
getSortDirection
public java.lang.String getSortDirection(java.util.Comparator<E> cmpr)
Description copied from interface:SortableReturns the sort direction of this model for the given comparator. It must be one of "ascending", "descending" and "natural".Default: "natural".
- Specified by:
getSortDirectionin interfaceSortable<E>- Overrides:
getSortDirectionin classListModelArray<E>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classListModelArray<E>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classListModelArray<E>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classListModelArray<E>
-
clone
public java.lang.Object clone()
- Overrides:
clonein classListModelArray<E>
-
fireSelectionEvent
protected void fireSelectionEvent(E e)
Description copied from class:AbstractListModelSelectable's implementor use only.Fires a selection event for component to scroll into view. The override subclass must put the index0 of
AbstractListModel.fireEvent(int, int, int)as the view index to scroll. By default, the value -1 is assumed which means no scroll into view.The method is invoked when both methods are invoked.
AbstractListModel.addToSelection(Object)andAbstractListModel.setSelection(Collection).- Overrides:
fireSelectionEventin classListModelArray<E>- Parameters:
e- selected object.
-
addSelection
public void addSelection(E obj)
-
removeSelection
public void removeSelection(java.lang.Object obj)
-
setHandler
public void setHandler(javassist.util.proxy.MethodHandler mi)
- Specified by:
setHandlerin interfacejavassist.util.proxy.Proxy
-
getOriginObject
public ListModelArray<E> getOriginObject()
Description copied from interface:FormProxyObjectReturns the origin object.- Specified by:
getOriginObjectin interfaceFormProxyObject
-
resetFromOrigin
public void resetFromOrigin()
Description copied from interface:FormProxyObjectResets all of the changes of this form from the origin object.- Specified by:
resetFromOriginin interfaceFormProxyObject
-
submitToOrigin
public void submitToOrigin(BindContext ctx)
Description copied from interface:FormProxyObjectSaves all of the changes of this form to the origin object.- Specified by:
submitToOriginin interfaceFormProxyObject
-
isFormDirty
public boolean isFormDirty()
Description copied from interface:FormProxyObjectReturns whether the form proxy object is dirty or not, including all of its attributes.- Specified by:
isFormDirtyin interfaceFormProxyObject
-
setFormOwner
public void setFormOwner(java.lang.Object owner, FormBinding binding)Description copied from interface:FormProxyObjectSets the owner of this form with its binding.- Specified by:
setFormOwnerin interfaceFormProxyObject- Parameters:
owner- the object associated with this form.
-
setPath
public void setPath(java.lang.String property, ProxyNode parent)Description copied from interface:FormProxyObjectSet the property of current form proxy object and it's creator- Specified by:
setPathin 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:FormProxyObjectCache save property binding by property string- Specified by:
cacheSavePropertyBindingin 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:FormProxyObjectCollect all of collect cached save property bindings- Specified by:
collectCachedSavePropertyBindingin interfaceFormProxyObject
-
testEquals
protected static boolean testEquals(java.lang.Object e, java.lang.Object o)
-
createProxyObject
protected <T> T createProxyObject(T t)
-
-