|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.beanfabrics.AbstractBean
org.beanfabrics.ValidatableBean
org.beanfabrics.model.AbstractPM
org.beanfabrics.model.MapPM<K,V>
public class MapPM<K,V extends PresentationModel>
The MapPM is a map of presentation models. Basically it provides methods for
adding, removing, accessing and iterating elements and informs listeners
about changes. It also maintains a Selection
.
Nested Class Summary | |
---|---|
class |
MapPM.ListElementsValidationRule
This rule evaluates to invalid if at least one of the list elements is invalid. |
Nested classes/interfaces inherited from class org.beanfabrics.model.AbstractPM |
---|
AbstractPM.PropertiesValidationRule |
Field Summary | |
---|---|
protected static java.lang.String |
KEY_MESSAGE_INVALID_ELEMENTS
|
Fields inherited from class org.beanfabrics.model.AbstractPM |
---|
KEY_MESSAGE_ONE_OR_MORE_INVALID |
Constructor Summary | |
---|---|
MapPM()
|
Method Summary | |
---|---|
void |
addListListener(ListListener l)
Adds the given listener. |
void |
clear()
|
boolean |
contains(V element)
Returns true if this collection contains the specified
element. |
boolean |
containsKey(K key)
|
V |
get(K key)
|
java.util.Collection<V> |
getAll(int[] indices)
|
java.util.Collection<V> |
getAll(int startIndex,
int endIndex)
|
V |
getAt(int index)
Returns the element at the specified position in this list. |
K |
getKey(int index)
|
K |
getKey(V element)
|
java.util.Set<K> |
getKeys(java.util.Collection<?> col)
Returns a set of all keys of the elements in the given collection. |
java.util.Set<K> |
getKeys(int[] indices)
|
java.util.List<K> |
getKeys(int beginIndex,
int endIndex)
|
protected ListSupport |
getListPropertySupport()
|
SelectedKeys<K> |
getSelectedKeys()
|
Selection<V> |
getSelection()
Returns the selection of this list. |
Sorter |
getSorter()
Returns the Sorter . |
java.util.Collection<SortKey> |
getSortKeys()
Returns the (immutable) collection of SortKey objects that
reflect the current sorting state of this list. |
int |
indexOf(V element)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. |
int |
indexOfKey(K key)
|
int[] |
indicesOf(java.util.Collection elements)
Returns an sorted array of all indices of the given elements starting with the smallest index. |
int[] |
indicesOfKeys(java.util.Collection<K> keys)
Returns an sorted array of all indices of the elements with the given keys starting with the smallest index. |
boolean |
isEmpty()
Returns true if this collection contains no elements. |
boolean |
isRevalidateElementsOnChangeEnabled()
|
java.util.Iterator<V> |
iterator()
|
java.util.Iterator<K> |
keyiterator()
|
java.util.Set<K> |
keySet()
|
java.util.ListIterator<V> |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. |
protected void |
onEntriesChanged(java.util.EventObject evt)
|
V |
put(K key,
V newElement)
|
V |
put(K key,
V newElement,
int toIndex)
|
void |
putAll(java.util.Collection<java.util.Map.Entry<K,V>> aEntries)
|
void |
putAll(java.util.Map<K,V> aMap)
|
boolean |
remove(V elem)
|
boolean |
removeAll(java.util.Collection<? extends V> col)
|
java.util.Collection<V> |
removeAllIndices(int[] indices)
|
java.util.Collection<V> |
removeAllKeys(java.util.Set<K> keySet)
|
V |
removeAt(int index)
|
V |
removeKey(K key)
|
void |
removeListListener(ListListener l)
Removes the given listener. |
java.util.Collection<V> |
retainAllKeys(java.util.Set<K> keySet)
|
protected void |
revalidateAllExcept(V element)
|
void |
revalidateElements()
Revalidates all elements of this map. |
void |
reverse()
Reverses the order of the elements. |
void |
setAll(java.util.Map<K,V> newMap)
|
void |
setRevalidateElementsOnChangeEnabled(boolean enabled)
|
void |
setSorter(Sorter sorter)
Sets the Sorter . |
int |
size()
Returns the number of elements in this collection. |
void |
sortBy(boolean ascending,
Path... paths)
Sorts the elements of this list PM by comparing the child nodes at the end of the given paths. |
void |
sortBy(java.util.Collection<SortKey> newSortKeys)
Sorts the elements of this list PM by the specified sort keys. |
void |
sortBy(SortKey... newSortKeys)
Sorts the elements of this list PM by the specified sort keys. |
void |
swap(int indexA,
int indexB)
Swaps the position of the two elements specified by the given indexes. |
void |
swap(V elemA,
V elemB)
Swaps the position of these elements. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list in proper sequence (from first to last element). |
java.util.Collection<V> |
toCollection()
Returns a new Collection of all elements. |
java.util.Map<K,V> |
toMap()
Returns a new Map with all elements of this map. |
Methods inherited from class org.beanfabrics.model.AbstractPM |
---|
getComparable, getContext, getSupportMap, revalidateProperties |
Methods inherited from class org.beanfabrics.ValidatableBean |
---|
getValidationState, getValidator, isValid, revalidate, setValidationState |
Methods inherited from class org.beanfabrics.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, equals, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.beanfabrics.Bean |
---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface org.beanfabrics.validation.Validatable |
---|
getValidationState, getValidator, isValid, revalidate |
Methods inherited from interface org.beanfabrics.support.Supportable |
---|
getSupportMap |
Methods inherited from interface org.beanfabrics.context.ContextOwner |
---|
getContext |
Methods inherited from interface org.beanfabrics.HasComparable |
---|
getComparable |
Field Detail |
---|
protected static final java.lang.String KEY_MESSAGE_INVALID_ELEMENTS
Constructor Detail |
---|
public MapPM()
Method Detail |
---|
public Sorter getSorter()
Sorter
. The sorter defines the sorting alorithm used
sortBy(SortKey...)
.
Sorter
public void setSorter(Sorter sorter)
Sorter
.
See getSorter()
for details.
sorter
- public boolean isRevalidateElementsOnChangeEnabled()
public void setRevalidateElementsOnChangeEnabled(boolean enabled)
protected void onEntriesChanged(java.util.EventObject evt)
public void revalidateElements()
protected void revalidateAllExcept(V element)
protected ListSupport getListPropertySupport()
public boolean isEmpty()
IListPM
true
if this collection contains no elements.
isEmpty
in interface IListPM<V extends PresentationModel>
true
if this collection contains no elementspublic void clear()
public V put(K key, V newElement)
public V put(K key, V newElement, int toIndex)
public void swap(int indexA, int indexB)
IListPM
swap
in interface IListPM<V extends PresentationModel>
public void swap(V elemA, V elemB)
swap
in interface IListPM<V extends PresentationModel>
public void reverse()
public void sortBy(boolean ascending, Path... paths)
sortBy
in interface IListPM<V extends PresentationModel>
ascending
- if true, the resulting order will be ascending,
otherwise descending.public void sortBy(java.util.Collection<SortKey> newSortKeys)
sortBy
in interface IListPM<V extends PresentationModel>
newSortKeys
- the sort keys used for sorting the elements of this
list PMpublic void sortBy(SortKey... newSortKeys)
sortBy
in interface IListPM<V extends PresentationModel>
public java.util.Collection<SortKey> getSortKeys()
SortKey
objects that
reflect the current sorting state of this list.
getSortKeys
in interface IListPM<V extends PresentationModel>
SortKey
objects that
reflect the current sorting state of this listpublic int size()
IListPM
size
in interface IListPM<V extends PresentationModel>
public java.util.Collection<V> getAll(int startIndex, int endIndex)
public java.util.Collection<V> getAll(int[] indices)
public V getAt(int index)
IListPM
getAt
in interface IListPM<V extends PresentationModel>
public V get(K key)
public V removeAt(int index)
public V removeKey(K key)
public boolean remove(V elem)
public boolean removeAll(java.util.Collection<? extends V> col)
public java.util.Collection<V> toCollection()
IListPM
Collection
of all elements.
toCollection
in interface IListPM<V extends PresentationModel>
Collection
of all elementspublic java.util.Map<K,V> toMap()
IMapPM
Map
with all elements of this map.
toMap
in interface IMapPM<K,V extends PresentationModel>
Map
with all elements of this map.public java.lang.Object[] toArray()
IListPM
toArray
in interface IListPM<V extends PresentationModel>
public java.util.Set<K> keySet()
public boolean containsKey(K key)
public boolean contains(V element)
IListPM
true
if this collection contains the specified
element.
contains
in interface IListPM<V extends PresentationModel>
true
if this collection contains the specified
elementpublic int indexOfKey(K key)
public int indexOf(V element)
IListPM
indexOf
in interface IListPM<V extends PresentationModel>
public int[] indicesOfKeys(java.util.Collection<K> keys)
public int[] indicesOf(java.util.Collection elements)
public K getKey(V element)
public K getKey(int index)
public java.util.List<K> getKeys(int beginIndex, int endIndex)
public java.util.Set<K> getKeys(int[] indices)
public java.util.Set<K> getKeys(java.util.Collection<?> col)
col
-
public SelectedKeys<K> getSelectedKeys()
public Selection<V> getSelection()
IListPM
getSelection
in interface IListPM<V extends PresentationModel>
public void addListListener(ListListener l)
IListPM
addListListener
in interface IListPM<V extends PresentationModel>
public void removeListListener(ListListener l)
IListPM
removeListListener
in interface IListPM<V extends PresentationModel>
public java.util.Iterator<V> iterator()
iterator
in interface java.lang.Iterable<V extends PresentationModel>
public java.util.ListIterator<V> listIterator(int index)
IListPM
listIterator
in interface IListPM<V extends PresentationModel>
public java.util.Iterator<K> keyiterator()
public java.util.Collection<V> removeAllKeys(java.util.Set<K> keySet)
public java.util.Collection<V> retainAllKeys(java.util.Set<K> keySet)
public java.util.Collection<V> removeAllIndices(int[] indices)
public void putAll(java.util.Map<K,V> aMap)
public void putAll(java.util.Collection<java.util.Map.Entry<K,V>> aEntries)
public void setAll(java.util.Map<K,V> newMap)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |