Author: amarkhel
Date: 2008-12-10 08:37:40 -0500 (Wed, 10 Dec 2008)
New Revision: 11690
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
Removed:
trunk/test-applications/realworld/web/src/main/webapp/layout/display.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/edit.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menuShared.xhtml
trunk/test-applications/realworld/web/src/main/webapp/sharedAlbum.xhtml
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
trunk/test-applications/realworld/web/src/main/webapp/META-INF/MANIFEST.MF
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/pages.xml
trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
Log:
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -24,7 +24,6 @@
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.Version;
-
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -1,6 +1,7 @@
package org.richfaces.realworld.service;
import java.util.List;
+import java.util.Map;
import javax.ejb.Local;
import javax.ejb.Remove;
@@ -10,11 +11,11 @@
@Local
public interface ISearchService {
- public abstract List<Image> searchImages(String searchPattern);
+ public abstract List<Image> searchImages(String searchPattern, String
additionalParams, Map<String, Object> paramMap);
- public List<Image> popularImages();
+ public List<Image> popularImages(String additionalParams, Map<String,
Object> paramMap);
- public List<Image> worstImages();
+ public List<Image> worstImages(String additionalParams, Map<String, Object>
paramMap);
@Remove
public void remove();
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -33,4 +33,5 @@
public void addFriend(User user, User friend, FriendshipRequest request);
public void removeFromSharedAlbums(User user, Album album);
public void addSharedAlbum(Album album);
+ public void loginAnonymous();
}
\ No newline at end of file
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -2,12 +2,14 @@
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Destroy;
@@ -31,20 +33,62 @@
* @see org.richfaces.realworld.service.ISearchService#searchImages(java.lang.String)
*/
@Begin(join=true)
- public List<Image> searchImages(String searchPattern){
- List<Image> images = em.createQuery("select i from MetaTag t join t.parent i
where t.tag like:metatag and i.album.shared=true order by i.rank.total/i.rank.hits
desc").setParameter("metatag",
searchPattern+"%").getResultList();
+ public List<Image> searchImages(String searchPattern, String additionalParams,
Map<String, Object> paramMap){
+ String fullQuery = "select i from MetaTag t join t.parent i where t.tag
like:metatag and i.album.shared=true" + additionalParams + " order by
i.rank.total/i.rank.hits desc";
+ Query prepared = em.createQuery(fullQuery).setParameter("metatag",
searchPattern+"%");
+ if(paramMap != null && paramMap.get(":spinnerValue") != null){
+ prepared.setParameter("spinnerValue",
paramMap.get(":spinnerValue"));
+ }
+ if(paramMap != null && paramMap.get(":choice") != null){
+ prepared.setParameter("choice", paramMap.get(":choice"));
+ }
+ if(paramMap != null && paramMap.get(":date") != null){
+ prepared.setParameter("date", paramMap.get(":date"));
+ }
+ List<Image> images = prepared.getResultList();
+ for(Image image:images){
+ image.getAlbum().getOwner().getLogin();
+ }
return images;
}
@Begin(join=true)
- public List<Image> popularImages(){
- List<Image> images = em.createQuery("select i from Image i join i.rank r
where i.album.shared=true order by r.total/r.hits
desc").setMaxResults(10).getResultList();
+ public List<Image> popularImages(String additionalParams, Map<String,
Object> paramMap){
+ String fullQuery = "select i from Image i join i.rank r where
i.album.shared=true" + additionalParams + " order by r.total/r.hits desc";
+ Query prepared = em.createQuery(fullQuery);
+ if(paramMap != null && paramMap.get(":spinnerValue") != null){
+ prepared.setParameter("spinnerValue",
paramMap.get(":spinnerValue"));
+ }
+ if(paramMap != null && paramMap.get(":choice") != null){
+ prepared.setParameter("choice", paramMap.get(":choice"));
+ }
+ if(paramMap != null && paramMap.get(":date") != null){
+ prepared.setParameter("date", paramMap.get(":date"));
+ }
+ List<Image> images = prepared.getResultList();
+ for(Image image:images){
+ image.getAlbum().getOwner().getLogin();
+ }
return images;
}
@Begin(join=true)
- public List<Image> worstImages(){
- List<Image> images = em.createQuery("select i from Image i join i.rank r
where i.album.shared=true order by r.total/r.hits
asc").setMaxResults(10).getResultList();
+ public List<Image> worstImages(String additionalParams, Map<String, Object>
paramMap){
+ String fullQuery = "select i from Image i join i.rank r where
i.album.shared=true" + additionalParams + " order by r.total/r.hits asc";
+ Query prepared = em.createQuery(fullQuery);
+ if(paramMap != null && paramMap.get(":spinnerValue") != null){
+ prepared.setParameter("spinnerValue",
paramMap.get(":spinnerValue"));
+ }
+ if(paramMap != null && paramMap.get(":choice") != null){
+ prepared.setParameter("choice", paramMap.get(":choice"));
+ }
+ if(paramMap != null && paramMap.get(":date") != null){
+ prepared.setParameter("date", paramMap.get(":date"));
+ }
+ List<Image> images = prepared.getResultList();
+ for(Image image:images){
+ image.getAlbum().getOwner().getLogin();
+ }
return images;
}
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -54,7 +54,6 @@
public void register(User user) {
em.persist(user);
- this.user = user;
}
public void updateUser(User user) {
@@ -115,4 +114,8 @@
user.addSharedAlbum(album);
}
+
+ public void loginAnonymous() {
+ user = new User();
+ }
}
\ No newline at end of file
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -10,7 +10,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.faces.model.SelectItem;
@@ -40,9 +42,6 @@
@In(create=true)
private ISearchService searchService;
- @In(create=true)
- private FileManager fileManager;
-
private String searchPattern;
private Long spinnerChoice;
@@ -59,69 +58,85 @@
public List<SelectItem> getItems() {
List<SelectItem> list = new ArrayList<SelectItem>(4);
+ list.add(new SelectItem(Long.valueOf(0L), "No Matter"));
list.add(new SelectItem(Long.valueOf(1L), "More"));
list.add(new SelectItem(Long.valueOf(2L), "Less"));
list.add(new SelectItem(Long.valueOf(3L), "Equals"));
return list;
}
- public synchronized void paint(OutputStream stream, Object object) throws IOException {
- Image painted = (Image)object;
-
- File image = fileManager.getImage(painted.getAlbum().getOwner().getLogin() +
fileManager.getFileSeparator() + painted.getAlbum().getName()+
fileManager.getFileSeparator() + painted.getPath());
- InputStream paintData = null;
- byte[] data = new byte[(int)image.length() - 1];
- FileInputStream fileInputStream = null;
- BufferedInputStream bufferedInputStream = null;
- if (image != null) {
- try {
- fileInputStream = new FileInputStream(image);
- bufferedInputStream = new BufferedInputStream(fileInputStream);
- paintData = bufferedInputStream;
- paintData.read(data);
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }finally{
- try {
- fileInputStream.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- bufferedInputStream.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- paintData.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- stream.write(data);
+ private String getAstFromIndex(Long item){
+ if(item == 1L){
+ return "> ";
+ }else if(item == 2L){
+ return "< ";
+ }else if(item == 3L){
+ return "= ";
+ }
+ return null;
}
public List<Image> searchImages(){
- findedImages = searchService.searchImages(this.searchPattern);
+ String additionalParams = populateAdditionalParams();
+ Map<String, Object> paramMap = null;
+ if(!additionalParams.equals("")){
+ paramMap = populateMap(additionalParams);
+ }
+ findedImages = searchService.searchImages(this.searchPattern, additionalParams,
paramMap);
return findedImages;
}
public List<Image> popularImages(){
- findedImages = searchService.popularImages();
+ String additionalParams = populateAdditionalParams();
+ Map<String, Object> paramMap = null;
+ if(!additionalParams.equals("")){
+ paramMap = populateMap(additionalParams);
+ }
+ findedImages = searchService.popularImages(additionalParams, paramMap);
return findedImages;
}
+ private Map<String, Object> populateMap(String additionalParams) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ if(additionalParams.lastIndexOf(":spinnerValue") != -1){
+ map.put(":spinnerValue",
Long.valueOf(helper.getInputSpinner().getValue().toString()));
+ }
+ if(additionalParams.lastIndexOf(":choice") != -1){
+ map.put(":choice", numberOfVotes);
+ }
+ if(additionalParams.lastIndexOf(":date") != -1){
+ map.put(":date", date);
+ }
+ return map;
+ }
+
+ private String populateAdditionalParams() {
+ StringBuilder additionalParams = new StringBuilder("");
+ if(spinnerChoice != null && spinnerChoice > 0L){
+ additionalParams.append(" and i.rank.total/i.rank.hits");
+ additionalParams.append(getAstFromIndex(spinnerChoice));
+ additionalParams.append(":spinnerValue");
+ }
+ if(votesChoice != null && votesChoice > 0L){
+ additionalParams.append(" and i.rank.hits");
+ additionalParams.append(getAstFromIndex(votesChoice));
+ additionalParams.append(":choice");
+ }
+ if(dateChoice != null && dateChoice > 0L){
+ additionalParams.append(" and i.created");
+ additionalParams.append(getAstFromIndex(dateChoice));
+ additionalParams.append(":date");
+ }
+ return additionalParams.toString();
+ }
+
public List<Image> worstImages(){
- findedImages = searchService.worstImages();
+ String additionalParams = populateAdditionalParams();
+ Map<String, Object> paramMap = null;
+ if(!additionalParams.equals("")){
+ paramMap = populateMap(additionalParams);
+ }
+ findedImages = searchService.worstImages(additionalParams, paramMap);
return findedImages;
}
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -8,11 +8,13 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
@@ -23,6 +25,8 @@
import org.richfaces.realworld.fileupload.AvatarUpload;
import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.service.IUserAction;
+import org.richfaces.realworld.tree.TreeSelectionManager;
+import org.richfaces.realworld.util.NavigationEnum;
@Name("authenticator")
@Scope(ScopeType.CONVERSATION)
@@ -32,13 +36,13 @@
@In Identity identity;
- @Out
+ @Out(required=false)
private Image selectedImage;
@Out(required=false)
private User selectedUser;
- @Out
+ @Out(required=false)
private Album selectedAlbum;
@In FacesMessages facesMessages;
@@ -58,7 +62,12 @@
@Begin
public boolean authenticate()
{
- log.info("authenticating #0", identity.getUsername());
+ if(null == identity.getUsername() || identity.getUsername().equals("")){
+ identity.addRole("guest");
+ Events.instance().raiseEvent("updateMainArea",
NavigationEnum.SEARCH);
+ userAction.loginAnonymous();
+ return true;
+ }
try{
User user = userAction.login(identity.getUsername(), identity.getPassword());
if(user != null){
@@ -71,8 +80,9 @@
if(selectedAlbum.getImages().size() > 0){
selectedImage = selectedAlbum.getImages().get(0);
}
- selectedUser = user;
}
+ selectedUser = user;
+ Events.instance().raiseEvent("updateMainArea",
NavigationEnum.IMAGE_PREVIEW);
return true;
}
}catch(Exception nre){
@@ -82,6 +92,7 @@
return false;
}
+ @Begin @End
public String register(User user){
boolean errorHappened = false;
if(!user.getPassword().equals(user.getConfirmPassword())){
@@ -113,15 +124,15 @@
e.printStackTrace();
}
}
- return "main";
+ return "index";
}
/**
* Logout from session.
*
* @return outcome which redirects to login page.
- */
+ *//*
public void logout() {
Session.instance().invalidate();
- }
+ }*/
}
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -0,0 +1,56 @@
+package org.richfaces.realworld.slideshow;
+
+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.tree.TreeSelectionManager;
+import org.richfaces.realworld.util.SlideshowHelper;
+
+@Name("slideshow")
+(a)Scope(ScopeType.CONVERSATION)
+public class SlideshowBean {
+
+ @In(required=false) @Out(required=false)
+ SlideshowHelper slideshowHelper;
+
+ @In
+ TreeSelectionManager treeSelectionManager;
+
+ private boolean active;
+
+ private int interval = 10000;
+
+ public int getInterval() {
+ return interval;
+ }
+
+ public void setInterval(int interval) {
+ this.interval = interval;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public void startSlideshow(){
+ active = true;
+ }
+
+ public void stopSlideshow(){
+ active = false;
+ }
+
+ public void updateInterval(){
+ this.setInterval((int)(1000 *
Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
+ }
+
+ public void incrementSlide(){
+ treeSelectionManager.incrementSlideshowIndex();
+ }
+}
Property changes on:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -24,6 +24,7 @@
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Synchronized;
@@ -49,18 +50,18 @@
@Synchronized(timeout=2000)
public class TreeSelectionManager implements Serializable{
- @In
+ @In(required=false)
private User user;
- private NavigationEnum mainArea = NavigationEnum.IMAGE_PREVIEW;
+ private NavigationEnum mainArea;
- @In(required=false) @Out
+ @In(required=false) @Out(required=false)
private Image selectedImage;
- @In(required=false) @Out
+ @In(required=false) @Out(required=false)
private Album selectedAlbum;
- @In(create=true) @Out
+ @In(create=true) @Out(required=false)
private SelectedImageIndex selectedImageIndex;
@In(create=true)
@@ -81,6 +82,11 @@
this.setMainArea(NavigationEnum.FILE_UPLOAD);
}
+ @Observer("updateMainArea")
+ public void updateMainArea(NavigationEnum mainArea) {
+ this.setMainArea(mainArea);
+ }
+
public void scrollerListener(DataScrollerEvent event) {
List<Image> images = selectedAlbum.getImages();
if (event.getNewScrolVal().equals("previous")) {
@@ -262,6 +268,18 @@
scroller.setPage(index+1);
selectedImageIndex.setSelectedImageIndex(index+1);
}
+
+ public void incrementSlideshowIndex() {
+ int index = selectedAlbum.getIndex(selectedImage);
+ if(selectedAlbum.getImages().size() == index +1){
+ index = -1;
+ }
+ selectedImage = selectedAlbum.getImages().get(index +1);
+ UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
+ UIDatascroller scroller =
(UIDatascroller)component.findComponent("mainform:sc1");
+ scroller.setPage(index+2);
+ selectedImageIndex.setSelectedImageIndex(index+2);
+ }
public String getNodeTitle() {
return nodeTitle;
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -20,13 +20,13 @@
@Out(required=false)
private User selectedUser;
- @In(required=false) @Out
+ @In(required=false) @Out(required=false)
private Image selectedImage;
- @In(required=false) @Out
+ @In(required=false) @Out(required=false)
private Album selectedAlbum;
- @In(create=true) @Out
+ @In(create=true) @Out(required=false)
private SelectedImageIndex selectedImageIndex;
private String albumName;
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2008-12-10
13:06:12 UTC (rev 11689)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -4,6 +4,7 @@
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -26,9 +27,54 @@
@In(create=true)
FileManager fileManager;
- @In
+ @In(required=false)
private User user;
+ public synchronized void paintSearchImage(OutputStream stream, Object object) throws
IOException {
+ Image painted = (Image)object;
+
+ File image = fileManager.getImage(painted.getAlbum().getOwner().getLogin() +
fileManager.getFileSeparator() + painted.getAlbum().getName()+
fileManager.getFileSeparator() + painted.getPath());
+ InputStream paintData = null;
+ byte[] data = new byte[(int)image.length() - 1];
+ FileInputStream fileInputStream = null;
+ BufferedInputStream bufferedInputStream = null;
+ if (image != null) {
+ try {
+ fileInputStream = new FileInputStream(image);
+ bufferedInputStream = new BufferedInputStream(fileInputStream);
+ paintData = bufferedInputStream;
+ paintData.read(data);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ try {
+ fileInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ bufferedInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ paintData.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ stream.write(data);
+ }
+
public synchronized void paint(OutputStream out, Object data) throws IOException{
if (null == data) {
return;
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java 2008-12-10
13:37:40 UTC (rev 11690)
@@ -0,0 +1,25 @@
+package org.richfaces.realworld.util;
+
+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.component.UIInputNumberSlider;
+
+@Name("slideshowHelper")
+(a)Scope(ScopeType.EVENT)
+public class SlideshowHelper {
+
+ private UIInputNumberSlider inputSlider;
+
+ public UIInputNumberSlider getInputSlider() {
+ return inputSlider;
+ }
+
+ public void setInputSlider(UIInputNumberSlider inputSlider) {
+ this.inputSlider = inputSlider;
+ }
+
+
+}
Property changes on:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/META-INF/MANIFEST.MF 2008-12-10
13:06:12 UTC (rev 11689)
+++ trunk/test-applications/realworld/web/src/main/webapp/META-INF/MANIFEST.MF 2008-12-10
13:37:40 UTC (rev 11690)
@@ -1,3 +1,15 @@
Manifest-Version: 1.0
-Class-Path:
+Class-Path: avalon-framework-4.1.3.jar
+ commons-beanutils-1.7.0.jar
+ commons-digester-1.8.jar
+ commons-logging-1.1.jar
+ jboss-seam-debug-2.1.0.SP1.jar
+ jboss-seam-jul-2.1.0.SP1.jar
+ jboss-seam-remoting-2.1.0.SP1.jar
+ jboss-seam-ui-2.1.0.SP1.jar
+ jsf-facelets-1.1.14.jar
+ log4j-1.2.14.jar
+ logkit-1.0.1.jar
+ richfaces-impl-3.3.0-SNAPSHOT.jar
+ richfaces-ui-3.3.0-SNAPSHOT.jar
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/pages.xml 2008-12-10
13:06:12 UTC (rev 11689)
+++ trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/pages.xml 2008-12-10
13:37:40 UTC (rev 11690)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages
xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.0.xsd"
+
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.1.xsd"
- no-conversation-view-id="/home.xhtml"
- login-view-id="/home.xhtml">
+ no-conversation-view-id="/index.xhtml"
+ login-view-id="/index.xhtml">
<page view-id="*">
<navigation>
<rule if-outcome="home">
- <redirect view-id="/home.xhtml"/>
+ <redirect view-id="/index.xhtml"/>
</rule>
<rule if-outcome="register">
<redirect view-id="/register.xhtml"/>
Modified: trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld/web/src/main/webapp/layout/display.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld/web/src/main/webapp/layout/edit.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld/web/src/main/webapp/layout/menuShared.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld/web/src/main/webapp/sharedAlbum.xhtml
===================================================================
(Binary files differ)