Package org.zkoss.bind.proxy

## Class ListModelMapProxy<K,​V>

- java.lang.Object
- - org.zkoss.zul.AbstractListModel<java.util.Map.Entry<K,​V>>
  - - org.zkoss.zul.ListModelMap<K,​V>
    - - org.zkoss.bind.proxy.ListModelMapProxy<K,​V>

- All Implemented Interfaces:
    `java.io.Serializable`, `java.util.Map<K,​V>`, `javassist.util.proxy.Proxy`, `FormProxyObject`, `Pageable`, `Selectable<java.util.Map.Entry<K,​V>>`, `Sortable<java.util.Map.Entry<K,​V>>`, `ListModel<java.util.Map.Entry<K,​V>>`, `PageableModel`

      public class ListModelMapProxy<K,​V>
      extends ListModelMap<K,​V>
      implements javassist.util.proxy.Proxy, FormProxyObject, java.io.Serializable

  A ListModelMap 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>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>`

  - ### Field Summary

    - ### Fields inherited from class org.zkoss.zul.ListModelMap

      `_map`

    - ### Fields inherited from class org.zkoss.zul.AbstractListModel

      `_selection`

    - ### Fields inherited from interface org.zkoss.zul.PageableModel

      `INTERNAL_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ListModelMapProxy​(ListModelMap<K,​V> origin, java.lang.annotation.Annotation[] callerAnnots)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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 component
    `void` | `addSelection​(java.util.Map.Entry<K,​V> obj)` |
    `boolean` | `addToSelection​(java.util.Map.Entry<K,​V> obj)` | Add the specified object into selection.
    `void` | `cacheSavePropertyBinding​(java.lang.String property, SavePropertyBinding s)` | Cache save property binding by property string
    `void` | `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 bindings
    `boolean` | `containsKey​(java.lang.Object key)` |
    `boolean` | `containsValue​(java.lang.Object value)` |
    `java.util.Set<java.util.Map.Entry<K,​V>>` | `entrySet()` |
    `boolean` | `equals​(java.lang.Object o)` |
    `V` | `get​(java.lang.Object key)` |
    `int` | `getActivePage()` | Returns the active page (starting from 0).
    `java.util.Map.Entry<K,​V>` | `getElementAt​(int j)` | Returns the entry (Map.Entry) at the specified index.
    `java.util.Map<K,​V>` | `getInnerMap()` | Get the inner real Map.
    `ListModelMap<K,​V>` | `getOriginObject()` | Returns the origin object.
    `int` | `getPageCount()` | Returns the number of pages.
    `int` | `getPageSize()` | Returns the number of items per page.
    `java.util.Set<java.util.Map.Entry<K,​V>>` | `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<java.util.Map.Entry<K,​V>> cmpr)` | Returns the sort direction of this model for the given comparator.
    `int` | `hashCode()` |
    `int` | `indexOf​(java.lang.Object o)` | Returns the index of the specified object based on the entry (Map.Entry).
    `int` | `indexOfKey​(java.lang.Object o)` | Returns the index of the specified object based on the key.
    `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.Set<K>` | `keySet()` |
    `void` | `onDataChange​(java.lang.Object o)` |
    `void` | `onDirtyChange()` |
    `V` | `put​(K key, V value)` |
    `void` | `putAll​(java.util.Map<? extends K,​? extends V> m)` |
    `V` | `remove​(java.lang.Object key)` |
    `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 component
    `void` | `removeSelection​(java.lang.Object obj)` |
    `void` | `resetFromOrigin()` | Resets all of the changes of this form from the origin object.
    `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 creator
    `void` | `setSelection​(java.util.Set<java.util.Map.Entry<K,​V>> selection)` |
    `void` | `setSelectionControl​(SelectionControl ctrl)` | Sets the selection control for the selection model
    `int` | `size()` |
    `void` | `sort()` | Sort the data model by default or assigned comparator.
    `void` | `sort​(java.util.Comparator<java.util.Map.Entry<K,​V>> cmpr, boolean ascending)` | Sorts the data.
    `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.String` | `toString()` |
    `java.util.Collection<V>` | `values()` |

    - ### Methods inherited from class org.zkoss.zul.ListModelMap

      `fireSelectionEvent, readSelection, writeSelection`

    - ### Methods inherited from class org.zkoss.zul.AbstractListModel

      `fireEvent, getListDataListeners, getTotalSize, isMultiple, newEmptySelection, removeAllSelection, retainAllSelection, setSelection`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

- - ### Constructor Detail

    - #### ListModelMapProxy

          public ListModelMapProxy​(ListModelMap<K,​V> origin,
                                   java.lang.annotation.Annotation[] callerAnnots)

  - ### Method Detail

    - #### 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 interface `ListModel<K>`
      Overrides:
        `addListDataListener` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### 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 interface `ListModel<K>`
      Overrides:
        `removeListDataListener` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### getSelection

          public java.util.Set<java.util.Map.Entry<K,​V>> getSelection()

      Description copied from class: `AbstractListModel`
      Returns the current selection. It is readonly. Don't modify it directly
      Specified by:
        `getSelection` in interface `Selectable<K>`
      Overrides:
        `getSelection` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`
      Returns:
        the current selection.

    - #### setSelection

          public void setSelection​(java.util.Set<java.util.Map.Entry<K,​V>> selection)

    - #### isSelected

          public boolean isSelected​(java.lang.Object obj)

      Description copied from class: `AbstractListModel`
      Returns whether an object is selected.
      Specified by:
        `isSelected` in interface `Selectable<K>`
      Overrides:
        `isSelected` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### isSelectionEmpty

          public boolean isSelectionEmpty()

      Description copied from class: `AbstractListModel`
      Returns true if the selection is currently empty.
      Specified by:
        `isSelectionEmpty` in interface `Selectable<K>`
      Overrides:
        `isSelectionEmpty` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### addToSelection

          public boolean addToSelection​(java.util.Map.Entry<K,​V> 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 interface `Selectable<K>`
      Overrides:
        `addToSelection` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`
      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 interface `Selectable<K>`
      Overrides:
        `removeFromSelection` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`
      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 interface `Selectable<K>`
      Overrides:
        `clearSelection` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### setMultiple

          public void setMultiple​(boolean multiple)

      Description copied from class: `AbstractListModel`
      Sets the selection mode to be multiple.
      Specified by:
        `setMultiple` in interface `Selectable<K>`
      Overrides:
        `setMultiple` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### setSelectionControl

          public void setSelectionControl​(SelectionControl ctrl)

      Description copied from interface: `Selectable`
      Sets the selection control for the selection model
      Specified by:
        `setSelectionControl` in interface `Selectable<K>`
      Overrides:
        `setSelectionControl` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### getSelectionControl

          public SelectionControl getSelectionControl()

      Description copied from interface: `Selectable`
      Returns the selection control for the selection model, if any.
      Specified by:
        `getSelectionControl` in interface `Selectable<K>`
      Overrides:
        `getSelectionControl` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### addSelection

          public void addSelection​(java.util.Map.Entry<K,​V> obj)

    - #### removeSelection

          public void removeSelection​(java.lang.Object obj)

    - #### getPageSize

          public int getPageSize()

      Description copied from interface: `Pageable`
      Returns the number of items per page.

      Default: 20.

      Specified by:
        `getPageSize` in interface `Pageable`
      Overrides:
        `getPageSize` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### setPageSize

          public void setPageSize​(int size)
                           throws WrongValueException

      Description copied from interface: `Pageable`
      Sets the number of items per page.
      Specified by:
        `setPageSize` in interface `Pageable`
      Overrides:
        `setPageSize` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`
      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 interface `Pageable`
      Overrides:
        `getPageCount` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### getActivePage

          public int getActivePage()

      Description copied from interface: `Pageable`
      Returns the active page (starting from 0).
      Specified by:
        `getActivePage` in interface `Pageable`
      Overrides:
        `getActivePage` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### setActivePage

          public void setActivePage​(int pg)
                             throws WrongValueException

      Description copied from interface: `Pageable`
      Sets the active page (starting from 0).
      Specified by:
        `setActivePage` in interface `Pageable`
      Overrides:
        `setActivePage` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`
      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 interface `PageableModel`
      Overrides:
        `addPagingEventListener` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### 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 interface `PageableModel`
      Overrides:
        `removePagingEventListener` in class `AbstractListModel<java.util.Map.Entry<K,​V>>`

    - #### getInnerMap

          public java.util.Map<K,​V> getInnerMap()

      Description copied from class: `ListModelMap`
      Get the inner real Map.
      Overrides:
        `getInnerMap` in class `ListModelMap<K,​V>`

    - #### getSize

          public int getSize()

      Description copied from interface: `ListModel`
      Returns the length of the list.
      Specified by:
        `getSize` in interface `ListModel<K>`
      Overrides:
        `getSize` in class `ListModelMap<K,​V>`

    - #### getElementAt

          public java.util.Map.Entry<K,​V> getElementAt​(int j)

      Description copied from class: `ListModelMap`
      Returns the entry (Map.Entry) at the specified index.
      Specified by:
        `getElementAt` in interface `ListModel<K>`
      Overrides:
        `getElementAt` in class `ListModelMap<K,​V>`

    - #### containsKey

          public boolean containsKey​(java.lang.Object key)

      Specified by:
        `containsKey` in interface `java.util.Map<K,​V>`
      Overrides:
        `containsKey` in class `ListModelMap<K,​V>`

    - #### containsValue

          public boolean containsValue​(java.lang.Object value)

      Specified by:
        `containsValue` in interface `java.util.Map<K,​V>`
      Overrides:
        `containsValue` in class `ListModelMap<K,​V>`

    - #### entrySet

          public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()

      Specified by:
        `entrySet` in interface `java.util.Map<K,​V>`
      Overrides:
        `entrySet` in class `ListModelMap<K,​V>`

    - #### equals

          public boolean equals​(java.lang.Object o)

      Specified by:
        `equals` in interface `java.util.Map<K,​V>`
      Overrides:
        `equals` in class `ListModelMap<K,​V>`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `ListModelMap<K,​V>`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `java.util.Map<K,​V>`
      Overrides:
        `hashCode` in class `ListModelMap<K,​V>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `java.util.Map<K,​V>`
      Overrides:
        `isEmpty` in class `ListModelMap<K,​V>`

    - #### get

          public V get​(java.lang.Object key)

      Specified by:
        `get` in interface `java.util.Map<K,​V>`
      Overrides:
        `get` in class `ListModelMap<K,​V>`

    - #### put

          public V put​(K key,
                       V value)

      Specified by:
        `put` in interface `java.util.Map<K,​V>`
      Overrides:
        `put` in class `ListModelMap<K,​V>`

    - #### remove

          public V remove​(java.lang.Object key)

      Specified by:
        `remove` in interface `java.util.Map<K,​V>`
      Overrides:
        `remove` in class `ListModelMap<K,​V>`

    - #### putAll

          public void putAll​(java.util.Map<? extends K,​? extends V> m)

      Specified by:
        `putAll` in interface `java.util.Map<K,​V>`
      Overrides:
        `putAll` in class `ListModelMap<K,​V>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `java.util.Map<K,​V>`
      Overrides:
        `clear` in class `ListModelMap<K,​V>`

    - #### keySet

          public java.util.Set<K> keySet()

      Specified by:
        `keySet` in interface `java.util.Map<K,​V>`
      Overrides:
        `keySet` in class `ListModelMap<K,​V>`

    - #### values

          public java.util.Collection<V> values()

      Specified by:
        `values` in interface `java.util.Map<K,​V>`
      Overrides:
        `values` in class `ListModelMap<K,​V>`

    - #### indexOfKey

          public int indexOfKey​(java.lang.Object o)

      Description copied from class: `ListModelMap`
      Returns the index of the specified object based on the key.
      Overrides:
        `indexOfKey` in class `ListModelMap<K,​V>`
      Parameters:
        `o` - the key to look for

    - #### indexOf

          public int indexOf​(java.lang.Object o)

      Description copied from class: `ListModelMap`
      Returns the index of the specified object based on the entry (Map.Entry).
      Overrides:
        `indexOf` in class `ListModelMap<K,​V>`
      Parameters:
        `o` - the object to look for. It must be an instance of Map.Entry.

    - #### size

          public int size()

      Specified by:
        `size` in interface `java.util.Map<K,​V>`
      Overrides:
        `size` in class `ListModelMap<K,​V>`

    - #### sort

          public void sort​(java.util.Comparator<java.util.Map.Entry<K,​V>> cmpr,
                           boolean ascending)

      Description copied from class: `ListModelMap`
      Sorts the data.
      Specified by:
        `sort` in interface `Sortable<K>`
      Overrides:
        `sort` in class `ListModelMap<K,​V>`
      Parameters:
        `cmpr` - the comparator.
        `ascending` - whether to sort in the ascending order. It is ignored since this implementation uses cmpr to compare.

    - #### 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 interface `Sortable<K>`
      Overrides:
        `sort` in class `ListModelMap<K,​V>`
      See Also:
        `Sortable.sort(Comparator, boolean)`

    - #### getSortDirection

          public java.lang.String getSortDirection​(java.util.Comparator<java.util.Map.Entry<K,​V>> 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 interface `Sortable<K>`
      Overrides:
        `getSortDirection` in class `ListModelMap<K,​V>`

    - #### clone

          public java.lang.Object clone()

      Overrides:
        `clone` in class `ListModelMap<K,​V>`

    - #### getOriginObject

          public ListModelMap<K,​V> getOriginObject()

      Description copied from interface: `FormProxyObject`
      Returns the origin object.
      Specified by:
        `getOriginObject` in interface `FormProxyObject`

    - #### onDirtyChange

          public void onDirtyChange()

    - #### onDataChange

          public void onDataChange​(java.lang.Object o)

    - #### setDirty

          protected void setDirty​(boolean d)

    - #### setHandler

          public void setHandler​(javassist.util.proxy.MethodHandler mi)

      Specified by:
        `setHandler` in interface `javassist.util.proxy.Proxy`

    - #### 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 interface `FormProxyObject`

    - #### 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 interface `FormProxyObject`

    - #### 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 interface `FormProxyObject`

    - #### testEquals

          protected static boolean testEquals​(java.lang.Object e,
                                              java.lang.Object o)

    - #### 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 interface `FormProxyObject`
      Parameters:
        `owner` - the object associated with this form.

    - #### 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 interface `FormProxyObject`
      Parameters:
        `property` - the property of save property binding
        `s` - 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 interface `FormProxyObject`

    - #### 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 interface `FormProxyObject`
      Parameters:
        `property` - p the property
        `parent` - parent the parent proxy node