Author: amarkhel
Date: 2009-02-10 09:47:17 -0500 (Tue, 10 Feb 2009)
New Revision: 12611
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
Removed:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic2.java
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
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/ConversationState.java
Log:
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -26,12 +26,15 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import javax.persistence.EntityManager;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.context.AjaxContext;
import org.jboss.seam.Component;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@@ -44,8 +47,8 @@
public static final long serialVersionUID = 596009789004L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
- String fileName = WebUtil.getFileName(request.getPathInfo());
- if(!isAccessGranted(request, response, request.getPathInfo())){
+ String fileName = URLDecoder.decode(WebUtil.getFileName(request.getPathInfo()),
"UTF8");
+ if(!isAccessGranted(request, response, fileName)){
sendToErrorPage(request, response);
return;
}
@@ -113,7 +116,7 @@
if(userId != null && !userId.equals("")){
user = em.find(User.class, Long.valueOf(userId));
}
- Image i = (Image)em.createQuery("from Image i where
i.path=:path").setParameter(Constants.PATH_PARAMETER,
pathInfo.substring(1)).getSingleResult();
+ Image i = (Image)em.createQuery("from Image i where
i.path=:path").setParameter(Constants.PATH_PARAMETER, pathInfo).getSingleResult();
if(!i.getAlbum().isShared()){
if(user != null){
if(i.getAlbum().getOwner().equals(user) ||
user.getFriends().contains(i.getAlbum().getOwner())){
Modified:
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 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -23,33 +23,20 @@
import java.io.Serializable;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.service.Constants;
@Name("slideshow")
@Scope(ScopeType.CONVERSATION)
public class SlideshowBean implements Serializable{
private static final long serialVersionUID = 7801877176558409702L;
-
- @In(required=false) @Out(required=false)
- SlideshowHelper slideshowHelper;
private boolean active;
-
- private int interval = Constants.INITIAL_DELAY;
- public int getInterval() {
- return interval;
- }
-
- public void setInterval(int interval) {
- this.interval = interval;
- }
-
public boolean isActive() {
return active;
}
@@ -62,11 +49,8 @@
active = true;
}
+ @Observer("stopSlideshow")
public void stopSlideshow(){
active = false;
}
-
- public void updateInterval(){
- this.setInterval((int)(Constants.DELAY *
Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
- }
}
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -1,43 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.slideshow;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-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;
- }
-
-
-}
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -27,36 +27,32 @@
import javax.faces.context.FacesContext;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Synchronized;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.Events;
import org.richfaces.component.UIDatascroller;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
@Name("conversationState")
-(a)Scope(ScopeType.PAGE)
+(a)Scope(ScopeType.CONVERSATION)
public class ConversationState implements Serializable{
private static final long serialVersionUID = 5656562187249324512L;
+ @In Conversation conversation;
private Integer selectedImageIndex = 1;
private Image selectedImage;
private Album selectedAlbum;
-
- private NavigationEnum mainArea;
public Integer getSelectedImageIndex() {
return selectedImageIndex;
}
-
- public NavigationEnum getMainArea() {
- return mainArea;
- }
public void setSelectedImageIndex(Integer selectedImageIndex) {
this.selectedImageIndex = selectedImageIndex;
@@ -77,13 +73,6 @@
public void setSelectedAlbum(Album selectedAlbum) {
this.selectedAlbum = selectedAlbum;
}
-
- public String getSelectedAlbumName() {
- if(null == selectedAlbum){
- return "";
- }
- return selectedAlbum.getAlbumPathFromParents(selectedAlbum, Constants.SLASH, true);
- }
public void showImage(Image image){
setSelectedAlbum(image.getAlbum());
@@ -119,4 +108,23 @@
attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+1);
setSelectedImageIndex(index+1);
}
+
+ public void incrementSlideShowIndex(){
+ Integer index = getSelectedAlbum().getIndex(getSelectedImage());
+ System.out.println("Slideshow execute");
+ if(index == -1){
+ Events.instance().raiseEvent("stopSlideshow");
+ System.out.println("Slideshow stop");
+ return;
+ }
+ UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
+ UIDatascroller scroller =
(UIDatascroller)component.findComponent(Constants.DATASCROLLER_ID);
+ Map<String, Object> attributes = scroller.getDataTable().getAttributes();
+ attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+1);
+ if(index == getSelectedAlbum().getImages().size() - 1){
+ index=-1;
+ }
+ setSelectedImageIndex(index+1);
+ setSelectedImage(getSelectedAlbum().getImages().get(index + 1));
+ }
}
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -1,148 +0,0 @@
-/**
- *
- */
-package org.richfaces.realworld.util;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-
-import javax.imageio.ImageIO;
-import javax.imageio.stream.FileImageInputStream;
-import javax.imageio.stream.ImageInputStream;
-
-import org.richfaces.model.UploadItem;
-import org.richfaces.realworld.service.Constants;
-
-/**
- * @author Andrey Markavtsov
- *
- */
-public class ImageUtils {
-
- public static class ImageDimension {
- public int WIDTH;
- public int HEIGHT;
- public String POSTFIX_NAME;
- public ImageDimension(int width, int height, String postfix_name) {
- super();
- WIDTH = width;
- HEIGHT = height;
- POSTFIX_NAME = postfix_name;
- }
- };
-
- public static final String _MEDIUM = "_medium";
- public static final String _MINI = "_mini";
-
-
- public static ImageDimension MINI = new ImageDimension(100, 100, _MINI);
- public static ImageDimension MEDIUM = new ImageDimension(640, 480, _MEDIUM);
-
-
- BufferedImage bufferedImage;
-
- double width;
- double height;
-
- public ImageUtils(BufferedImage bufferedImage) {
- if (bufferedImage == null) {
- throw new NullPointerException("Buffered image is null");
- }
-
- this.height = bufferedImage.getHeight();
- this.width = bufferedImage.getWidth();
- this.bufferedImage = bufferedImage;
- }
-
- private BufferedImage scaleToWidth(int width) throws IOException {
- double height = width * this.height / this.width;
- BufferedImage newImage = new BufferedImage(width, (int) height,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = createGraphics(newImage);
- graphics2D.drawImage(bufferedImage, 0, 0, (int) width, (int) height,
- null);
- return newImage;
- }
-
- private BufferedImage scaleToHeight(int height) throws IOException {
- double width = height * this.width / this.height;
- BufferedImage newImage = new BufferedImage((int) width, (int) height,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = createGraphics(newImage);
- graphics2D.drawImage(bufferedImage, 0, 0, (int) width, (int) height,
- null);
- return newImage;
- }
-
- private Graphics2D createGraphics(BufferedImage image) {
- Graphics2D graphics2D = image.createGraphics();
- graphics2D.setBackground(new Color(255, 255, 255));
- graphics2D.clearRect(0, 0, image.getWidth(), image.getHeight());
- graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- return graphics2D;
- }
-
- public BufferedImage resizeImage(double width, double height)
- throws IOException {
-
- if (width > height) {
- if (this.bufferedImage.getWidth() < width) {
- return bufferedImage;
- }
- return scaleToWidth((int) width);
- } else {
- if (this.bufferedImage.getHeight() < height) {
- return bufferedImage;
- }
- return scaleToHeight((int) height);
- }
-
- }
-
- public static void resizeImage(UploadItem image, String pathToUpload, ImageDimension ...
dimensions)
- throws IOException {
-
- BufferedImage bufferedImage = ImageIO.read(new FileImageInputStream(image.getFile()));
-
- ImageUtils utils = new ImageUtils(bufferedImage);
- int width, height;
-
- ImageIO.write(bufferedImage, Constants.JPG, new File(pathToUpload));
-
- for (ImageDimension dimension : dimensions) {
- String fileName = transformPath(pathToUpload,dimension.POSTFIX_NAME);
- width = dimension.WIDTH;
- height = dimension.HEIGHT;
- BufferedImage resizedBuffer = bufferedImage;
-
- if (width > height) {
- if (bufferedImage.getWidth() > width) {
- resizedBuffer = utils.scaleToWidth((int) width);
- }
- } else {
- if (bufferedImage.getHeight() > height) {
- resizedBuffer = utils.scaleToHeight((int) height);
- }
- }
-
- if (resizedBuffer != null) {
- ImageIO.write(resizedBuffer, Constants.JPG, new File(fileName));
- }
-
- }
-
- }
-
- public static String transformPath(String target, String substitute){
- String begin = target.substring(0, target.lastIndexOf(Constants.DOT));
- String end = target.substring(target.lastIndexOf(Constants.DOT));
- return begin + substitute + end;
- }
-
-}
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -1,137 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.util;
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.security.Identity;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.navigation.NavigationEnum;
-import org.richfaces.realworld.service.Constants;
-
-@Name("renderLogic")
-(a)Scope(ScopeType.CONVERSATION)
-public class RenderLogic implements Serializable{
-
- @In User user;
- @In Identity identity;
- @In ConversationState conversationState;
-
- private static final long serialVersionUID = 5656562187249324512L;
-
-/* public boolean shouldRenderFriendFolders(){
- return conversationState.getSelectedUser() == null;
- }
-
- public boolean shouldRenderFolders(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedImage() == null;
- }
-
- public boolean shouldRenderImage(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedAlbum()!=null && conversationState.getSelectedImage()
!= null;
- }
-
- public boolean shouldRenderImageList(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedAlbum()!=null;
- }
-
- public boolean isCurrentUserProfileSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isSecondUserProfileSelected(){
- return conversationState.getSecondSelectedUser() != null;
- }*/
-
- public boolean isUserAlbumSelected(){
- return conversationState.getSelectedAlbum() != null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
- public boolean isUserGuest(){
- return !identity.hasRole(Constants.ADMIN_ROLE);
- }
-
- public boolean isOwner(User u){
- return user.equals(u);
- }
-
- public boolean isProfileSelected(){
- return conversationState.getMainArea() == NavigationEnum.USER_PREFS;
- }
-
- public boolean shouldRenderFileUpload(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
- /*public boolean isUserSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isFriendSelected(){
- return conversationState.getSelectedUser() == null || isUserFriend();
- }*/
-
- /*public boolean isNotFriendSelected(){
- return !isUserSelected() && !isUserFriend();
- }
-
- public boolean isUserFriend(){
- return user.getFriends() != null &&
user.getFriends().contains(conversationState.getSelectedUser());
- }*/
-
- /*public boolean isUserFriend(User u){
- return user.getFriends() != null && user.getFriends().contains(u);
- }*/
-
- public boolean isAlbumSelected(){
- return conversationState.getSelectedAlbum() != null;
- }
-
- public boolean isImageSelected(){
- return conversationState.getSelectedImage() != null;
- }
-
- /*public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.isShared() ||
isUserFriend(album.getOwner());
- }*/
-
- public boolean isUserAlbum(Album album){
- if(album == null){
- return false;
- }
- return album.getOwner().equals(user);
- }
-
- public boolean isFavoriteAlbum(Album album){
- return user.getFavoriteAlbums().contains(album);
- }
-
- public boolean isFavoriteImage(Image image){
- return user.getFavoriteImages().contains(image);
- }
-
-}
Copied:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
(from rev 12550,
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic2.java)
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -0,0 +1,133 @@
+package org.richfaces.realworld.util;
+
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+import java.io.Serializable;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.security.Identity;
+import org.richfaces.realworld.service.Constants;
+
+@Name("renderLogic")
+(a)Scope(ScopeType.CONVERSATION)
+public class RenderLogic implements Serializable{
+
+ @In Identity identity;
+ @In ConversationState conversationState;
+
+ private static final long serialVersionUID = 5656562187249324512L;
+
+ /*public boolean shouldRenderFriendFolders(){
+ return conversationState.getSelectedUser() == null;
+ }
+
+ public boolean shouldRenderFolders(){
+ return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedImage() == null;
+ }*/
+
+ public boolean shouldRenderImage(){
+ return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() != null;
+ }
+
+ public boolean shouldRenderImageList(){
+ return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() == null;
+ }
+
+ /*public boolean isCurrentUserProfileSelected(){
+ return user.equals(conversationState.getSelectedUser());
+ }
+
+ public boolean isSecondUserProfileSelected(){
+ return conversationState.getSecondSelectedUser() != null;
+ }*/
+
+/* public boolean isUserAlbumSelected(){
+ return conversationState.getSelectedAlbum() != null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
+ }*/
+
+ public boolean isUserGuest(){
+ return !identity.hasRole(Constants.ADMIN_ROLE);
+ }
+
+/* public boolean isOwner(User u){
+ return user.equals(u);
+ }*/
+
+/* public boolean isProfileSelected(){
+ return conversationState.getMainArea() == NavigationEnum.USER_PREFS;
+ }*/
+
+/* public boolean shouldRenderFileUpload(){
+ return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
+ }*/
+
+ /*public boolean isUserSelected(){
+ return user.equals(conversationState.getSelectedUser());
+ }
+
+ public boolean isFriendSelected(){
+ return conversationState.getSelectedUser() == null || isUserFriend();
+ }*/
+
+ /*public boolean isNotFriendSelected(){
+ return !isUserSelected() && !isUserFriend();
+ }
+
+ public boolean isUserFriend(){
+ return user.getFriends() != null &&
user.getFriends().contains(conversationState.getSelectedUser());
+ }
+
+ public boolean isUserFriend(User u){
+ return user.getFriends() != null && user.getFriends().contains(u);
+ }*/
+
+ public boolean isAlbumSelected(){
+ return conversationState.getSelectedAlbum() != null;
+ }
+
+ public boolean isImageSelected(){
+ return conversationState.getSelectedImage() != null;
+ }
+
+ /*public boolean isAccessToAlbumGranted(Album album){
+ return album.getOwner().equals(user) || album.isShared() ||
isUserFriend(album.getOwner());
+ }*/
+
+/* public boolean isUserAlbum(Album album){
+ if(album == null){
+ return false;
+ }
+ return album.getOwner().equals(user);
+ }
+
+ public boolean isFavoriteAlbum(Album album){
+ return user.getFavoriteAlbums().contains(album);
+ }
+
+ public boolean isFavoriteImage(Image image){
+ return user.getFavoriteImages().contains(image);
+ }*/
+
+}
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic2.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic2.java 2009-02-10
14:44:13 UTC (rev 12610)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic2.java 2009-02-10
14:47:17 UTC (rev 12611)
@@ -1,133 +0,0 @@
-package org.richfaces.realworld.util;
-
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.security.Identity;
-import org.richfaces.realworld.service.Constants;
-
-@Name("renderLogic2")
-(a)Scope(ScopeType.CONVERSATION)
-public class RenderLogic2 implements Serializable{
-
- @In Identity identity;
- @In ConversationState conversationState;
-
- private static final long serialVersionUID = 5656562187249324512L;
-
- /*public boolean shouldRenderFriendFolders(){
- return conversationState.getSelectedUser() == null;
- }
-
- public boolean shouldRenderFolders(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedImage() == null;
- }*/
-
- public boolean shouldRenderImage(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() != null;
- }
-
- public boolean shouldRenderImageList(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() == null;
- }
-
- /*public boolean isCurrentUserProfileSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isSecondUserProfileSelected(){
- return conversationState.getSecondSelectedUser() != null;
- }*/
-
-/* public boolean isUserAlbumSelected(){
- return conversationState.getSelectedAlbum() != null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }*/
-
- public boolean isUserGuest(){
- return !identity.hasRole(Constants.ADMIN_ROLE);
- }
-
-/* public boolean isOwner(User u){
- return user.equals(u);
- }*/
-
-/* public boolean isProfileSelected(){
- return conversationState.getMainArea() == NavigationEnum.USER_PREFS;
- }*/
-
-/* public boolean shouldRenderFileUpload(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }*/
-
- /*public boolean isUserSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isFriendSelected(){
- return conversationState.getSelectedUser() == null || isUserFriend();
- }*/
-
- /*public boolean isNotFriendSelected(){
- return !isUserSelected() && !isUserFriend();
- }
-
- public boolean isUserFriend(){
- return user.getFriends() != null &&
user.getFriends().contains(conversationState.getSelectedUser());
- }
-
- public boolean isUserFriend(User u){
- return user.getFriends() != null && user.getFriends().contains(u);
- }*/
-
- public boolean isAlbumSelected(){
- return conversationState.getSelectedAlbum() != null;
- }
-
- public boolean isImageSelected(){
- return conversationState.getSelectedImage() != null;
- }
-
- /*public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.isShared() ||
isUserFriend(album.getOwner());
- }*/
-
-/* public boolean isUserAlbum(Album album){
- if(album == null){
- return false;
- }
- return album.getOwner().equals(user);
- }
-
- public boolean isFavoriteAlbum(Album album){
- return user.getFavoriteAlbums().contains(album);
- }
-
- public boolean isFavoriteImage(Image image){
- return user.getFavoriteImages().contains(image);
- }*/
-
-}