Author: andrei_exadel
Date: 2009-02-23 14:31:40 -0500 (Mon, 23 Feb 2009)
New Revision: 12716
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
trunk/test-applications/realworld/web/src/main/webapp/includes/search/
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchOptions.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
Modified:
trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
Log:
Search menu
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,31 @@
+/**
+ *
+ */
+package org.richfaces.realworld.search;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public abstract class ISearchOption {
+
+ private boolean selected;
+
+ public abstract String getName();
+
+ public abstract String getTemplate();
+
+ public boolean getSelected() {
+ return selected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
+
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,82 @@
+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.hibernate.validator.NotNull;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+
+@Name("searchImageHelper")
+(a)Scope(ScopeType.CONVERSATION)
+public class ImageSearchHelper implements Serializable {
+
+ private static final long serialVersionUID = -304368268896942902L;
+
+ ISearchOption selectedOption;
+
+ List<ISearchOption> options;
+
+ public ImageSearchHelper() {
+ options = new ArrayList<ISearchOption>();
+ options.add(new SearchOptionByAlbum());
+ options.add(new SearchOptionByImage());
+ }
+
+ 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;
+ }
+
+
+
+
+}
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,37 @@
+package org.richfaces.realworld.search;
+
+public class SearchOptionByAlbum extends ISearchOption {
+
+ String albumName;
+
+ String ownerName;
+
+ @Override
+ public String getName() {
+ return "Search By Album";
+ }
+
+ @Override
+ public String getTemplate() {
+ return "/includes/search/searchByAlbumTemplate.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;
+ }
+
+
+
+}
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.richfaces.realworld.search;
+
+import java.util.Date;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class SearchOptionByImage extends ISearchOption {
+
+ String fileName;
+
+ Integer fileSize;
+
+ Date uploadedDate;
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getName()
+ */
+ public String getName() {
+ return "Search By Image";
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getTemplate()
+ */
+ public String getTemplate() {
+ return "/includes/search/searchByImageTemplate.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;
+ }
+
+
+}
Added:
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByAlbumTemplate.xhtml 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,14 @@
+<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:outputText value="Album name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.albumName}"
/><br/>
+ <h:outputText value="Owner Name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.ownerName}"
/><br/>
+
+
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchByImageTemplate.xhtml 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,14 @@
+<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:outputText value="Image name"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.fileName}"
/><br/>
+ <h:outputText value="Image size"></h:outputText>
+ <h:inputText value="#{searchImageHelper.selectedOption.fileSize}"
/><br/>
+ <h:outputText value="Uploaded Date"></h:outputText>
+ <rich:calendar
value="#{searchImageHelper.selectedOption.uploadedDate}"></rich:calendar>
+</ui:composition>
\ No newline at end of file
Added:
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchOptions.xhtml
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchOptions.xhtml
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/webapp/includes/search/searchOptions.xhtml 2009-02-23
19:31:40 UTC (rev 12716)
@@ -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="searchOptions"></a4j:support>
+ </h:selectBooleanCheckbox><br/>
+ </a4j:repeat>
+
+</ui:composition>
\ No newline at end of file
Modified: trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
(rev 0)
+++ trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml 2009-02-23
19:31:40 UTC (rev 12716)
@@ -0,0 +1,29 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:s="http://jboss.com/products/seam/taglib"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:richx="http://richfaces.org/richx">
+ <div style="position: relative">
+ <rich:effect name="hideSearch" type="Fade"
for="searchPanel" params="duration: 0.5"></rich:effect>
+ <rich:effect name="showSearch" type="Appear"
for="searchPanel" params="duration: 0.5"></rich:effect>
+ <rich:toolBar onmouseover="showSearch();" style="height: 100%; width:
50px; border: 0px; border-top: 5px solid #FF7D2A; margin-left: 265px; vertical-align:
bottom">
+ <rich:toolBarGroup>
+ <h:outputText value="Search" style="color: white"
></h:outputText>
+ </rich:toolBarGroup>
+ </rich:toolBar>
+ <rich:panel id="searchPanel" onmouseout="onSearchPanelMouseOut(event,
this)" style="width: 150px; display: none; position: absolute; z-index: 5; left:
265px; top: 37px;">
+ <h:form>
+ <h:outputText value="Search:"
style=""></h:outputText>
+ <hr/>
+ <a4j:include id="searchOptions"
viewId="#{searchImageHelper.template}"></a4j:include>
+ <a4j:commandButton value="Search"></a4j:commandButton>
+ <a4j:commandButton reRender="searchOptions" value="Back"
actionListener="#{searchImageHelper.back}" ></a4j:commandButton>
+ </h:form>
+ </rich:panel>
+ </div>
+
+</ui:composition>
\ No newline at end of file
Modified: trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js 2009-02-23
17:48:07 UTC (rev 12715)
+++ trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js 2009-02-23
19:31:40 UTC (rev 12716)
@@ -39,4 +39,11 @@
}
}
+}
+
+function onSearchPanelMouseOut(e, elt) {
+ var relTarg = e.relatedTarget || e.toElement;
+ if (relTarg == elt) {
+ hideSearch();
+ }
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2009-02-23
17:48:07 UTC (rev 12715)
+++
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2009-02-23
19:31:40 UTC (rev 12716)
@@ -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 {