Package org.zkoss.zul

Class ListModelMap<K,V>

java.lang.Object
org.zkoss.zul.AbstractListModel<Map.Entry<K,V>>
org.zkoss.zul.ListModelMap<K,V>
All Implemented Interfaces:
Serializable, Map<K,V>, Pageable, Selectable<Map.Entry<K,V>>, Sortable<Map.Entry<K,V>>, ListModel<Map.Entry<K,V>>, PageableModel

public class ListModelMap<K,V> extends AbstractListModel<Map.Entry<K,V>> implements Sortable<Map.Entry<K,V>>, Map<K,V>, Serializable

This is the ListModel as a Map to be used with Listbox. Add or remove the contents of this model as a List would cause the associated Listbox to change accordingly.

Author:
Henri Chen
See Also:
  • Field Details

    • _map

      protected Map<K,V> _map
  • Constructor Details

    • ListModelMap

      public ListModelMap(Map<K,V> map, boolean live)
      Constructor.
      Parameters:
      map - the map to represent
      live - whether to have a 'live' ListModel on top of the specified map. If false, the content of the specified map is copied. If true, this object is a 'facade' of the specified map, i.e., when you add or remove items from this ListModelMap, the inner "live" map would be changed accordingly. However, it is not a good idea to modify map if it is passed to this method with live is true, since Listbox is not smart enough to handle it. Instead, modify it thru this object.
      Since:
      2.4.0
    • ListModelMap

      public ListModelMap()
      Constructor.
    • ListModelMap

      public ListModelMap(Map<? extends K,? extends V> map)
      Constructor. It makes a copy of the specified map (i.e., not live).

      Notice that if the data is static or not shared, it is better to use ListModelMap(map, true) instead, since making a copy is slower.

    • ListModelMap

      public ListModelMap(int initialCapacity)
      Constructor.
      Parameters:
      initialCapacity - the initial capacity for this ListModelMap.
    • ListModelMap

      public ListModelMap(int initialCapacity, float loadFactor)
      Constructor.
      Parameters:
      initialCapacity - the initial capacity for this ListModelMap.
      loadFactor - the loadFactor to increase capacity of this ListModelMap.
  • Method Details