Author: amarkhel
Date: 2009-02-26 08:24:40 -0500 (Thu, 26 Feb 2009)
New Revision: 12756
Added:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
Modified:
trunk/test-applications/realworld2/
trunk/test-applications/realworld2/ear/
trunk/test-applications/realworld2/ejb/
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld2/web/
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ConfirmationPopupHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ConversationState.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/album.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/modalPanels.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/panelBar/tree.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/main.xhtml
Log:
Property changes on: trunk/test-applications/realworld2
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/test-applications/realworld2/ear
___________________________________________________________________
Name: svn:ignore
+ *.project
.settings
target
Property changes on: trunk/test-applications/realworld2/ejb
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -41,4 +41,6 @@
public List<Album> getRootAlbums(User user);
public void addFavoriteImage(Image image);
public void removeFromFavoriteImages(User user, Image image);
+ public Long countAlbums(User user);
+ public Long countImages(User user);
}
\ No newline at end of file
Added:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
(rev 0)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -0,0 +1,41 @@
+package org.richfaces.realworld.service;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.User;
+
+@Name("searchAction")
+@Stateless
+public class SearchAction {
+
+ @In(value="entityManager")
+ EntityManager em;
+
+ @In @Out
+ private User user;
+
+ public List<Image> searchByImage(Map<String, String> params){
+ return null;
+ }
+
+ public List<Image> searchByTags(Map<String, String> params){
+ return null;
+ }
+
+ public List<Album> searchByAlbum(Map<String, String> params){
+ return null;
+ }
+
+ public List<Image> searchByUsers(Map<String, String> params){
+ return null;
+ }
+}
Property changes on:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -107,4 +107,12 @@
user.removeFromFavoriteImages(image);
em.flush();
}
+
+ public Long countAlbums(User user){
+ return (Long)em.createQuery("select count(a) from Album a where
a.owner=:user").setParameter("user", user).getSingleResult();
+ }
+
+ public Long countImages(User user){
+ return (Long)em.createQuery("select count(i) from Image i where
i.album.owner=:user").setParameter("user", user).getSingleResult();
+ }
}
\ No newline at end of file
Property changes on: trunk/test-applications/realworld2/web
___________________________________________________________________
Name: svn:ignore
+ *.classpath
*.project
.settings
target
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -86,6 +86,7 @@
//Update conversation state
conversationState.setSelectedImage(null);
conversationState.setSelectedAlbum(album);
+ Events.instance().raiseEvent("albumAdded");
setOncomplete();
}
@@ -105,6 +106,7 @@
public void editAlbum(Album album){
albumAction.editAlbum(album);
conversationState.setSelectedAlbum(album);
+ Events.instance().raiseEvent("albumEdited");
}
public void deleteAlbum(Album album){
@@ -115,9 +117,9 @@
deleteDirectory(string);
conversationState.setSelectedImage(null);
conversationState.setSelectedAlbum(null);
+ Events.instance().raiseEvent("albumDeleted");
}
-
private void removeFromTree(Album album2) {
if(album.getParent() != null){
TreeNode shelf = treeRoot.findShelf(album.getParent());
@@ -135,7 +137,6 @@
fileManager.addDirectory(user.getLogin(), album.getId().toString());
}
-
public List<Album> getSharedAlbums(){
if(null == sharedAlbums){
sharedAlbums=albumAction.getSharedAlbums();
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -64,11 +64,13 @@
public void deleteImage(Image image){
String imagePath = image.getPath();
imageAction.deleteImage(image);
- fileManager.deleteImage(fileManager.transformToServerPath(imagePath));
+ fileManager.deleteImage(imagePath);
+ Events.instance().raiseEvent("imageDeleted");
}
public void editImage(Image image){
imageAction.editImage(image);
+ Events.instance().raiseEvent("imageEdited");
setOncomplete();
}
@@ -77,6 +79,7 @@
imageAction.addImage(image);
conversationState.setSelectedAlbum(image.getAlbum());
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.IMAGE_PREVIEW);
+ Events.instance().raiseEvent("imageAdded");
setOncomplete();
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -21,11 +21,14 @@
package org.richfaces.realworld.manager;
import java.io.Serializable;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
@@ -41,6 +44,8 @@
@In
private User user;
+ private Long countImages;
+ private Long countAlbums;
@In(create=true, required=true)
private IUserAction userAction;
@@ -63,4 +68,43 @@
public List<Album> getRootAlbums(User user2) {
return userAction.getRootAlbums(user2);
}
+
+ public Long countImages(User u) {
+ if(null == countImages ){
+ countImages = userAction.countImages(u);
+ }
+ return countImages;
+ }
+
+ public Long countAlbums(User u) {
+ if(null == countAlbums ){
+ countAlbums = userAction.countAlbums(user);
+ }
+ return countAlbums;
+ }
+
+ @Observer(value = "imageAdded", create = false)
+ public void onImageAdded() {
+ updateStatistics(countAlbums, countImages + 1);
+ }
+
+ @Observer(value = "imageDeleted", create = false)
+ public void onImageDeleted(){
+ updateStatistics(countAlbums, countImages - 1);
+ }
+
+ @Observer(value = "albumDeleted", create = false)
+ public void onAlbumDeleted(){
+ updateStatistics(countAlbums-1, countImages - 1);
+ }
+
+ @Observer(value = "albumAdded", create = false)
+ public void onAlbumAdded(){
+ updateStatistics(countAlbums+1, countImages - 1);
+ }
+
+ private void updateStatistics(Long i, Long j) {
+ countAlbums = i;
+ countImages = j;
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ConfirmationPopupHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ConfirmationPopupHelper.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ConfirmationPopupHelper.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -33,8 +33,10 @@
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.manager.AlbumManager;
import org.richfaces.realworld.manager.ImageManager;
+import org.richfaces.realworld.manager.ShelfManager;
@Name("confirmationPopupHelper")
@Scope(ScopeType.CONVERSATION)
@@ -50,39 +52,46 @@
private Image image;
@In(create=true, required=true) @Out(required=false)
+ private Shelf shelf;
+
+ @In(create=true, required=true) @Out(required=false)
private Album album;
- @In(create=true, required=true)
+ @In(create=true)
private AlbumManager albumManager;
- @In(create=true, required=true)
+ @In(create=true)
+ private ShelfManager shelfManager;
+
+ @In(create=true)
private ImageManager imageManager;
public void initImagePopup( String actionName, String caption, Image image){
this.caption = caption;
this.actionName = actionName;
- if(null != image){
- this.image = image;
- //image.setMeta(new ArrayList<MetaTag>(image.getTags()));
- }else{
- this.image = new Image();
- }
+ this.image = image;
}
public void initAlbumData( String actionName, String caption, Album album){
this.caption = caption;
this.actionName = actionName;
- if(null != album){
- this.album = album;
- }else{
- this.album = new Album();
- }
+ this.album = album;
}
- public void deleteAlbum(ActionEvent event){
+ public void initShelfData( String actionName, String caption, Shelf shelf){
+ this.caption = caption;
+ this.actionName = actionName;
+ this.shelf = shelf;
+ }
+
+ public void deleteAlbum(){
albumManager.deleteAlbum(this.album);
}
+ public void deleteShelf(){
+ shelfManager.deleteShelf(this.shelf);
+ }
+
public String getCaption() {
return caption;
}
@@ -99,7 +108,7 @@
this.actionName = actionName;
}
- public void deleteImage(ActionEvent event){
+ public void deleteImage(){
imageManager.deleteImage(this.image);
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -21,7 +21,23 @@
package org.richfaces.realworld.navigation;
public enum NavigationEnum {
- IMAGE_PREVIEW,
- FILE_UPLOAD,
- USER_PREFS, SEARCH, WHAT_NEW, ALBUM_PREVIEW, SHELF_PREVIEW, ALL_SHELFS, TAGS,
ALL_ALBUMS, ALL_IMAGES,
+ IMAGE_PREVIEW("includes/imagePreview.xhtml"),
+ FILE_UPLOAD("includes/fileUpload.xhtml"),
+ USER_PREFS("includes/userPrefs.xhtml"),
+ SEARCH("includes/search.xhtml"),
+ WHAT_NEW("includes/recent.xhtml"),
+ ALBUM_PREVIEW("includes/albumPreview.xhtml"),
+ SHELF_PREVIEW("includes/shelfPreview.xhtml"),
+ ALL_SHELFS("includes/shelfs.xhtml"),
+ TAGS("includes/tags.xhtml"),
+ ALL_ALBUMS("includes/albums.xhtml"),
+ ALL_IMAGES("includes/images.xhtml");
+
+ private NavigationEnum(String t){
+ template=t;
+ }
+ private String template;
+ public String getTemplate() {
+ return template;
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ConversationState.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-02-26
13:24:40 UTC (rev 12756)
@@ -56,8 +56,6 @@
private static final long serialVersionUID = 5656562187249324512L;
- @In Conversation conversation;
-
@In("#{messages['acess_not_granted']}")
private String HAVENT_ACCESS;
@@ -86,6 +84,30 @@
return mainArea;
}
+ public void selectShelfs(){
+ setMainArea(NavigationEnum.ALL_SHELFS);
+ setSelectedAlbum(null);
+ setSelectedShelf(null);
+ setSelectedImage(null);
+ setSelectedUser(user);
+ }
+
+ public void selectAlbums(){
+ setMainArea(NavigationEnum.ALL_ALBUMS);
+ setSelectedAlbum(null);
+ setSelectedShelf(null);
+ setSelectedImage(null);
+ setSelectedUser(user);
+ }
+
+ public void selectImages(){
+ setMainArea(NavigationEnum.ALL_IMAGES);
+ setSelectedAlbum(null);
+ setSelectedShelf(null);
+ setSelectedImage(null);
+ setSelectedUser(user);
+ }
+
@Observer(Constants.UPDATE_MAIN_AREA_EVENT)
public void setMainArea(NavigationEnum mainArea) {
this.mainArea = mainArea;
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-02-26
13:23:04 UTC (rev 12755)
+++
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-02-26
13:24:40 UTC (rev 12756)
@@ -13,6 +13,10 @@
<source>templates/shelf.xhtml</source>
</tag>
<tag>
+ <tag-name>confirm</tag-name>
+ <source>templates/confirmation.xhtml</source>
+ </tag>
+ <tag>
<tag-name>image</tag-name>
<source>templates/image.xhtml</source>
</tag>
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/album.xhtml
===================================================================
(Binary files differ)
Added:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/modalPanels.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/panelBar/tree.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/main.xhtml
===================================================================
(Binary files differ)