Class CmsHookListSearchCategory
- 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
-
- org.opencms.workplace.tools.searchindex.CmsHookListSearchCategory
-
- 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>
public class CmsHookListSearchCategory extends CmsHookList
A hook on the list of categories of theCmsSearchParameters
(see
) that will set the page to display of the search parameters to start (1) whenever a change in the amount of categories takes place.CmsSearchParameters.setCategories(List)
This hook monitors the actions of the
: During a request - response cycle it clears the list (prepareCommit) of categories and adds all request parameters (actionCommitValue) to the list.CmsWidgetDialog
The strategy here is to save all categories in a backup at "onClear" - time and then wait until all add operations are finished. This is when the iterator() method is triggered by the running search (
). At that time it is detected wether we have "lost" categories. If this is the case, the search page will be reset to start.CmsSearch.getSearchResult()
Warning
This procedure is highly unstable as coupled to the behaviour of CmsWidgetDialog. It will only be successful if the request parameter "action" has a value in-
CmsWidgetDialog.DIALOG_SAVE
-
CmsDialog.DIALOG_BACK
-
CmsDialog.DIALOG_CONTINUE
) contain a parameter "action" with value "search" which has to be rewritten to one of those values or the order of operations on widget - managed collections does not work together with the detection strategy for category changes used here.CmsSearch.getPageLinks()
- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer)
CmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer, java.util.Collection<java.lang.String> c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
onAdded(java.lang.Object peer, int index, java.lang.Object element)
A category has been added: do nothing.protected void
onAdded(java.lang.Object peer, java.lang.Object added)
React on the performed operation
by informing argument peer.List.add(java.lang.Object)
protected void
onClear(java.lang.Object peer)
Takes a copy of the current categories contained to a backup list as this operation is triggered by
.CmsWidgetDialog.ACTION_SAVE
protected void
onCleared(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.clear()
protected void
onGetCall(java.lang.Object peer, int index)
Set the search page of the peer Object (
) to zero if the internal backup list of categories (taken at clear time which is triggered byCmsSearch.setSearchPage(int)
) was empty (no restriction) and now categories are contained or if the new backup list of categories is no subset of the current categories any more (more restrictive search than before).CmsWidgetDialog.ACTION_SAVE
protected void
onIteratorCall(java.lang.Object peer)
React on the performed operation
by informing argument peer.List.iterator()
protected void
onRemoved(java.lang.Object peer, int index)
A category has been removed: set search page to start page as new results may / will be smaller.-
Methods inherited from class org.opencms.workplace.tools.searchindex.CmsHookList
add, add, clear, get, iterator, remove
-
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
-
CmsHookListSearchCategory
public CmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer)
- Parameters:
peer
- the search parameters to modify upon category modifications.
-
CmsHookListSearchCategory
public CmsHookListSearchCategory(org.opencms.search.CmsSearchParameters peer, java.util.Collection<java.lang.String> c)
- Parameters:
peer
- the search parameters to modify upon category modificationsc
- a collection with all values for this list
-
-
Method Detail
-
onAdded
protected void onAdded(java.lang.Object peer, int index, java.lang.Object element)
A category has been added: do nothing.- Specified by:
onAdded
in classCmsHookList
- 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- See Also:
CmsHookList.onAdded(java.lang.Object, int, java.lang.Object)
-
onAdded
protected void onAdded(java.lang.Object peer, java.lang.Object added)
Description copied from class:CmsHookList
React on the performed operation
by informing argument peer.List.add(java.lang.Object)
- Specified by:
onAdded
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodadded
- the element that was successfully added- See Also:
CmsHookList.onAdded(java.lang.Object, java.lang.Object)
-
onClear
protected void onClear(java.lang.Object peer)
Takes a copy of the current categories contained to a backup list as this operation is triggered by
.CmsWidgetDialog.ACTION_SAVE
- Specified by:
onClear
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method- See Also:
CmsHookList.onClear(java.lang.Object)
-
onCleared
protected void onCleared(java.lang.Object peer)
Description copied from class:CmsHookList
React on the performed operation
by informing argument peer.List.clear()
This is called after the actual clear operation has taken place.
- Specified by:
onCleared
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method- See Also:
CmsHookList.onCleared(java.lang.Object)
-
onGetCall
protected void onGetCall(java.lang.Object peer, int index)
Set the search page of the peer Object (
) to zero if the internal backup list of categories (taken at clear time which is triggered byCmsSearch.setSearchPage(int)
) was empty (no restriction) and now categories are contained or if the new backup list of categories is no subset of the current categories any more (more restrictive search than before).CmsWidgetDialog.ACTION_SAVE
- Specified by:
onGetCall
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodindex
- the index of the Object to get- See Also:
CmsHookList.onGetCall(java.lang.Object, int)
-
onIteratorCall
protected void onIteratorCall(java.lang.Object peer)
Description copied from class:CmsHookList
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.
- Specified by:
onIteratorCall
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" method- See Also:
CmsHookList.onIteratorCall(java.lang.Object)
-
onRemoved
protected void onRemoved(java.lang.Object peer, int index)
A category has been removed: set search page to start page as new results may / will be smaller.- Specified by:
onRemoved
in classCmsHookList
- Parameters:
peer
- the object reactions on operations shall be made on in this "listlet" methodindex
- the index where the value has been removed- See Also:
CmsHookList.onRemoved(java.lang.Object, int)
-
-