Class CmsHookList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<java.lang.String>
-
- org.opencms.workplace.tools.searchindex.CmsHookList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<java.lang.String>
,java.util.Collection<java.lang.String>
,java.util.Deque<java.lang.String>
,java.util.List<java.lang.String>
,java.util.Queue<java.lang.String>
- Direct Known Subclasses:
CmsHookListSearchCategory
public abstract class CmsHookList extends java.util.LinkedList<java.lang.String>
A list intended for subclassing that triggers "listlet" operations that may access a on a "peer" object that is provided by a template method to implement in subclasses.This is intended to react on modifications on
instances performed byList
instances linked to them. Using normal list implementations makes it impossible to intervene in those list modification by the widget technology.CmsWidgetDialogParameter
"Listlet" operations are operations that are triggered upon modification of this list. They are called "on<methodName(>[e]d(<peerObject>, <argList>)" where <methodName> is the name of the original list operation that took place, "[e]d" stands for the past (operation took place), <peerObject> is the given class to perform reactions on (see constructors) and <argList> are the arguments of the original list method in that order.
Currently only the operations used by
(see implementation ofCmsWidgetDialog
) are supported and sufficient for this purpose. More general usability enforces extending the pattern shown here.CmsWidgetDialog.actionToggleElement()
- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CmsHookList(java.lang.Object peer)
Creates an empty list.CmsHookList(java.lang.Object peer, java.util.Collection<java.lang.String> c)
Creates a list filled with all elements of the given argument.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(int index, java.lang.String element)
boolean
add(java.lang.String o)
void
clear()
java.lang.String
get(int index)
java.util.Iterator<java.lang.String>
iterator()
protected abstract void
onAdded(java.lang.Object peer, int index, java.lang.Object element)
React on the performed operation
by informing argument peer.List.add(int, java.lang.Object)
protected abstract void
onAdded(java.lang.Object peer, java.lang.Object o)
React on the performed operation
by informing argument peer.List.add(java.lang.Object)
protected abstract void
onClear(java.lang.Object peer)
React on the operation to come
by informing argument peer.List.clear()
protected abstract void
onCleared(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.clear()
protected abstract void
onGetCall(java.lang.Object peer, int index)
React on the performed operation
by informing argument peer.List.get(int)
protected abstract void
onIteratorCall(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.iterator()
protected abstract void
onRemoved(java.lang.Object peer, int index)
React on the performed operation
by informing argument peer.List.remove(int)
java.lang.String
remove(int index)
-
Methods inherited from class java.util.LinkedList
addAll, addAll, addFirst, addLast, clone, contains, descendingIterator, element, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
-
-
-
Constructor Detail
-
CmsHookList
public CmsHookList(java.lang.Object peer)
Creates an empty list.Subclasses should increase "safety by design" by narrowing the type of peer.
- Parameters:
peer
- the object reactions on operations shall be made on in the "listlet" methods of subclasses
-
CmsHookList
public CmsHookList(java.lang.Object peer, java.util.Collection<java.lang.String> c)
Creates a list filled with all elements of the given argument.Subclasses should increase "safety by design" by narrowing the type of peer.
- Parameters:
peer
- the object reactions on operations shall be made on in the "listlet" methods of subclassesc
- a collection with all values for this list
-
-
Method Detail
-
add
public void add(int index, java.lang.String element)
- Specified by:
add
in interfacejava.util.List<java.lang.String>
- Overrides:
add
in classjava.util.LinkedList<java.lang.String>
- See Also:
List.add(int, java.lang.Object)
-
add
public boolean add(java.lang.String o)
- Specified by:
add
in interfacejava.util.Collection<java.lang.String>
- Specified by:
add
in interfacejava.util.Deque<java.lang.String>
- Specified by:
add
in interfacejava.util.List<java.lang.String>
- Specified by:
add
in interfacejava.util.Queue<java.lang.String>
- Overrides:
add
in classjava.util.LinkedList<java.lang.String>
- See Also:
Collection.add(java.lang.Object)
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<java.lang.String>
- Specified by:
clear
in interfacejava.util.List<java.lang.String>
- Overrides:
clear
in classjava.util.LinkedList<java.lang.String>
- See Also:
Collection.clear()
-
get
public java.lang.String get(int index)
- Specified by:
get
in interfacejava.util.List<java.lang.String>
- Overrides:
get
in classjava.util.LinkedList<java.lang.String>
- See Also:
List.get(int)
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<java.lang.String>
- Specified by:
iterator
in interfacejava.util.Deque<java.lang.String>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.String>
- Specified by:
iterator
in interfacejava.util.List<java.lang.String>
- Overrides:
iterator
in classjava.util.AbstractSequentialList<java.lang.String>
- See Also:
Collection.iterator()
-
remove
public java.lang.String remove(int index)
- Specified by:
remove
in interfacejava.util.List<java.lang.String>
- Overrides:
remove
in classjava.util.LinkedList<java.lang.String>
- See Also:
List.remove(int)
-
onAdded
protected abstract void onAdded(java.lang.Object peer, int index, java.lang.Object element)
React on the performed operation
by informing argument peer.List.add(int, java.lang.Object)
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodindex
- the index the element was added atelement
- the element that was added
-
onAdded
protected abstract void onAdded(java.lang.Object peer, java.lang.Object o)
React on the performed operation
by informing argument peer.List.add(java.lang.Object)
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodo
- the element that was successfully added
-
onClear
protected abstract void onClear(java.lang.Object peer)
React on the operation to come
by informing argument peer.List.clear()
This is called before the actual clear operation takes place.
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method
-
onCleared
protected abstract void onCleared(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.clear()
This is called after the actual clear operation has taken place.
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method
-
onGetCall
protected abstract void onGetCall(java.lang.Object peer, int index)
React on the performed operation
by informing argument peer.List.get(int)
Note that the call reult is only obtained in this instance but not given to the requesting client when this handler is invoked.
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodindex
- the index of the Object to get
-
onIteratorCall
protected abstract void onIteratorCall(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.iterator()
Note that the iterator is only obtained but not given to the requesting client when this handler is invoked.
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method
-
onRemoved
protected abstract void onRemoved(java.lang.Object peer, int index)
React on the performed operation
by informing argument peer.List.remove(int)
This is only invoked if the list operation was successful.
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodindex
- the index where the value has been removed
-
-