Package org.zkoss.zul

Class ListModelSet<E>

java.lang.Object
org.zkoss.zul.AbstractListModel<E>
org.zkoss.zul.ListModelSet<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Set<E>, Pageable, Selectable<E>, Sortable<E>, ListModel<E>, PageableModel

public class ListModelSet<E> extends AbstractListModel<E> implements Sortable<E>, Set<E>, Serializable

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

Author:
Henri Chen
See Also:
  • Field Details

    • _set

      protected Set<E> _set
  • Constructor Details

    • ListModelSet

      public ListModelSet(Set<E> set, boolean live)
      Constructor
      Parameters:
      set - the set to represent
      live - whether to have a 'live' ListModel on top of the specified set. If false, the content of the specified set is copied. If true, this object is a 'facade' of the specified set, i.e., when you add or remove items from this ListModelSet, the inner "live" set would be changed accordingly. However, it is not a good idea to modify set 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
    • ListModelSet

      public ListModelSet()
      Constructor.
    • ListModelSet

      public ListModelSet(Collection<? extends E> c)
      Constructor. It makes a copy of the specified collection (i.e., not live).

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

    • ListModelSet

      public ListModelSet(E[] array)
      Constructor. It makes a copy of the specified array (i.e., not live).
      Since:
      2.4.1
    • ListModelSet

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

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