Author: andrei_exadel
Date: 2009-02-27 13:42:30 -0500 (Fri, 27 Feb 2009)
New Revision: 12776
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchOptions.xhtml
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/template3.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld2.css
Log:
Search Service
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.richfaces.realworld.search;
+
+import java.util.List;
+
+import org.richfaces.realworld.service.ISearchAction;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public abstract class ISearchOption {
+
+ private boolean selected;
+
+ private List<?> searchResult;
+
+ public abstract String getName();
+
+ public abstract String getSearchResultName();
+
+ public abstract String getTemplate();
+
+ public abstract String getSearchResultTemplate();
+
+ public abstract void search(ISearchAction action);
+
+ public boolean getSelected() {
+ return selected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ public List<?> getSearchResult() {
+ return searchResult;
+ }
+
+ public void setSearchResult(List<?> searchResult) {
+ this.searchResult = searchResult;
+ }
+
+
+}
+
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,108 @@
+package org.richfaces.realworld.search;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.service.ISearchAction;
+import org.richfaces.realworld.service.SearchAction;
+import org.richfaces.realworld.util.ConversationState;
+
+@Name("searchImageHelper")
+(a)Scope(ScopeType.CONVERSATION)
+public class ImageSearchHelper implements Serializable {
+
+ private static final long serialVersionUID = -304368268896942902L;
+
+ @In
+ ConversationState conversationState;
+
+ @In(create=true, required=true)
+ ISearchAction searchAction;
+
+ ISearchOption selectedOption;
+
+ List<ISearchOption> options;
+
+ String selectedTab;
+
+ public ImageSearchHelper() {
+ options = new ArrayList<ISearchOption>();
+ options.add(new SearchOptionByAlbum());
+ options.add(new SearchOptionByImage());
+ }
+
+ public void search(ActionEvent event) {
+ conversationState.setMainArea(NavigationEnum.SEARCH);
+ selectedOption.search(searchAction);
+ setSelectedTab(selectedOption.getSearchResultName());
+ }
+
+ boolean isOptionSelected() {
+ return selectedOption != null;
+ }
+
+ public void processSelection(ActionEvent event) {
+ Iterator<ISearchOption> it = options.iterator();
+ while (it.hasNext()) {
+ ISearchOption option = it.next();
+ if (option.getSelected()) {
+ selectedOption = option;
+ break;
+ }
+ }
+ }
+
+ public void back(ActionEvent event) {
+ Iterator<ISearchOption> it = options.iterator();
+ while (it.hasNext()) {
+ it.next().setSelected(false);
+ }
+ selectedOption = null;
+ }
+
+ @Out
+ public String getTemplate() {
+ return (isOptionSelected()) ? selectedOption.getTemplate() :
"/includes/search/searchOptions.xhtml";
+ }
+
+
+ public ISearchOption getSelectedOption() {
+ return selectedOption;
+ }
+
+
+ public void setSelectedOption(ISearchOption selectedOption) {
+ this.selectedOption = selectedOption;
+ }
+
+ @Out
+ public List<ISearchOption> getOptions() {
+ return options;
+ }
+
+ public void setOptions(List<ISearchOption> options) {
+ this.options = options;
+ }
+
+ public String getSelectedTab() {
+ return selectedTab;
+ }
+
+ public void setSelectedTab(String selectedTab) {
+ this.selectedTab = selectedTab;
+ }
+
+
+
+
+}
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,77 @@
+package org.richfaces.realworld.search;
+
+import org.richfaces.realworld.service.ISearchAction;
+import org.richfaces.realworld.util.ConversationState;
+
+
+public class SearchOptionByAlbum extends ISearchOption {
+
+
+ String albumName;
+
+ String ownerName;
+
+ String description;
+
+ boolean shared;
+
+ @Override
+ public String getName() {
+ return "Search By Album";
+ }
+
+ @Override
+ public String getSearchResultName() {
+ return "Albums";
+ }
+
+ @Override
+ public void search(ISearchAction action) {
+ setSearchResult(action.searchByAlbum(albumName, description, ownerName, shared));
+ }
+
+ @Override
+ public String getTemplate() {
+ return "/includes/search/searchByAlbumTemplate.xhtml";
+ }
+
+ @Override
+ public String getSearchResultTemplate() {
+ return "/includes/search/result/albumsResult.xhtml";
+ }
+
+
+
+ public String getAlbumName() {
+ return albumName;
+ }
+
+ public void setAlbumName(String albumName) {
+ this.albumName = albumName;
+ }
+
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean getShared() {
+ return shared;
+ }
+
+ public void setShared(boolean shared) {
+ this.shared = shared;
+ }
+
+}
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,135 @@
+/**
+ *
+ */
+package org.richfaces.realworld.search;
+
+import java.util.Date;
+
+import org.richfaces.realworld.service.ISearchAction;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class SearchOptionByImage extends ISearchOption {
+
+ String fileName;
+
+ String description;
+
+ String path;
+
+ Integer fileSize;
+
+ Integer width;
+
+ Integer height;
+
+ Date uploadedDate;
+
+ Date createdDate;
+
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getName()
+ */
+ public String getName() {
+ return "Search By Image";
+ }
+
+ @Override
+ public String getSearchResultName() {
+ return "Images";
+ }
+
+ @Override
+ public void search(ISearchAction action) {
+ setSearchResult(action.searchByImage(fileName, description, path, width, height,
fileSize, createdDate, uploadedDate));
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getTemplate()
+ */
+ public String getTemplate() {
+ return "/includes/search/searchByImageTemplate.xhtml";
+ }
+
+ @Override
+ public String getSearchResultTemplate() {
+ return "/includes/search/result/imageResult.xhtml";
+ }
+
+
+ public String getFileName() {
+ return fileName;
+ }
+
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+
+ public Integer getFileSize() {
+ return fileSize;
+ }
+
+
+ public void setFileSize(Integer fileSize) {
+ this.fileSize = fileSize;
+ }
+
+
+ public Date getUploadedDate() {
+ return uploadedDate;
+ }
+
+
+ public void setUploadedDate(Date uploadedDate) {
+ this.uploadedDate = uploadedDate;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public Integer getWidth() {
+ return width;
+ }
+
+ public void setWidth(Integer width) {
+ this.width = width;
+ }
+
+ public Integer getHeight() {
+ return height;
+ }
+
+ public void setHeight(Integer height) {
+ this.height = height;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+
+}
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,28 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <rich:dataGrid id="album"
+ value="#{result}"
+ columns="5" style="width:500px;" var="album"
border="0">
+
+ <h:panelGrid id="grid" columns="1">
+ <h:panelGroup id="group">
+ <a4j:commandLink
+ action="#{conversationState.setMainArea(navigationHelper.navigationEnumImagePreview)}"
+ actionListener="#{conversationState.setSelectedAlbum(album)}"
+ reRender="mainArea, tree">
+ <h:graphicImage
+ style="width:100px;height:100px" id="image"
value="/img/folder.jpg" />
+ </a4j:commandLink>
+ </h:panelGroup>
+ <a4j:commandLink
+ action="#{conversationState.setMainArea(navigationHelper.navigationEnumImagePreview)}"
+ actionListener="#{conversationState.setSelectedAlbum(album)}"
+ reRender="mainArea, tree" value="#{album.name}">
+ </a4j:commandLink>
+ </h:panelGrid>
+ </rich:dataGrid>
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,36 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ hhh
+ <a4j:repeat id="previewList" value="#{result}"
var="item">
+ <table cellpadding="0" cellspacing="0" border="0"
width="170" height="170" style="float: left; margin: 0px 10px
10px 0px;" >
+ <tr>
+ <td style="text-align: center;vertical-align: middle; background:
white;border: 1px solid #909090">
+ <a4j:commandLink
+ actionListener="#{conversationState.updateSelectedItems(item)}"
+ reRender="mainArea">
+ <a4j:mediaOutput element="img"
createContent="#{imageLoader.paintImage}"
+ styleClass="all-images"
+ value="#{fileManager.transformPath(item.path, '_mini')}">
+ <rich:dragSupport rendered="#{renderLogic.isUserAlbum(item.album)}"
+ dragIndicator="dragIndicator" dragType="image"
dragValue="#{item}"
+ reRender=" mainArea">
+ <rich:dndParam name="label" value="#{item.name}" />
+ </rich:dragSupport>
+ <ui:include src="/includes/contextMenu/CMForImage.xhtml" >
+ <ui:param name="CMImage" value="#{item}" />
+ </ui:include>
+ <rich:toolTip followMouse="true" direction="top-right"
+ showDelay="500" styleClass="tooltip">
+ <span style="white-space: nowrap"> #{item.description}
</span>
+ </rich:toolTip>
+ </a4j:mediaOutput>
+ </a4j:commandLink>
+ </td>
+ </tr>
+ </table>
+ </a4j:repeat>
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,20 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.albumName}" />
+ <h:outputText value="Description"></h:outputText>
+ <h:inputText
value="#{searchImageHelper.selectedOption.description}"></h:inputText>
+ <h:outputText value="Owner Name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.ownerName}" />
+ <h:outputText value="Shared"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.shared}" />
+ </h:panelGrid>
+
+
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,27 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.fileName}" />
+ <h:outputText value="Description"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.description}"
/>
+ <h:outputText value="Path"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.path}" />
+ <h:outputText value="Size"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.fileSize}" />
+ <h:outputText value="Width"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.width}" />
+ <h:outputText value="Height"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.height}" />
+ <h:outputText value="Uploaded Date"></h:outputText>
+ <rich:calendar
value="#{searchImageHelper.selectedOption.uploadedDate}"></rich:calendar>
+ <h:outputText value="Created Date"></h:outputText>
+ <rich:calendar
value="#{searchImageHelper.selectedOption.createdDate}"></rich:calendar>
+
+ </h:panelGrid>
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchOptions.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchOptions.xhtml
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchOptions.xhtml 2009-02-27
18:42:30 UTC (rev 12776)
@@ -0,0 +1,15 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:rich="http://richfaces.org/rich">
+ <a4j:repeat value="#{searchImageHelper.options}"
var="option">
+ <h:outputText value="#{option.name}"></h:outputText>
+ <h:selectBooleanCheckbox value="#{option.selected}">
+ <a4j:support event="onchange"
actionListener="#{searchImageHelper.processSelection}"
reRender="searchArea"></a4j:support>
+ </h:selectBooleanCheckbox><br/>
+ </a4j:repeat>
+
+</ui:composition>
\ No newline at end of file
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/layout/template3.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js 2009-02-27
18:41:08 UTC (rev 12775)
+++ trunk/test-applications/realworld2/web/src/main/webapp/scripts/realworld.js 2009-02-27
18:42:30 UTC (rev 12776)
@@ -39,4 +39,12 @@
}
}
+}
+
+function SearchPanelShowHide(e, elt) {
+ if (Element.visible(elt)) {
+ hideSearch();
+ }else {
+ showSearch();
+ }
}
\ No newline at end of file
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld2.css
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld2.css 2009-02-27
18:41:08 UTC (rev 12775)
+++
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld2.css 2009-02-27
18:42:30 UTC (rev 12776)
@@ -58,7 +58,6 @@
border: none;
padding: 0px;
background: url(../img/shell/general_panelbar_bg.gif) repeat-x #A84807;
- overflow-y: hidden;
}
.main-menu-panel-body {