JBoss Rich Faces SVN: r13436 - in trunk/test-applications/realworld2/web/src/main: webapp/WEB-INF and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-04-08 10:35:26 -0400 (Wed, 08 Apr 2009)
New Revision: 13436
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/Controller.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
Log:
Fix fileUpload
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-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-04-08 14:35:26 UTC (rev 13436)
@@ -35,6 +35,7 @@
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.security.Credentials;
@@ -54,8 +55,6 @@
@In Identity identity;
- @Out(required=false) User user;
-
@In Credentials credentials;
@In FacesMessages facesMessages;
@@ -159,11 +158,12 @@
return true;
}
try {
- user = userAction.login(credentials.getUsername(), hash(credentials.getPassword()));
+ User user = userAction.login(credentials.getUsername(), hash(credentials.getPassword()));
if (user != null) {
identity.addRole(Constants.ADMIN_ROLE);
- Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT);
+ Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT, user);
setLoginFailed(false);
+ Contexts.getSessionContext().set(Constants.USER_VARIABLE, user);
return true;
}
} catch (Exception nre) {
@@ -186,14 +186,16 @@
//No cases for that
}
}
- return null;
+ return "";
}
public String destroyConversation(){
- identity.logout();
- identity.unAuthenticate();
- credentials.clear();
- return null;
+ if(identity.isLoggedIn()){
+ identity.logout();
+ }else{
+ identity.unAuthenticate();
+ }
+ return "";
}
private boolean wantLoginAnonymous() {
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-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-08 14:35:26 UTC (rev 13436)
@@ -21,6 +21,7 @@
package org.richfaces.realworld.manager;
import java.io.Serializable;
+import java.util.List;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
@@ -47,7 +48,7 @@
@In @Out Model model;
- @In User user;
+ @In(scope = ScopeType.SESSION) User user;
public void selectShelfs(){
model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
@@ -155,7 +156,7 @@
}
@Observer(Constants.SHELF_DELETED_EVENT)
- public void onShelfDeleted(Shelf shelf, String... parameters){
+ public void onShelfDeleted(Shelf shelf, List<String> parameters){
model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null, null);
}
@@ -175,8 +176,8 @@
}
@Observer(Constants.AUTHENTICATED_EVENT)
- public void onAuthenticate(){
- model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
+ public void onAuthenticate(User u){
+ model.resetModel(NavigationEnum.ALL_SHELFS, u, null, null, null, null);
}
public void showFileUpload(){
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-04-08 14:35:26 UTC (rev 13436)
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
@@ -386,7 +387,7 @@
@Restrict("#{s:hasRole('admin')}")
@Observer(Constants.SHELF_DELETED_EVENT)
- public void deleteDirectories(Shelf shelf, Iterable<String> directoriesToDelete) {
+ public void deleteDirectories(Shelf shelf, List<String> directoriesToDelete) {
for (String directory : directoriesToDelete) {
deleteDirectory(directory);
}
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-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-04-08 14:35:26 UTC (rev 13436)
@@ -109,7 +109,7 @@
}
@Observer(Constants.IMAGE_DELETED_EVENT)
- public void onImageDeleted(Image image){
+ public void onImageDeleted(Image image, String path){
user.updateStatistics();
}
@@ -124,7 +124,7 @@
}
@Observer(Constants.SHELF_DELETED_EVENT)
- public void onShelfDeleted(Shelf shelf){
+ public void onShelfDeleted(Shelf shelf, List<String> directories){
user.updateStatistics();
}
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml 2009-04-08 14:11:46 UTC (rev 13435)
+++ trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml 2009-04-08 14:35:26 UTC (rev 13436)
@@ -19,8 +19,8 @@
<page view-id="/index.xhtml">
<begin-conversation if="#{!identity.isLoggedIn()}"/>
- <action if="#{authenticator.startConversation!=null}" execute="#{authenticator.destroyConversation()}"/>
- <action if="#{!identity.isLoggedIn()}" execute="#{authenticator.startConversation()}"/>
+ <action if="#{authenticator.startConversation!=null}" execute="#{authenticator.destroyConversation}"/>
+ <action if="#{!identity.isLoggedIn()}" execute="#{authenticator.startConversation}"/>
<navigation from-action="#{authenticator.logout}">
<rule if-outcome="logout">
<end-conversation />
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
===================================================================
(Binary files differ)
15 years, 8 months
JBoss Rich Faces SVN: r13435 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-08 10:11:46 -0400 (Wed, 08 Apr 2009)
New Revision: 13435
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
https://jira.jboss.org/jira/browse/RF-6639
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-04-08 14:03:51 UTC (rev 13434)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-04-08 14:11:46 UTC (rev 13435)
@@ -288,6 +288,8 @@
TreeRange treeRange = (TreeRange) range;
if (treeRange == null || treeRange.processNode(argumentKey)) {
+ getRoot().setRowKey(context, argumentKey);
+
if (argumentKey != null) {
processElement(context, dataVisitor, argument, argumentKey, last);
}
@@ -302,6 +304,8 @@
Iterator iterator = this.getInternalModelsIterator();
while (iterator.hasNext()) {
final StackingTreeModel model = (StackingTreeModel) iterator.next();
+
+ getRoot().setRowKey(context, argumentKey);
final ExtendedDataModel scalarModel = model.getDataModel();
Argument argument2 = new Argument();
15 years, 8 months
JBoss Rich Faces SVN: r13434 - trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-08 10:03:51 -0400 (Wed, 08 Apr 2009)
New Revision: 13434
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
Log:
z-index added to rich:colorPicker
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-04-08 13:18:56 UTC (rev 13433)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-04-08 14:03:51 UTC (rev 13434)
@@ -9,6 +9,7 @@
overflow:hidden;
position:absolute;
width:350px;
+ z-index: 3;
}
.rich-colorPicker-ext{
border: 1px solid;
15 years, 8 months
JBoss Rich Faces SVN: r13433 - trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-04-08 09:18:56 -0400 (Wed, 08 Apr 2009)
New Revision: 13433
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
Log:
Refactor
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-08 13:18:52 UTC (rev 13432)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-08 13:18:56 UTC (rev 13433)
@@ -44,6 +44,12 @@
public static final String STOP_SLIDESHOW_EVENT = "StopSlideshow";
public static final String IMAGE_DELETED_EVENT = "imageDeleted";
public static final String IMAGE_ADDED_EVENT = "imageAdded";
+ public static final String EDIT_USER_EVENT = "editUserEvent";
+ public static final String CANCEL_EDIT_USER_EVENT = "cancelEditUserEvent";
+ public static final String AUTHENTICATED_EVENT = "authenticateEvent";
+ public static final String SHELF_ADDED_EVENT = "shelfAddedEvent";
+ public static final String SHELF_EDITED_EVENT = "shelfEditEvent";
+ public static final String USER_DELETED_EVENT = "userDeletedEvent";
//Errors(Internationalization pending)
public static final String SHELF_MUST_BE_NOT_NULL_ERROR = "Shelf must be not-null";
15 years, 8 months
JBoss Rich Faces SVN: r13432 - in trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld: util and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-04-08 09:18:52 -0400 (Wed, 08 Apr 2009)
New Revision: 13432
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/FileManager.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/ShelfManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.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/util/SessionListener.java
Log:
Refactor
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-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -21,14 +21,12 @@
package org.richfaces.realworld.manager;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
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.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.contexts.Contexts;
@@ -54,12 +52,8 @@
@In private User user;
- @In FileManager fileManager;
-
@In FacesMessages facesMessages;
- @In @Out Model model;
-
@Restrict("#{s:hasRole('admin')}")
public void addAlbum(Album album){
if(album.getShelf() == null){
@@ -69,11 +63,8 @@
}
validationSuccess = true;
albumAction.addAlbum(album);
- fileManager.addDirectory(user.getLogin(), album.getId().toString());
- model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getShelf().getOwner(), album.getShelf(), album, null, album.getImages());
- model.setImages(new ArrayList<Image>());
Contexts.getConversationContext().set(Constants.ALBUM_VARIABLE, null);
- Events.instance().raiseEvent(Constants.ALBUM_ADDED_EVENT);
+ Events.instance().raiseEvent(Constants.ALBUM_ADDED_EVENT, album);
Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
}
@@ -96,17 +87,14 @@
@Restrict("#{s:hasRole('admin')}")
public void editAlbum(Album album){
albumAction.editAlbum(album);
- model.resetModel(NavigationEnum.ALBUM_PREVIEW, model.getSelectedUser(), model.getSelectedShelf(), album, null, album.getImages());
- Events.instance().raiseEvent(Constants.ALBUM_EDITED_EVENT);
+ Events.instance().raiseEvent(Constants.ALBUM_EDITED_EVENT, album);
}
@Restrict("#{s:hasRole('admin')}")
public void deleteAlbum(Album album){
String albumName = album.getId().toString();
albumAction.deleteAlbum(album);
- fileManager.deleteDirectory(user.getLogin(), albumName);
- model.resetModel(NavigationEnum.ALL_ALBUMS, model.getSelectedUser(), model.getSelectedShelf(), null, null, null);
- Events.instance().raiseEvent(Constants.ALBUM_DELETED_EVENT);
+ Events.instance().raiseEvent(Constants.ALBUM_DELETED_EVENT, album, user.getLogin(), albumName);
Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
}
@@ -124,4 +112,4 @@
public void setValidationSuccess(boolean validationSuccess) {
this.validationSuccess = validationSuccess;
}
-}
+}
\ No newline at end of file
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-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -31,18 +31,15 @@
import org.jboss.seam.ScopeType;
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.annotations.web.RequestParameter;
-import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.log.Log;
import org.jboss.seam.security.Credentials;
import org.jboss.seam.security.Identity;
import org.jboss.seam.util.Hex;
-import org.jboss.seam.web.Session;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IUserAction;
@@ -52,13 +49,9 @@
public class Authenticator implements Serializable{
private static final long serialVersionUID = -4585673256547342140L;
-
- @In ShelfManager shelfManager;
@RequestParameter protected Long startConversation;
- @Logger Log log;
-
@In Identity identity;
@Out(required=false) User user;
@@ -67,14 +60,8 @@
@In FacesMessages facesMessages;
- @In @Out Conversation conversation;
-
@In IUserAction userAction;
-
- @In FileManager fileManager;
- @In @Out Model model;
-
private boolean loginFailed = false;
private String digestAlgorithm;
@@ -137,10 +124,7 @@
}
public String goToRegister(){
- identity.logout();
identity.unAuthenticate();
- credentials.clear();
- credentials.invalidate();
return Constants.REGISTER_OUTCOME;
}
@@ -171,14 +155,14 @@
{
if (wantLoginAnonymous()) {
identity.addRole(Constants.GUEST_ROLE);
- model.setMainArea(NavigationEnum.ANONYM);
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT, NavigationEnum.ANONYM);
return true;
}
try {
user = userAction.login(credentials.getUsername(), hash(credentials.getPassword()));
if (user != null) {
identity.addRole(Constants.ADMIN_ROLE);
- model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
+ Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT);
setLoginFailed(false);
return true;
}
@@ -190,9 +174,6 @@
public String logout(){
identity.logout();
- identity.unAuthenticate();
- credentials.clear();
- Session.instance().invalidate();
return Constants.LOGOUT_OUTCOME;
}
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-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -25,9 +25,11 @@
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.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Events;
import org.richfaces.event.DataScrollerEvent;
import org.richfaces.realworld.domain.Album;
@@ -41,19 +43,11 @@
@Scope(ScopeType.EVENT)
public class Controller implements Serializable{
- private static final String ALBUM_CREATE_ERROR = "You must create at least one shelf before creating album!";
-
private static final long serialVersionUID = 5656562187249324512L;
@In @Out Model model;
-
- @In UserManager userManager;
-
- @In ShelfManager shelfManager;
-
- @In AlbumManager albumManager;
- @In private User user;
+ @In User user;
public void selectShelfs(){
model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
@@ -115,12 +109,12 @@
@Restrict("#{s:hasRole('admin')}")
public void editUser(){
- userManager.editUser();
+ pushEvent(Constants.EDIT_USER_EVENT);
model.resetModel(NavigationEnum.ALL_SHELFS, user, model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage(), model.getImages());
}
public void cancelEditUser(){
- userManager.cancelEditUser();
+ pushEvent(Constants.CANCEL_EDIT_USER_EVENT);
model.resetModel(NavigationEnum.ALL_SHELFS, user, model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage(), model.getImages());
}
@@ -128,26 +122,10 @@
model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW, image.getAlbum().getShelf().getOwner(), image.getAlbum().getShelf(), image.getAlbum(), image, image.getAlbum().getImages() );
}
- /*@Observer("resetModel")
- public void resetModel(){
- if(user.getId() != null){
- model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null);
- }else{
- model.resetModel(NavigationEnum.ANONYM, user, null, null, null);
- }
- }*/
-
public void showShelf(Shelf shelf){
model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null, null, null);
}
- public boolean isUserImage(Image image){
- if(image == null || image.getAlbum() == null || image.getAlbum().getOwner() == null){
- return false;
- }
- return image.getAlbum().getOwner().getLogin().equals(user.getLogin());
- }
-
@Restrict("#{s:hasRole('admin')}")
public void startEditAlbum(Album album){
if(!album.getOwner().getLogin().equals(user.getLogin())){
@@ -161,9 +139,49 @@
model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getShelf().getOwner(), album.getShelf(), album, null, album.getImages());
}
+ @Observer(Constants.ALBUM_ADDED_EVENT)
+ public void onAlbumAdded(Album album){
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getShelf().getOwner(), album.getShelf(), album, null, album.getImages());
+ }
+
+ @Observer(Constants.ALBUM_EDITED_EVENT)
+ public void onAlbumEdited(Album album){
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, model.getSelectedUser(), model.getSelectedShelf(), album, null, album.getImages());
+ }
+
+ @Observer(Constants.ALBUM_DELETED_EVENT)
+ public void onAlbumDeleted(Album album, String... parameters ){
+ model.resetModel(NavigationEnum.ALL_ALBUMS, model.getSelectedUser(), model.getSelectedShelf(), null, null, null);
+ }
+
+ @Observer(Constants.SHELF_DELETED_EVENT)
+ public void onShelfDeleted(Shelf shelf, String... parameters){
+ model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null, null);
+ }
+
+ @Observer(Constants.SHELF_ADDED_EVENT)
+ public void onShelfAdded(Shelf shelf){
+ model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null, null, null);
+ }
+
+ @Observer(Constants.SHELF_EDITED_EVENT)
+ public void onShelfEdited(Shelf shelf){
+ model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null, null, null);
+ }
+
+ @Observer(Constants.IMAGE_DELETED_EVENT)
+ public void onImageDeleted(Image image, String path){
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, image.getAlbum().getOwner(), image.getAlbum().getShelf(), image.getAlbum(), null, image.getAlbum().getImages());
+ }
+
+ @Observer(Constants.AUTHENTICATED_EVENT)
+ public void onAuthenticate(){
+ model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
+ }
+
public void showFileUpload(){
if(!(user.getShelfs().size() > 0)){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, ALBUM_CREATE_ERROR);
+ pushEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_CREATE_ERROR);
return;
}
model.resetModel(NavigationEnum.FILE_UPLOAD, model.getSelectedUser(), model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage(), model.getImages());
@@ -174,33 +192,26 @@
}
public void showSharedAlbums(User user){
+ UserManager userManager = (UserManager)Contexts.getEventContext().get("userManager");
model.resetModel(NavigationEnum.USER_SHARED_ALBUMS, user, null, null, null, userManager.getSharedImages(model.getSelectedUser()));
}
public void showSharedImages(User user){
+ UserManager userManager = (UserManager)Contexts.getEventContext().get("userManager");
model.resetModel(NavigationEnum.USER_SHARED_IMAGES, user, null, null, null, userManager.getSharedImages(model.getSelectedUser()));
}
- public boolean isUserShelf(Shelf shelf){
- return shelf.getOwner()!=null && shelf.getOwner().getLogin().equals(user.getLogin());
- }
-
- public boolean isUserAlbum(Album album){
- if(album == null || album.getOwner() == null){
- return false;
- }
- return album.getOwner().getLogin().equals(user.getLogin());
- }
-
public void showUser(User user){
model.resetModel(NavigationEnum.USER_PREFS, user, null, null, null, null);
}
public void showUnvisitedImages(Shelf shelf){
+ ShelfManager shelfManager = (ShelfManager)Contexts.getEventContext().get("shelfManager");
model.resetModel(NavigationEnum.SHELF_UNVISITED, shelf.getOwner(), shelf, null, null, shelfManager.getUnvisitedImages(shelf));
}
public void showUnvisitedImages(Album album){
+ AlbumManager albumManager = (AlbumManager)Contexts.getEventContext().get("albumManager");
model.resetModel(NavigationEnum.ALBUM_UNVISITED, album.getShelf().getOwner(), album.getShelf(), album, null, albumManager.getUnvisitedImages(album));
}
@@ -209,6 +220,24 @@
model.setSelectedTag(metatag);
}
+ public boolean isUserImage(Image image){
+ if(image == null || image.getAlbum() == null || image.getAlbum().getOwner() == null){
+ return false;
+ }
+ return image.getAlbum().getOwner().getLogin().equals(user.getLogin());
+ }
+
+ public boolean isUserShelf(Shelf shelf){
+ return shelf.getOwner()!=null && shelf.getOwner().getLogin().equals(user.getLogin());
+ }
+
+ public boolean isUserAlbum(Album album){
+ if(album == null || album.getOwner() == null){
+ return false;
+ }
+ return album.getOwner().getLogin().equals(user.getLogin());
+ }
+
private boolean canViewShelf(Shelf shelf) {
return shelf.getOwner().getLogin().equals(user.getLogin());
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -41,8 +41,12 @@
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.security.Restrict;
+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;
@@ -101,11 +105,17 @@
}
@Restrict("#{s:hasRole('admin')}")
- public void deleteDirectory(String... directories) {
- final File file = getFileByPath(joinFiles(directories).toString());
+ @Observer(Constants.ALBUM_DELETED_EVENT)
+ public void deleteDirectory(Album album, String... directories) {
+ deleteDirectory(directories);
+ }
+
+ @Observer(Constants.USER_DELETED_EVENT)
+ public void deleteDirectory(String... directories){
+ final File file = getFileByPath(joinFiles(directories).toString());
deleteDirectory(file);
}
-
+
private void deleteDirectory(File file) {
if (file.exists()) {
for (String f : file.list()) {
@@ -184,7 +194,8 @@
}
@Restrict("#{s:hasRole('admin')}")
- public void deleteImage(String fileName) {
+ @Observer(Constants.IMAGE_DELETED_EVENT)
+ public void deleteImage(Image image, String fileName) {
deleteImage(getFileByPath(fileName));
deleteImage(getFileByPath(transformPath(fileName, Constants._MEDIUM)));
deleteImage(getFileByPath(transformPath(fileName, Constants._SMALL80)));
@@ -374,7 +385,8 @@
}
@Restrict("#{s:hasRole('admin')}")
- public void deleteDirectories(Iterable<String> directoriesToDelete) {
+ @Observer(Constants.SHELF_DELETED_EVENT)
+ public void deleteDirectories(Shelf shelf, Iterable<String> directoriesToDelete) {
for (String directory : directoriesToDelete) {
deleteDirectory(directory);
}
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-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -31,7 +31,6 @@
import org.jboss.seam.annotations.AutoCreate;
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.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.core.Events;
@@ -50,20 +49,14 @@
private static final String IMAGE_DIRECT_LINK = "/includes/directImage.seam?imageId=";
@In IImageAction imageAction;
-
- @In FileManager fileManager;
- @In @Out Model model;
-
@In User user;
@Restrict("#{s:hasRole('admin')}")
public void deleteImage(Image image) {
String imagePath = image.getPath();
- model.resetModel(NavigationEnum.ALBUM_PREVIEW, image.getAlbum().getOwner(), image.getAlbum().getShelf(), image.getAlbum(), null, image.getAlbum().getImages());
imageAction.deleteImage(image);
- fileManager.deleteImage(imagePath);
- Events.instance().raiseEvent(Constants.IMAGE_DELETED_EVENT);
+ Events.instance().raiseEvent(Constants.IMAGE_DELETED_EVENT, image , imagePath);
}
@Restrict("#{s:hasRole('admin')}")
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-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -29,7 +29,6 @@
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.security.Restrict;
import org.jboss.seam.contexts.Contexts;
@@ -52,12 +51,8 @@
private List<Shelf> shelfs;
- @In FileManager fileManager;
-
@In IShelfAction shelfAction;
- @In @Out Model model;
-
@In User user;
@Restrict("#{s:hasRole('admin')}")
@@ -71,7 +66,7 @@
validationSuccess = true;
shelf.setPreDefined(false);
shelfAction.addShelf(shelf);
- model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null, null, null);
+ Events.instance().raiseEvent(Constants.SHELF_ADDED_EVENT, shelf);
Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
}
@@ -83,7 +78,7 @@
public void editShelf(Shelf shelf) {
shelf.setPreDefined(false);
shelfAction.editShelf(shelf);
- model.resetModel(NavigationEnum.SHELF_PREVIEW, model.getSelectedUser(), shelf, null, null, null);
+ Events.instance().raiseEvent(Constants.SHELF_EDITED_EVENT, shelf);
}
@Restrict("#{s:hasRole('admin')}")
@@ -94,16 +89,10 @@
directoriesToDelete.add(user.getLogin() + Constants.SLASH + a.getId());
}
shelfAction.deleteShelf(shelf);
- deleteDirectories(directoriesToDelete);
- model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null, null);
- Events.instance().raiseEvent(Constants.SHELF_DELETED_EVENT);
+ Events.instance().raiseEvent(Constants.SHELF_DELETED_EVENT, shelf, directoriesToDelete);
Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
}
- private void deleteDirectories(List<String> directoriesToDelete) {
- fileManager.deleteDirectories(directoriesToDelete);
- }
-
public List<Shelf> getShelfs() {
if (shelfs == null) {
shelfs = shelfAction.getShelfs(user);
@@ -130,4 +119,4 @@
public void setValidationSuccess(boolean validationSuccess) {
this.validationSuccess = validationSuccess;
}
-}
+}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java 2009-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -26,7 +26,6 @@
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.core.Events;
import org.richfaces.realworld.domain.Image;
@@ -44,7 +43,7 @@
private boolean active;
- @In @Out Model model;
+ @In Model model;
private int interval = Constants.INITIAL_DELAY;
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java 2009-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -5,7 +5,6 @@
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.UITree;
@@ -13,7 +12,7 @@
@Scope(ScopeType.EVENT)
public class TreeManager implements Serializable{
- @In @Out Model model;
+ @In Model model;
private static final long serialVersionUID = 5656562187249324512L;
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-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -34,6 +34,7 @@
import org.jboss.seam.core.Events;
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.IUserAction;
@@ -83,6 +84,7 @@
return userAction.getSharedImages(user);
}
+ @Observer(Constants.EDIT_USER_EVENT)
public void editUser(){
if (avatarData != null) {
if(!fileManager.saveAvatar(avatarData.getPath(), user)){
@@ -96,6 +98,7 @@
user = userAction.updateUser();
}
+ @Observer(Constants.CANCEL_EDIT_USER_EVENT)
public void cancelEditUser() {
avatarData = null;
}
@@ -106,22 +109,22 @@
}
@Observer(Constants.IMAGE_DELETED_EVENT)
- public void onImageDeleted(){
+ public void onImageDeleted(Image image){
user.updateStatistics();
}
@Observer(Constants.ALBUM_DELETED_EVENT)
- public void onAlbumDeleted(){
+ public void onAlbumDeleted(Album album, String... parameters){
user.updateStatistics();
}
@Observer(Constants.ALBUM_ADDED_EVENT)
- public void onAlbumAdded(){
+ public void onAlbumAdded(Album album){
user.updateStatistics();
}
@Observer(Constants.SHELF_DELETED_EVENT)
- public void onShelfDeleted(){
+ public void onShelfDeleted(Shelf shelf){
user.updateStatistics();
}
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java 2009-04-08 13:17:26 UTC (rev 13431)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java 2009-04-08 13:18:52 UTC (rev 13432)
@@ -10,8 +10,9 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.core.Events;
import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.manager.FileManager;
+import org.richfaces.realworld.service.Constants;
@Scope(ScopeType.SESSION)
@Name("sessionListener")
@@ -22,15 +23,13 @@
@In(value="entityManager") EntityManager em;
- @In FileManager fileManager;
-
@Destroy @Transactional @Observer("org.jboss.seam.sessionExpired")
public void onDestroy(){
if(user.getId() != null && user.getId() > 3){
user = em.merge(user);
em.remove(user);
em.flush();
- fileManager.deleteDirectory(user.getLogin());
+ Events.instance().raiseEvent(Constants.USER_DELETED_EVENT, user.getLogin());
}
}
}
15 years, 8 months
JBoss Rich Faces SVN: r13431 - in trunk: framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-08 09:17:26 -0400 (Wed, 08 Apr 2009)
New Revision: 13431
Added:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js
Modified:
trunk/framework/impl/pom.xml
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
trunk/ui/contextMenu/src/test/java/org/richfaces/component/ContextMenuComponentTest.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.jboss.org/jira/browse/RF-6467
Modified: trunk/framework/impl/pom.xml
===================================================================
--- trunk/framework/impl/pom.xml 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/framework/impl/pom.xml 2009-04-08 13:17:26 UTC (rev 13431)
@@ -74,6 +74,7 @@
<include>${project.build.directory}/compressed/org/ajax4jsf/javascript/scripts/AJAX-min.js</include>
<include>${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/scriptaculous/scriptaculous-min.js</include>
<include>${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/jquery/jquery-min.js</include>
+ <include>${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/jquery.utils-min.js</include>
<include>${project.build.directory}/compressed/org/ajax4jsf/javascript/scripts/dnd-min.js</include>
<include>**/*-min.js</include>
</includes>
Added: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js (rev 0)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js 2009-04-08 13:17:26 UTC (rev 13431)
@@ -0,0 +1,83 @@
+if (!window.Richfaces) {
+ window.Richfaces = {};
+}
+
+Richfaces.jQuery = {};
+
+(function(_r$, jQuery) {
+ var PX_REGEX = /^\s*[^\s]*px\s*$/;
+
+ var parseToPx = function(value) {
+ if (value) {
+ if (PX_REGEX.test(value)) {
+ try {
+ return parseInt(value.replace(PX_REGEX, ""), 10);
+ } catch (e) { }
+ }
+ }
+
+ return NaN;
+ };
+
+ _r$.position = function(rect, element) {
+ var jqe = jQuery(element);
+ var width = jqe.width();
+ var height = jqe.height();
+
+ var left = parseToPx(jqe.css('left'));
+ if (isNaN(left)) {
+ left = 0;
+ jqe.css('left', '0px');
+ }
+
+ var top = parseToPx(jqe.css('top'));
+ if (isNaN(top)) {
+ top = 0;
+ jqe.css('top', '0px');
+ }
+
+ var elementOffset = jqe.offset();
+
+ var jqw = jQuery(window);
+
+ var winWidth = jqw.width();
+ var winLeft = jqw.scrollLeft();
+
+ var winHeight = jqw.height();
+ var winTop = jqw.scrollTop();
+
+ var newLeft;
+ if (rect.left + width > winLeft + winWidth && rect.left + rect.width - width >= winLeft) {
+ newLeft = rect.left + rect.width - width;
+ } else {
+ newLeft = rect.left;
+ }
+
+ var newTop;
+ if (rect.top + rect.height + height > winTop + winHeight && rect.top - height >= winTop) {
+ newTop = rect.top - height;
+ } else {
+ newTop = rect.top + rect.height;
+ }
+
+ left += newLeft - elementOffset.left;
+ top += newTop - elementOffset.top;
+
+ jqe.css('left', (left + 'px')).css('top', (top + 'px'));
+ };
+
+ _r$.getPointerRectangle = function(event) {
+ var e = jQuery.event.fix(event);
+
+ return {width: 0, height: 0, left: e.pageX, top: e.pageY};
+ };
+
+ _r$.getElementRectangle = function(element) {
+ var jqe = jQuery(element);
+ var offset = jqe.offset();
+
+ return {width: jqe.width(), height: jqe.height(), left: offset.left, top: offset.top};
+ };
+
+}(Richfaces.jQuery, jQuery));
+
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-04-08 13:17:26 UTC (rev 13431)
@@ -320,34 +320,13 @@
var top = 0;
var left = 0;
- this.picker.css({visibility: 'hidden'}).css({left: '0px', top: '0px', display: 'block'});
-
- var win = $(window);
- var winWidth = win.width();
- var winHeight = win.height();
+ this.picker.css('visibility', 'hidden').css('display', 'block');
- var spanOffsets = this.element.offset();
- var pickerOffsets = this.picker.offset();
+ var elementRect = Richfaces.jQuery.getElementRectangle(this.element);
+ Richfaces.jQuery.position(elementRect, this.picker);
- left = spanOffsets.left - pickerOffsets.left;
- top = spanOffsets.top - pickerOffsets.top;
+ this.picker.css('visibility', 'visible');
- var relLeft = spanOffsets.left - win.scrollLeft();
- var relTop = spanOffsets.top - win.scrollTop();
-
- if (relTop + this.picker.height() + this.element.height() > winHeight && relTop - this.picker.height() > 0) {
- top -= this.picker.height();
- } else {
- top += this.element.height();
- }
-
- if (relLeft + this.picker.width() > winWidth && relLeft + this.element.width() - this.picker.width() > 0) {
- left += -this.picker.width() + this.element.width();
- } else {
- //left is ok
- }
-
- this.picker.css({left: left + 'px', top: top + 'px'}).css({visibility: 'visible'});
if (this._trigger("show", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) != false) {
this.picker.show();
}
Modified: trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-04-08 13:17:26 UTC (rev 13431)
@@ -11,7 +11,7 @@
component="org.richfaces.component.UIColorPicker"
>
<f:clientid var="clientId"/>
- <h:scripts>/org/richfaces/renderkit/html/scripts/jquery/jquery.js, /org/richfaces/renderkit/html/scripts/pngFix.js, /org/richfaces/renderkit/html/scripts/ui.core.js, /org/richfaces/renderkit/html/scripts/ui.colorpicker.js</h:scripts>
+ <h:scripts>/org/richfaces/renderkit/html/scripts/jquery/jquery.js, /org/richfaces/renderkit/html/scripts/jquery.utils.js, /org/richfaces/renderkit/html/scripts/pngFix.js, /org/richfaces/renderkit/html/scripts/ui.core.js, /org/richfaces/renderkit/html/scripts/ui.colorpicker.js</h:scripts>
<h:styles>/org/richfaces/renderkit/html/css/colorPicker.xcss</h:styles>
<f:resource name="/org/richfaces/renderkit/html/images/arrow.gif" var="arrow" />
<f:resource name="/org/richfaces/renderkit/html/images/rainbow.png" var="rainbow" />
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
===================================================================
--- trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2009-04-08 13:17:26 UTC (rev 13431)
@@ -78,7 +78,8 @@
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
getResource("/org/richfaces/renderkit/html/scripts/available.js"),
- getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js")
+ getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/jquery.utils.js")
};
Modified: trunk/ui/contextMenu/src/test/java/org/richfaces/component/ContextMenuComponentTest.java
===================================================================
--- trunk/ui/contextMenu/src/test/java/org/richfaces/component/ContextMenuComponentTest.java 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/ui/contextMenu/src/test/java/org/richfaces/component/ContextMenuComponentTest.java 2009-04-08 13:17:26 UTC (rev 13431)
@@ -68,6 +68,7 @@
javaScripts.add("org/richfaces/renderkit/html/scripts/menu.js");
javaScripts.add("org/richfaces/renderkit/html/scripts/available.js");
javaScripts.add("org/richfaces/renderkit/html/scripts/jquery/jquery.js");
+ javaScripts.add("/org/richfaces/renderkit/html/scripts/jquery.utils.js");
}
/**
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-08 12:48:31 UTC (rev 13430)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-08 13:17:26 UTC (rev 13431)
@@ -391,82 +391,16 @@
this.layer = $(layer);
this.show = function() {
RichFaces.Menu.Layers.shutdown();
- var body = RichFaces.Menu.getPageDimensions();
- var win = RichFaces.Menu.getWindowDimensions();
- var bodyHeight = body.height;
- var bodyWidth = body.width;
-
+
var layer_display = this.layer.style.display;
- if (layer_display=='none')
- {
+ if (layer_display=='none') {
this.layer.style.visibility='hidden';
this.layer.style.display='';
}
- var clientX = this.event.clientX;
- var clientY = this.event.clientY;
-
- var e = this.event;
- var x = Event.pointerX(e);
- var y = Event.pointerY(e);
- var elementDim = Richfaces.Position.getOffsetDimensions(this.layer);
-
- var offsets = Position.cumulativeOffset(this.layer);
-
- offsets[0] -= this.layer.offsetLeft || 0;
- offsets[1] -= this.layer.offsetTop || 0;
-
- var toolTipX = x - offsets[0];
- var toolTipY = y - offsets[1];
-
- var scrollOffsets = Position.realOffset(this.layer);
- toolTipX = toolTipX + scrollOffsets[0];
- toolTipY = toolTipY + scrollOffsets[1];
- var dx = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
- var dy = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
- toolTipX -= dx;
- toolTipY -= dy;
-
- var layerdim = Element.getDimensions(this.layer);
- var layerLeft = toolTipX;
-
- if (clientX + layerdim.width > win.width) {
- layerLeft -= (layerdim.width - RichFaces.Menu.Layers.shadowWidth - RichFaces.Menu.Layers.CornerRadius);
- }
-
- if (layerLeft < 0) {
- layerLeft = 0;
- }
-
- /*
- if (layerLeft + layerdim.width > bodyWidth) {
- layerLeft = bodyWidth - layerdim.width;
- }
-
- if (layerLeft < 0) {
- layerLeft = 0;
- }
- */
- var layerTop = toolTipY;
- /*if (layertop + layerdim.height > bodyHeight) {
- layertop = bodyHeight - layerdim.height;
- }
-
- if (layertop < 0) {
- layertop = 0;
- }
- */
- if (clientY + layerdim.height > win.height) {
- layerTop -= (layerdim.height - RichFaces.Menu.Layers.shadowWidth - RichFaces.Menu.Layers.CornerRadius);
- }
-
- if (layerTop < 0) {
- layerTop = 0;
- }
-
- this.layer.style.left = layerLeft + "px";
- this.layer.style.top = layerTop + "px";
-
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(this.event);
+ Richfaces.jQuery.position(cursorRect, this.layer);
+
this.layer.style.display=layer_display;
this.layer.style.visibility='';
15 years, 8 months
JBoss Rich Faces SVN: r13430 - trunk/test-applications/realworld2/web/src/main/webapp/includes/album.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-04-08 08:48:31 -0400 (Wed, 08 Apr 2009)
New Revision: 13430
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/createAlbum.xhtml
Log:
fix id
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/album/createAlbum.xhtml
===================================================================
(Binary files differ)
15 years, 8 months
JBoss Rich Faces SVN: r13429 - trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/calendar.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2009-04-08 08:44:23 -0400 (Wed, 08 Apr 2009)
New Revision: 13429
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/calendar/CalendarBean.java
Log:
add bean scope
Modified: trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/calendar/CalendarBean.java
===================================================================
--- trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/calendar/CalendarBean.java 2009-04-08 12:40:06 UTC (rev 13428)
+++ trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/calendar/CalendarBean.java 2009-04-08 12:44:23 UTC (rev 13429)
@@ -30,11 +30,14 @@
import java.util.TimeZone;
import javax.faces.event.ValueChangeEvent;
import org.richfaces.helloworld.domain.util.componentInfo.ComponentInfo;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.richfaces.component.UICalendar;
import org.richfaces.event.CurrentDateChangeEvent;
@Name("calendarBean")
+(a)Scope(ScopeType.SESSION)
public class CalendarBean {
private static final String [] WEEK_DAY_SHORT = new String[] { "<i>Sun</i>",
@@ -88,6 +91,7 @@
private boolean showWeeksBar;
private String todayControlMode; // scroll, select, hidden;
private UICalendar htmlCalendar = null;
+ private int text1,text2,text3,text4;
public CalendarBean() {
horizontalOffset = "0";
@@ -672,4 +676,28 @@
public void setHtmlCalendar(UICalendar htmlCalendar) {
this.htmlCalendar = htmlCalendar;
}
+ public int getText1() {
+ return ++text1;
+ }
+ public void setText1(int text1) {
+ this.text1 = text1;
+ }
+ public int getText2() {
+ return ++text2;
+ }
+ public void setText2(int text2) {
+ this.text2 = text2;
+ }
+ public int getText3() {
+ return ++text3;
+ }
+ public void setText3(int text3) {
+ this.text3 = text3;
+ }
+ public int getText4() {
+ return ++text4;
+ }
+ public void setText4(int text4) {
+ this.text4 = text4;
+ }
}
15 years, 8 months
JBoss Rich Faces SVN: r13428 - trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-04-08 08:40:06 -0400 (Wed, 08 Apr 2009)
New Revision: 13428
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
Log:
change direct link creation
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-04-08 11:44:03 UTC (rev 13427)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-04-08 12:40:06 UTC (rev 13428)
@@ -49,8 +49,6 @@
private static final String IMAGE_DIRECT_LINK = "/includes/directImage.seam?imageId=";
- private static String imageDirectLinkPrefix;
-
@In IImageAction imageAction;
@In FileManager fileManager;
@@ -110,29 +108,43 @@
}
public String getImageDirectLink(Image image) {
- if (imageDirectLinkPrefix == null) {
- FacesContext context = FacesContext.getCurrentInstance();
- if (context == null) {
- return null;
- }
- ExternalContext extc = context.getExternalContext();
- if (extc == null) {
- return null;
- }
-
- //TODO nick - see org.ajax4jsf.renderkit.RendererUtils#encodeResourceURL(TemplateContext, Object)
- Object request = extc.getRequest();
-
- if (request instanceof HttpServletRequest) {
- HttpServletRequest servletRequest = (HttpServletRequest)request;
- String contextPath = servletRequest.getContextPath();
- StringBuffer url = servletRequest.getRequestURL();
- int i = url.indexOf(contextPath);
- if (i > 0) {
- imageDirectLinkPrefix = url.substring(0, i) + contextPath + IMAGE_DIRECT_LINK;
- }
- }
+ String directLink = null;
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (context == null) {
+ return null;
}
- return imageDirectLinkPrefix + image.getId();
- }
+
+ String value = context.getApplication().getViewHandler().getResourceURL(context, IMAGE_DIRECT_LINK + image.getId());
+
+ ExternalContext externalContext = context.getExternalContext();
+ String relativeURL = externalContext.encodeResourceURL(value);
+ Object request = externalContext.getRequest();
+
+ if(request instanceof HttpServletRequest) {
+ directLink = createServerURL((HttpServletRequest)request) + relativeURL;
+ }
+
+ return directLink;
+
+ }
+
+ protected String createServerURL(HttpServletRequest request) {
+ StringBuffer url = new StringBuffer();
+
+ if(request != null) {
+ String name = request.getServerName();
+ String protocol = (request.getProtocol().split("/"))[0].toLowerCase();
+
+ int port = request.getServerPort();
+
+ url.append(protocol);
+ url.append("://");
+ url.append(name);
+ url.append(":");
+ url.append(Integer.toString(port));
+ }
+
+ return url.toString();
+ }
}
15 years, 8 months
JBoss Rich Faces SVN: r13427 - trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-04-08 07:44:03 -0400 (Wed, 08 Apr 2009)
New Revision: 13427
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
Log:
Refactoring
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-08 11:43:55 UTC (rev 13426)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-08 11:44:03 UTC (rev 13427)
@@ -20,6 +20,7 @@
*/
package org.richfaces.realworld.service;
+
/**
* Utility class. Group of constants
*
@@ -27,25 +28,94 @@
*/
public class Constants {
+ //Events
public static final String ADD_ERROR_EVENT = "addErrorEvent";
+ public static final String ALBUM_DELETED_EVENT = "albumDeleted";
+ public static final String ALBUM_EDITED_EVENT = "albumEdited";
+ public static final String UPDATE_MAIN_AREA_EVENT = "updateMainArea";
+ public static final String CLEAR_EDITOR_EVENT = "clearEditor";
+ public static final String CLEAR_TREE_EVENT = "clearTree";
+ public static final String ALBUM_ADDED_EVENT = "albumAdded";
+ public static final String DNDUPLOADED_EVENT = "DNDUploadedEvent";
+ public static final String ADD_IMAGE_EVENT = "addImage";
+ public static final String SHELF_DELETED_EVENT = "shelfDeleted";
+ public static final String CLEAR_FILE_UPLOAD_EVENT = "clearFileUpload";
+ public static final String UPDATE_SELECTED_TAG_EVENT = "updateSelectedTag";
+ public static final String STOP_SLIDESHOW_EVENT = "StopSlideshow";
+ public static final String IMAGE_DELETED_EVENT = "imageDeleted";
+ public static final String IMAGE_ADDED_EVENT = "imageAdded";
- public static final String SLASH = "/";
- public static final String DOT = ".";
+ //Errors(Internationalization pending)
+ public static final String SHELF_MUST_BE_NOT_NULL_ERROR = "Shelf must be not-null";
+ public static final String NO_SHELF_ERROR = "You must create at least one shelf before creating album!";
+ public static final String ALBUM_CREATE_ERROR = "You must create at least one shelf before creating album!";
+ public static final String DND_ALBUM_ERROR = "You can't add album to that shelf";
+ public static final String DND_PHOTO_ERROR = "You can't add photo's to that album";
+ public static final String NO_ALBUM_TO_DOWNLOAD_ERROR = "Please specify album to download";
+ public static final String NULL_COMMENT_ERROR = "Comment must be not-null";
+ public static final String ADDING_COMMENT_ERROR = "For adding comment on this picture you must login";
+ public static final String NO_IMAGES_FOR_SLIDESHOW_ERROR = "No images for slideshow!";
+ public static final String FILE_IO_ERROR = "File IO Error";
+ public static final String UPLOAD_ROOT_CREATION_ERROR = "Upload root was not created";
+ public static final String UPLOAD_FOLDER_PATH_ERROR = "Cannot bound image folder path";
+ public static final String INVALID_LOGIN_OR_PASSWORD = "Invalid login or password";
+ public static final String USER_WITH_THIS_LOGIN_ALREADY_EXIST = "User with this login already exist";
+ public static final String CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD = "Confirm Password not equals password";
+ public static final String HAVENT_ACCESS = "You have no rights to view this album";
+ public static final String FILE_PROCESSING_ERROR = "Error processing occured during upload";
+ public static final String FILE_SAVE_ERROR = "Error occured during saving image to disk";
- public static final String ADD_IMAGE_EVENT = "addImage";
- public static final String JPEG = "jpeg";
+ //Outcomes
+ public static final String LOGOUT_OUTCOME = "logout";
+ public static final String REGISTER_OUTCOME = "register";
+ public static final String MAIN_OUTCOME = "main";
+ public static final String INDEX_OUTCOME = "index";
- public static final String MAIN_OUTCOME = "main";
-
+ //Context-variables
+ public static final String ALBUM_VARIABLE = "album";
+ public static final String SHELF_VARIABLE = "shelf";
+
+ //ID's
public static final String REGISTER_LOGIN_NAME_ID = "register:loginName";
public static final String REGISTER_CONFIRM_PASSWORD_ID = "register:confirmPassword";
- public static final String INDEX_OUTCOME = "index";
+ public static final String SHELF_ID = "shelf";
+
+ //Roles
public static final String ADMIN_ROLE = "admin";
public static final String GUEST_ROLE = "guest";
- public static final String UPDATE_MAIN_AREA_EVENT = "updateMainArea";
- public static final String CLEAR_EDITOR_EVENT = "clearEditor";
+
+ //Size
+ public static final int MEDIUM_SIZE = 600;
+ public static final int SMALL_200_SIZE = 200;
+ public static final int SMALL_160_SIZE = 160;
+ public static final int SMALL_120_SIZE = 120;
+ public static final int SMALL_80_SIZE = 80;
+ public static final int AVATAR_SIZE = 80;
+ public static final String AVATAR_JPG = "/avatar.jpg";
+ public static final String _SMALL160 = "_small160";
+ public static final String _SMALL120 = "_small120";
+ public static final String _SMALL80 = "_small80";
+ public static final String _SMALL200 = "_small200";
+ public static final String _MEDIUM = "_medium";
+
+ //misc
+ public static final String SLASH = "/";
+ public static final String DOT = ".";
+ public static final String JPEG = "jpeg";
+ public static final String JPG = "JPG";
+ public static final String UPLOAD_ROOT_COMPONENT_NAME = "uploadRoot";
+ public static final String UPLOAD_ROOT_PATH_COMPONENT_NAME = "uploadRootPath";
public static final int INITIAL_DELAY = 4000;
public static final int DELAY = 3000;
+ public static final String DEFAULT_PICTURE = "default/noimage.jpg";
+ public static final int DEFAULT_BUFFER_SIZE = 8192;
+ public static final String UPLOAD = "upload";
+ public static final String FEMALE = "Female";
+ public static final String MALE = "Male";
+ public static final String TEMP_DIR = "java.io.tmpdir";
+ public static final String WEB_INF = "WEB-INF";
+ public static final String IMAGE_FOLDER = "/Upload";
+ public static final String REALWORLD_FOLDER = "richfaces_realworld";
//Service -constants
public static final String USER_EXIST_QUERY = "user-exist";
@@ -87,7 +157,5 @@
public static final String SHELF_PARAMETER = "shelf";
public static final String SHELF_UNVISITED_QUERY = "shelf-unvisited";
private Constants(){
-
}
-
-}
+}
\ No newline at end of file
15 years, 8 months