Author: amarkhel
Date: 2009-07-24 12:47:24 -0400 (Fri, 24 Jul 2009)
New Revision: 15005
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java
Log:
Fix RF-7417
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java 2009-07-24
16:46:19 UTC (rev 15004)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java 2009-07-24
16:47:24 UTC (rev 15005)
@@ -65,6 +65,7 @@
boolean seachInMyAlbums;
boolean searchInShared = true;
+ private SearchInformationHolder searchOptionsHolder;
/**
* Default constructor. During instantiation populate in field options all possible
search options
@@ -99,6 +100,7 @@
* Method, that perform search, when user clicks by 'Find' button.
*/
public void search() {
+ searchOptionsHolder = null;
if(!isSearchOptionSelected()){
//If no options selected
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.SEARCH_NO_OPTIONS_ERROR);
@@ -127,6 +129,7 @@
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, option.getName() +
":" + e.getMessage());
}
}
+ searchOptionsHolder = new SearchInformationHolder(new
ArrayList<ISearchOption>(options),seachInMyAlbums, searchInShared);
}
/**
@@ -138,13 +141,13 @@
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.SEARCH_NO_OPTIONS_ERROR);
return;
}
- Iterator<ISearchOption> it = options.iterator();
+ Iterator<ISearchOption> it = searchOptionsHolder.getOptions().iterator();
selectedKeyword = keyword.trim();
while (it.hasNext()) {
ISearchOption option = it.next();
try{
if (option.getSelected()) {
- option.search(searchAction, selectedKeyword , seachInMyAlbums, searchInShared);
+ option.search(searchAction, selectedKeyword ,
searchOptionsHolder.isSeachInMyAlbums(), searchOptionsHolder.isSearchInShared());
}
}catch(PhotoAlbumException e){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, option.getName() +
":" + e.getMessage());
@@ -253,4 +256,28 @@
}
return isOptionSelected;
}
+}
+class SearchInformationHolder{
+ SearchInformationHolder(List<ISearchOption> options, boolean seachInMyAlbums,
boolean searchInShared){
+ this.options = options;
+ this.seachInMyAlbums = seachInMyAlbums;
+ this.searchInShared = searchInShared;
+ }
+ List<ISearchOption> options;
+
+ boolean seachInMyAlbums;
+
+ boolean searchInShared;
+
+ public List<ISearchOption> getOptions() {
+ return options;
+ }
+
+ public boolean isSeachInMyAlbums() {
+ return seachInMyAlbums;
+ }
+
+ public boolean isSearchInShared() {
+ return searchInShared;
+ }
}
\ No newline at end of file
Show replies by date