Author: amarkhel
Date: 2009-04-01 06:30:06 -0400 (Wed, 01 Apr 2009)
New Revision: 13335
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/Authenticator.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/album.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/shelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/login.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/menu.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/register.xhtml
Log:
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-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -21,6 +21,8 @@
package org.richfaces.realworld.manager;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import org.jboss.seam.ScopeType;
@@ -29,28 +31,26 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IAlbumAction;
@Name("albumManager")
-(a)Scope(ScopeType.CONVERSATION)
+(a)Scope(ScopeType.EVENT)
@AutoCreate
public class AlbumManager implements Serializable{
private static final long serialVersionUID = 2631634926126857691L;
-
- private String oncomplete = ";";
+ private boolean validationSuccess = false;
@In private IAlbumAction albumAction;
- @In(create=true, required=true) @Out
- private Album album;
-
@In private User user;
@In FileManager fileManager;
@@ -59,23 +59,33 @@
public void addAlbum(Album album){
if(album.getShelf() == null){
- //TODO nick - remove null argument
- //TODO nick - externalize message
- facesMessages.add("Shelf must be not-null", null);
+ facesMessages.addToControl("shelf", "Shelf must be not-null",
null);
+ Contexts.getConversationContext().set("album", album);
return;
}
+ validationSuccess = true;
albumAction.addAlbum(album);
- //TODO nick - addDirectory() uses this.album, do we need: this.album = album?
- addDirectory();
+ fileManager.addDirectory(user.getLogin(), album.getId().toString());
model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getShelf().getOwner(),
album.getShelf(), album, null);
+ model.setImages(new ArrayList<Image>());
+ Contexts.getConversationContext().set("album", null);
Events.instance().raiseEvent("albumAdded");
Events.instance().raiseEvent("clearTree");
- setOncomplete();
}
- public void initEdit(Shelf shelf){
- album = new Album();
+ public void createAlbum(Shelf shelf){
+ Album album = new Album();
+ if(shelf == null){
+ if(user.getShelfs().size() > 0){
+ shelf = user.getShelfs().get(0);
+ }
+ if(shelf == null){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You must
create at least one shelf before creating album!"));
+ return;
+ }
+ }
album.setShelf(shelf);
+ Contexts.getConversationContext().set("album", album);
}
public void editAlbum(Album album){
@@ -102,24 +112,16 @@
}
return album.getUnvisitedImages();
}
-
- private void setOncomplete() {
- oncomplete = "$('albumModalPanel').component.hide()";
- }
-
- public String getOncomplete() {
- return oncomplete;
- }
-
- public void setOncomplete(String oncomplete) {
- this.oncomplete = oncomplete;
- }
private void deleteDirectory(String albumName) {
fileManager.deleteDirectory(user.getLogin(), albumName);
}
- private void addDirectory() {
- fileManager.addDirectory(user.getLogin(), album.getId().toString());
+ public boolean isValidationSuccess() {
+ return validationSuccess;
}
+
+ public void setValidationSuccess(boolean validationSuccess) {
+ this.validationSuccess = validationSuccess;
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -123,7 +123,6 @@
return true;
}
} catch (Exception nre) {
- facesMessages.add(INVALID_LOGIN_OR_PASSWORD);
return false;
}
return false;
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -159,6 +159,10 @@
}
public void showFileUpload(){
+ if(!(user.getShelfs().size() > 0)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You must
create at least one shelf before creating album!"));
+ return;
+ }
model.setMainArea(NavigationEnum.FILE_UPLOAD);
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -20,6 +20,8 @@
*/
package org.richfaces.realworld.manager;
+import java.util.ArrayList;
+
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.core.Events;
@@ -71,6 +73,7 @@
String newPath = getNewPathOfImage(dragValue, dropValue);
dragValue.setPath(newPath);
dropValue.addImage(dragValue);
+ dropValue.setUnvisitedImages(new ArrayList<Image>());
albumAction.editAlbum(dropValue);
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -41,12 +41,12 @@
import org.richfaces.realworld.service.IShelfAction;
@Name("shelfManager")
-(a)Scope(ScopeType.CONVERSATION)
+(a)Scope(ScopeType.EVENT)
@AutoCreate
public class ShelfManager implements Serializable {
private static final long serialVersionUID = 2631634926126857691L;
-
+ private boolean validationSuccess = false;
private List<Shelf> shelfs;
@In
@@ -55,8 +55,6 @@
@In
IShelfAction shelfAction;
- private String oncomplete = ";";
-
@In @Out
Model model;
@@ -64,15 +62,15 @@
User user;
//TODO nick - rename to createShelf
- public void initEdit() {
+ public void createShelf() {
Shelf shelf = new Shelf();
Contexts.getConversationContext().set("shelf", shelf);
}
public void addShelf(Shelf shelf) {
+ validationSuccess = true;
shelfAction.addShelf(shelf);
model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null,
null);
- setOncomplete();
Events.instance().raiseEvent("clearTree");
}
@@ -113,22 +111,18 @@
shelfs = null;
}
- private void setOncomplete() {
- oncomplete = "$('shelfModalPanel').component.hide()";
- }
-
- public String getOncomplete() {
- return oncomplete;
- }
-
- public void setOncomplete(String oncomplete) {
- this.oncomplete = oncomplete;
- }
-
public List<Image> getUnvisitedImages(Shelf shelf) {
if (shelf.getCountUnvisitedImages() == 0) {
shelf.setUnvisitedImages(shelfAction.getUnvisitedImages(shelf));
}
return shelf.getUnvisitedImages();
}
+
+ public boolean isValidationSuccess() {
+ return validationSuccess;
+ }
+
+ public void setValidationSuccess(boolean validationSuccess) {
+ this.validationSuccess = validationSuccess;
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java 2009-04-01
10:29:45 UTC (rev 13334)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java 2009-04-01
10:30:06 UTC (rev 13335)
@@ -67,6 +67,9 @@
model.resetModel(NavigationEnum.ALL_SHELFS, user, model.getSelectedShelf(),
model.getSelectedAlbum(), model.getSelectedImage());
}
+ public String goToIndex(){
+ return "index";
+ }
public void cancel() {
user = userAction.resetUser();
avatarData = null;
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/album.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/shelf.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/login.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/menu.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/register.xhtml
===================================================================
(Binary files differ)