JBoss Rich Faces SVN: r13251 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-03-27 07:54:51 -0400 (Fri, 27 Mar 2009)
New Revision: 13251
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
Log:
assertion uncommented
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-27 11:34:20 UTC (rev 13250)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-27 11:54:51 UTC (rev 13251)
@@ -152,7 +152,7 @@
writeStatus("Check styleClass/style attributes");
assertStyleAttributeContains(componentId, "font-size: 13px", "Style attribute was not output to client");
- // assertClassAttributeContains(componentId, "noclass", "Class attribute was not output to client");
+ assertClassAttributeContains(componentId, "noclass", "Class attribute was not output to client");
int w = selenium.getElementWidth(componentId).intValue();
int h = selenium.getElementHeight(componentId).intValue();
15 years, 9 months
RE: UK Pharmacy Discount ID 989858
by 1909-2009 Pfizer Inc.
About this mailing:
You are receiving this e-mail because you subscribed to MSN Featured Offers. Microsoft respects your privacy. If you do not wish to receive this MSN Featured Offers e-mail, please click the "Unsubscribe" link below. This will not unsubscribe you from e-mail communications from third-party advertisers that may appear in MSN Feature Offers. This shall not constitute an offer by MSN. MSN shall not be responsible or liable for the advertisers' content nor any of the goods or service advertised. Prices and item availability subject to change without notice.
©2009 Microsoft | Unsubscribe at http://fucbosal.cn | More news at http://fucbosal.cn | Prvacy at http://fucbosal.cn
Microsoft Corporation, One Microsoft Way, Redmond, WA 98052
15 years, 9 months
JBoss Rich Faces SVN: r13250 - in trunk/test-applications/realworld2/ejb/src/main: java/org/richfaces/realworld/service and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-27 07:34:20 -0400 (Fri, 27 Mar 2009)
New Revision: 13250
Added:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/FlushStrategy.java
trunk/test-applications/realworld2/ejb/src/main/resources/realworld.properties
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
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/IAlbumAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java
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/ImageAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
Log:
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -54,8 +54,6 @@
*
* @author Andrey Markhel
*/
-@NamedQueries({
- @NamedQuery(name = "album-byAlbumNameAndLogin", query = "from Album a where a.name=:albumName and a.owner.login=:login")})
@Entity
@Name("album")
@Table(name = "albums")
@@ -72,18 +70,13 @@
@Column(length = 255, nullable = false)
@NotNull
@NotEmpty
- @Length(min = 3)
+ @Length(min = 3, max = 50)
//TODO nick - add maxLength validation here and everywhere?
private String name;
@Column(length = 1024)
private String description;
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "ALBUM_USER_ID", referencedColumnName = "USER_ID")
- //TODO nick - add @NotNull?
- private User owner;
-
@OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
private List<Image> images = new ArrayList<Image>();
@@ -100,10 +93,6 @@
@Transient
private List<Image> unvisitedImages = new ArrayList<Image>();
- @Transient
- //TODO nick == unvisitedImages.size
- private Long countUnvisitedImages;
-
@OneToOne(cascade = CascadeType.ALL, optional = true)
private Image coveringImage;
@@ -179,7 +168,7 @@
}
if (image.getAlbum() != null && !this.equals(image.getAlbum())) {
//TODO nick - use removeImage()
- image.getAlbum().getImages().remove(image);
+ image.getAlbum().removeImage(image);
}
image.setAlbum(this);
images.add(image);
@@ -196,8 +185,12 @@
throw new IllegalArgumentException("Null image");
}
//TODO nick - check if image is in the current album
- image.setAlbum(null);
- images.remove(image);
+ if(image.getAlbum().equals(this)){
+ image.setAlbum(null);
+ images.remove(image);
+ }else{
+ throw new IllegalArgumentException("This album not contain this image!");
+ }
}
/**
@@ -207,30 +200,20 @@
*/
public int getCountImages() {
return this.getImages() != null ? this.getImages().size() : 0;
-
}
public User getOwner() {
- return owner;
+ return getShelf().getOwner();
}
public List<Image> getImages() {
return images;
}
- public void setOwner(User owner) {
- this.owner = owner;
- }
-
public int getIndex(Image image) {
//TODO nick - use indexOf
//TODO nick - check images == null?
- for (int i = 0; i < this.images.size(); i++) {
- if (this.images.get(i).equals(image)) {
- return i;
- }
- }
- return -1;
+ return this.images.indexOf(image);
}
public Image getCoveringImage() {
@@ -265,12 +248,9 @@
}
public Long getCountUnvisitedImages() {
- return countUnvisitedImages;
+ return new Long(unvisitedImages.size());
}
- public void setCountUnvisitedImages(Long countUnvisitedImages) {
- this.countUnvisitedImages = countUnvisitedImages;
- }
public List<Image> getUnvisitedImages() {
return unvisitedImages;
@@ -283,7 +263,6 @@
public void visitImage(Image image) {
if (unvisitedImages.contains(image)) {
unvisitedImages.remove(image);
- countUnvisitedImages--;
}
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -54,7 +54,7 @@
@Temporal(TemporalType.TIMESTAMP)
private Date date;
- @ManyToOne
+ @ManyToOne(optional=false)
@JoinColumn(name = "IMAGE_COMMENT_ID", referencedColumnName = "IMAGE_ID")
//TODO nick - add @NotNull
private Image image;
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -89,7 +89,7 @@
private String name;
@Transient
//TODO nick - remove this
- private Boolean covering;
+ private boolean covering;
@Column(length = 1024, nullable = false)
@NotNull
@@ -237,8 +237,12 @@
throw new IllegalArgumentException("Null comment");
}
//TODO nick - check that comments belongs to "this" image
- comment.setImage(null);
- comments.remove(comment);
+ if(comment.getImage().equals(this)){
+ comment.setImage(null);
+ comments.remove(comment);
+ }else{
+ throw new IllegalArgumentException("Comment not belongs to this image");
+ }
}
public List<Comment> getComments() {
@@ -263,9 +267,7 @@
if (s.length() >= 2) {
s.delete(s.length() - 2, s.length());
}
-
- String string = s.toString();
- return string;
+ return s.toString();
}
public void setMeta(String meta) {
@@ -358,15 +360,6 @@
this.covering = covering;
}
- public boolean containTag(String s) {
- for (MetaTag t : imageTags) {
- if (t.getTag().equals(s)) {
- return true;
- }
- }
- return false;
- }
-
public MetaTag getTagByName(String s) {
for (MetaTag t : imageTags) {
if (t.getTag().equals(s)) {
@@ -376,7 +369,6 @@
return null;
}
-
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -51,7 +51,7 @@
@Column(length = 255, nullable = false)
@NotNull
@NotEmpty
- @Length(min = 3)
+ @Length(min = 3, max=50)
//TODO nick - meta tags should not contain ',', add constraint
private String tag;
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -29,7 +29,7 @@
@Entity
@Name("shelf")
@Scope(ScopeType.CONVERSATION)
-@Table(name = "shelfs")
+@Table(name = "shelves")
//TODO nick - rename table to "shelves"
//TODO nick - should we store this in conversation?
public class Shelf implements Serializable {
@@ -44,7 +44,7 @@
@Column(length = 255, nullable = false)
@NotNull
@NotEmpty
- @Length(min = 3)
+ @Length(min = 3, max = 50)
private String name;
@Column(length = 1024)
@@ -65,10 +65,6 @@
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @Transient
- //TODO nick - == unvisitedImages.size()
- private Long countUnvisitedImages;
-
/**
* Getter for property id
*
@@ -131,9 +127,10 @@
public void addAlbum(Album album) {
if (album == null)
throw new IllegalArgumentException("Null child!");
- if (album.getShelf() != null)
- //TODO nick - use removeChildAlbum()
- album.getShelf().getAlbums().remove(album);
+ if (album.getShelf() != null){
+ //TODO nick - use removeChildAlbum()
+ album.getShelf().removeChildAlbum(album);
+ }
album.setShelf(this);
albums.add(album);
}
@@ -142,13 +139,16 @@
if (album == null)
throw new IllegalArgumentException("Null child!");
//TODO nick - check that shelf is "this"
- album.setShelf(null);
- albums.remove(album);
+ if(album.getShelf().equals(this)){
+ album.setShelf(null);
+ albums.remove(album);
+ }else{
+ throw new IllegalArgumentException("This Shelf not contain this album!");
+ }
}
public int getCountAlbums() {
return this.getAlbums() != null ? this.getAlbums().size() : 0;
-
}
public int getCountImages() {
@@ -184,13 +184,9 @@
}
public Long getCountUnvisitedImages() {
- return countUnvisitedImages;
+ return new Long(unvisitedImages.size());
}
- public void setCountUnvisitedImages(Long countUnvisitedImages) {
- this.countUnvisitedImages = countUnvisitedImages;
- }
-
public List<Image> getUnvisitedImages() {
return unvisitedImages;
}
@@ -202,7 +198,6 @@
public void visitImage(Image image) {
if (unvisitedImages.contains(image)) {
unvisitedImages.remove(image);
- countUnvisitedImages--;
}
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -28,7 +28,6 @@
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
@@ -45,6 +44,7 @@
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;
import org.jboss.seam.annotations.Scope;
@@ -67,6 +67,7 @@
@Entity
@Scope(ScopeType.CONVERSATION)
@Name("user")
+@AutoCreate
@Role(name="selectedUser", scope=ScopeType.CONVERSATION)
@Table(name = "Users", uniqueConstraints = {
@UniqueConstraint(columnNames = "login"),
@@ -121,18 +122,8 @@
@NotNull
private Sex sex;
- //TODO nick - this should be persistent, right?
- private Boolean doNotShowMail;
-
- private Boolean informAboutNews;
-
private Boolean hasAvatar;
- @OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL}, fetch = FetchType.LAZY)
- @org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
- @org.hibernate.annotations.OrderBy(clause = "NAME asc")
- private List<Album> albums = new ArrayList<Album>();
-
@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL})
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
@@ -194,31 +185,8 @@
public Long getId() {
return id;
}
-
- public List<Album> getAlbums() {
- return albums;
- }
//---------------------------Business methods
-
- //TODO nick - do we really need this? we can just aggregate data from all albums
- public void addAlbum(Album album) {
- if (album == null) {
- throw new IllegalArgumentException("Null album!");
- }
- //TODO nick - remove album from the previous user?
- album.setOwner(this);
- albums.add(album);
- }
-
- public void removeAlbum(Album album) {
- if (album == null) {
- throw new IllegalArgumentException("Null album");
- }
- //TODO nick - check if owner is current user?
- album.setOwner(null);
- albums.remove(album);
- }
public void addShelf(Shelf shelf) {
if (shelf == null) {
@@ -234,12 +202,12 @@
throw new IllegalArgumentException("Null shelf");
}
//TODO nick - check if owner is current user?
- shelf.setOwner(null);
- //TODO nick - why to remove albums?
- for(Album a : shelf.getAlbums()){
- removeAlbum(a);
+ if(shelf.getOwner().equals(this)){
+ shelf.setOwner(null);
+ shelfs.remove(shelf);
+ }else{
+ throw new IllegalArgumentException("Shelf not belonfs to this user!");
}
- shelfs.remove(shelf);
}
public String getConfirmPassword() {
@@ -270,22 +238,6 @@
this.sex = sex;
}
- public Boolean getDoNotShowMail() {
- return doNotShowMail;
- }
-
- public void setDoNotShowMail(Boolean doNotShowMail) {
- this.doNotShowMail = doNotShowMail;
- }
-
- public Boolean getInformAboutNews() {
- return informAboutNews;
- }
-
- public void setInformAboutNews(Boolean informAboutNews) {
- this.informAboutNews = informAboutNews;
- }
-
public Boolean getHasAvatar() {
return hasAvatar;
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -44,46 +44,31 @@
@In(value="entityManager")
EntityManager em;
- //TODO nick - do we need @Out here?
- @In @Out
- private User user;
+ @In FlushStrategy flushStrategy;
- public void addAlbum(Album album, boolean isFlushNeeded) {
+ public void addAlbum(Album album) {
em.persist(album);
- user.addAlbum(album);
album.getShelf().addAlbum(album);
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
- public void deleteAlbum(Album album, boolean isFlushNeeded){
+ public void deleteAlbum(Album album){
if(album.getShelf()!=null){
album.getShelf().removeChildAlbum(album);
- album.getShelf().setCountUnvisitedImages(null);
album.getShelf().setUnvisitedImages(null);
- }else{
- user.removeAlbum(album);
}
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
- public void editAlbum(Album album, boolean isFlushNeeded){
- if(isFlushNeeded){
+ public void editAlbum(Album album){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
-
- public void flush(){
- em.flush();
- }
-
- public Long getCountUnvisitedImages(Album album){
- //TODO nick - use Shelf/Album.unvisitedImages
- return (Long)em.createQuery("select count(i) from Image i where i.album=:album and i.created >= :date").setParameter("album", album).setParameter("date", getDate()).getSingleResult();
- }
public List<Image> getUnvisitedImages(Album album){
//TODO nick - use Shelf/Album.unvisitedImages
@@ -92,9 +77,9 @@
private Date getDate() {
//TODO nick - use Calendar.getInstance()
- Calendar c = new GregorianCalendar();
+ Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_YEAR, -15);
//TODO nick - return c.getTime()
- return c.getInstance().getTime();
+ return c.getTime();
}
}
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-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -28,16 +28,10 @@
public static final String CLEAR_ERROR_EVENT = "clearErrorEvent";
public static final String ADD_ERROR_EVENT = "addErrorEvent";
- public static final String UPLOAD_ROOT = "uploadRoot";
public static final String SLASH = "/";
public static final String DOT = ".";
- public static final String JPG = "JPG";
public static final String ADD_IMAGE_EVENT = "addImage";
-
- public static final int KB = 1024;
- public static final String FILE_UPLOAD_CLEAR_EVENT = "fileUploadClear";
- public static final String SHOW_FILE_UPLOAD_EVENT = "showFileUpload";
public static final String JPEG = "jpeg";
public static final String MAIN_OUTCOME = "main";
@@ -48,52 +42,17 @@
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 TREE_ID = "tree";
public static final String CLEAR_EDITOR_EVENT = "clearEditor";
-
- public static final String HTTPS = "https://";
- public static final String HTTP = "http://";
- public static final String HTTP_1_0 = "HTTP/1.0";
- public static final String HTTP_1_1 = "HTTP/1.1";
- public static final String PICTURE_FOLDER_PATH = "/picture/";
- public static final String MINI_FORMAT = "_mini";
- public static final String MEDIUM_FORMAT = "_medium";
- public static String URL = "URL";
- public static String HTML = "HTML";
- public static String FORUM = "Forum";
- public static String HTML_PATTERN = "<a href='%s'><img src='%s' border='0'></a>";
- public static String FORUM_PATTERN = "[URL=%s][IMG]%s[/IMG][/URL]";
- public static final String ERROR_PAGE = "/error.seam";
- public static final String IMAGE_JPG = "image/jpg";
- public static final String PATH_PARAMETER = "path";
- public static final String FILE_MANAGER = "fileManager";
- public static final String ENTITY_MANAGER = "entityManager";
- public static final String USER_ID = "userId";
public static final int INITIAL_DELAY = 4000;
public static final int DELAY = 3000;
- public static final String ALBUM_NODE_TYPE = "album";
- public static final String USER_MANAGER = "userManager";
- public static final String USER = "user";
- public static final String TREE_ROOT_NODE_TYPE = "treeRoot";
- public static final String DATASCROLLER_ID = "mainform:imageScroller";
- public static final String DATASCROLLER2_ID = "mainform:slideShowImageScroller";
-
public static final String USER_EXIST_QUERY = "user-exist";
public static final String USER_LOGIN_QUERY = "user-login";
- public static final String PERCENT = "%";
public static final String LOGIN_PARAMETER = "login";
public static final String PASSWORD_PARAMETER = "password";
public static final String USERNAME_PARAMETER = "username";
- public static final String IMAGE_CAMERA_QUERY = "image-camera";
- public static final String USER_USER_QUERY = "user-user";
-
- public static final String ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY = "album-byAlbumNameAndLogin";
- public static final String ALBUM_NAME_PARAMETER = "albumName";
-
private Constants(){
}
Copied: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/FlushStrategy.java (from rev 13202, trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java)
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/FlushStrategy.java (rev 0)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/FlushStrategy.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -0,0 +1,51 @@
+package org.richfaces.realworld.service;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+
+@Name("flushStrategy")
+(a)Scope(ScopeType.APPLICATION)
+@Startup
+public class FlushStrategy {
+
+ public FlushStrategy(){
+ getStrategy();
+ }
+ private static String strategy;
+
+ public String getStrategy() {
+ if(strategy == null){
+ try { InputStream in = this.getClass().getClassLoader()
+ .getResourceAsStream("realworld.properties");
+ if(in != null){
+ Properties p = new Properties();
+ p.load(in);
+ strategy = p.getProperty("flushStrategy");
+ }else{
+ strategy = "database";
+ }
+ } catch (FileNotFoundException e) {
+ strategy = "database";
+ } catch (IOException e) {
+ strategy = "database";
+ }
+ }
+ return strategy;
+ }
+
+
+ //TODO nick - make this a static method
+ public boolean isDatabaseStoreStrategy(){
+ return getStrategy().equals("database");
+ }
+}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -30,17 +30,12 @@
@Local
public interface IAlbumAction {
- public abstract void addAlbum(Album album, boolean isFlushNeeded);
+ public abstract void addAlbum(Album album);
- public void deleteAlbum(Album album, boolean isFlushNeeded);
+ public void deleteAlbum(Album album);
- public void editAlbum(Album album, boolean isFlushNeeded);
+ public void editAlbum(Album album);
- //TODO nick - explicit flush doesn't seem like a good solution
- public abstract void flush();
-
- public Long getCountUnvisitedImages(Album album);
-
public List<Image> getUnvisitedImages(Album album);
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -33,20 +33,20 @@
//TODO nick - remove isFlushNeeded
- public abstract void deleteImage(Image image, boolean isFlushNeeded);
+ public abstract void deleteImage(Image image);
- public abstract void editImage(Image image, boolean isFlushNeeded);
+ public abstract void editImage(Image image);
- public abstract void addImage(Image image, boolean isFlushNeeded);
+ public abstract void addImage(Image image);
- public void deleteComment(Comment comment, boolean isFlushNeeded);
+ public void deleteComment(Comment comment);
- public void addComment(Comment comment, boolean isFlushNeeded);
+ public void addComment(Comment comment);
public abstract MetaTag getTagByName(String tag);
//TODO nick - rename to getPopularTags()
- public abstract List<MetaTag> popularTags();
+ public abstract List<MetaTag> getPopularTags();
public abstract List<MetaTag> getTagsLikeString(String suggest);
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -12,15 +12,13 @@
@Local
public interface IShelfAction {
- public abstract void addShelf(Shelf shelf, boolean isFlushNeeded);
+ public abstract void addShelf(Shelf shelf);
- public void deleteShelf(Shelf shelf, boolean isFlushNeeded);
+ public void deleteShelf(Shelf shelf);
- public void editShelf(Shelf shelf, boolean isFlushNeeded);
+ public void editShelf(Shelf shelf);
public List<Shelf> getShelfs(User user);
-
- public Long getCountUnvisitedImages(Shelf shelf);
public List<Image> getUnvisitedImages(Shelf shelf);
}
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-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -31,11 +31,10 @@
@Local
public interface IUserAction {
public User login(String username, String password);
- public void register(User user, boolean isFlushNeeded);
+ public void register(User user);
public boolean isUserExist(String login);
- public void updateUser(User user, boolean isFlushNeeded);
- public void resetUser(User user, boolean isFlushNeeded);
- public void loginAnonymous();
+ public User updateUser();
+ public User resetUser();
public Long countAlbums(User user);
public Long countImages(User user);
public Long countSharedImages(User u);
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -43,18 +43,20 @@
@In(value = "entityManager")
EntityManager em;
+
+ @In FlushStrategy flushStrategy;
- public void deleteImage(Image image, boolean isFlushNeeded) {
+ public void deleteImage(Image image) {
if(image.getAlbum().getCoveringImage().equals(image)){
image.getAlbum().setCoveringImage(null);
}
image.getAlbum().removeImage(image);
- if (isFlushNeeded) {
+ if (flushStrategy.isDatabaseStoreStrategy()) {
em.flush();
}
}
- public void editImage(Image image, boolean isFlushNeeded) {
+ public void editImage(Image image) {
List<MetaTag> removals = new ArrayList<MetaTag>(image.getImageTags());
String[] tokens = image.getMetaString().split(",");
Set<String> toks = new HashSet<String>();
@@ -62,17 +64,14 @@
toks.add(s.trim());
}
for (String s : toks) {
- if (!image.containTag(s)) {
- MetaTag tag = getTagByName(s);
- if (tag == null) {
+ MetaTag t = image.getTagByName(s);
+ if (t != null) {
//TODO nick - how about concurrent creation of meta tags with the same name?
- tag = new MetaTag();
- tag.setTag(s);
- }
- image.addMetaTag(tag);
- } else {
- MetaTag t = image.getTagByName(s);
removals.remove(t);
+ } else {
+ t = new MetaTag();
+ t.setTag(s);
+ image.addMetaTag(t);
}
}
for (MetaTag tag : removals) {
@@ -84,29 +83,29 @@
image.getAlbum().setCoveringImage(image);
}
}
- if (isFlushNeeded) {
+ if (flushStrategy.isDatabaseStoreStrategy()) {
em.flush();
}
}
- public void addImage(Image image, boolean isFlushNeeded) {
+ public void addImage(Image image) {
em.persist(image);
image.getAlbum().addImage(image);
- if (isFlushNeeded) {
+ if (flushStrategy.isDatabaseStoreStrategy()) {
em.flush();
}
}
- public void deleteComment(Comment comment, boolean isFlushNeeded) {
+ public void deleteComment(Comment comment) {
comment.getImage().removeComment(comment);
- if (isFlushNeeded) {
+ if (flushStrategy.isDatabaseStoreStrategy()) {
em.flush();
}
}
- public void addComment(Comment comment, boolean isFlushNeeded) {
+ public void addComment(Comment comment) {
comment.getImage().addComment(comment);
- if (isFlushNeeded) {
+ if (flushStrategy.isDatabaseStoreStrategy()) {
em.flush();
}
}
@@ -121,7 +120,7 @@
return t;
}
- public List<MetaTag> popularTags() {
+ public List<MetaTag> getPopularTags() {
return em.createQuery("select new MetaTag(m.id, m.tag) from MetaTag m join m.images img group by m.id, m.tag order by count(img) desc").setMaxResults(20).getResultList();
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -45,28 +45,28 @@
@In(value="entityManager")
EntityManager em;
-
+ @In FlushStrategy flushStrategy;
@In @Out
private User user;
- public void addShelf(Shelf shelf, boolean isFlushNeeded) {
+ public void addShelf(Shelf shelf) {
em.persist(shelf);
user.addShelf(shelf);
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
- public void deleteShelf(Shelf shelf, boolean isFlushNeeded){
+ public void deleteShelf(Shelf shelf){
user.removeShelf(shelf);
em.remove(shelf);
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
- public void editShelf(Shelf shelf, boolean isFlushNeeded){
- if(isFlushNeeded){
+ public void editShelf(Shelf shelf){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
@@ -82,11 +82,6 @@
shelfs.addAll(sh);
return shelfs;
}
-
- public Long getCountUnvisitedImages(Shelf shelf){
- //TODO nick - use data from user
- return (Long)em.createQuery("select count(i) from Image i where i.album.shelf=:shelf and i.uploaded > :date").setParameter("shelf", shelf).setParameter("date", getDate()).getSingleResult();
- }
public List<Image> getUnvisitedImages(Shelf shelf){
//TODO nick - use data from user
@@ -95,8 +90,8 @@
private Date getDate() {
//TODO nick - copy-pasted from AlbumAction, see TODOs there
- Calendar c = new GregorianCalendar();
+ Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_YEAR, -15);
- return c.getInstance().getTime();
+ return c.getTime();
}
}
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-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-03-27 11:34:20 UTC (rev 13250)
@@ -28,7 +28,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.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@@ -40,37 +39,37 @@
@In(value="entityManager")
EntityManager em;
-
- @In(create = true, required = true) @Out
+ @In FlushStrategy flushStrategy;
+ @In
private User user;
public User login(String username, String password) {
- return user = (User)em.createNamedQuery(Constants.USER_LOGIN_QUERY)
+ return (User)em.createNamedQuery(Constants.USER_LOGIN_QUERY)
.setParameter(Constants.USERNAME_PARAMETER, username)
.setParameter(Constants.PASSWORD_PARAMETER, password)
.getSingleResult();
}
- public void register(User user, boolean isFlushNeeded) {
+ public void register(User user) {
em.persist(user);
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
}
- public void updateUser(User user, boolean isFlushNeeded) {
- if(isFlushNeeded){
+ public User updateUser() {
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
- this.user = user;
+ return user;
}
- public void resetUser(User user, boolean isFlushNeeded) {
+ public User resetUser() {
em.refresh(user);
- if(isFlushNeeded){
+ if(flushStrategy.isDatabaseStoreStrategy()){
em.flush();
}
- this.user = user;
+ return user;
}
public boolean isUserExist(String login) {
@@ -78,32 +77,28 @@
.setParameter(Constants.LOGIN_PARAMETER, login)
.getResultList().size() != 0;
}
-
- public void loginAnonymous() {
- user = new User();
- }
public List<Album> getSharedAlbums(User user){
- return (List<Album>)em.createQuery("from Album a where a.owner=:user and a.shelf.shared=true").setParameter("user", user).getResultList();
+ return (List<Album>)em.createQuery("from Album a where a.shelf.owner=:user and a.shelf.shared=true").setParameter("user", user).getResultList();
}
public List<Image> getSharedImages(User user){
- return (List<Image>)em.createQuery("from Image i where i.album.owner=:user and i.album.shelf.shared=true").setParameter("user", user).getResultList();
+ return (List<Image>)em.createQuery("from Image i where i.album.shelf.owner=:user and i.album.shelf.shared=true").setParameter("user", user).getResultList();
}
public Long countAlbums(User user){
- return (Long)em.createQuery("select count(a) from Album a where a.owner=:user").setParameter("user", user).getSingleResult();
+ return (Long)em.createQuery("select count(a) from Album a where a.shelf.owner=:user").setParameter("user", user).getSingleResult();
}
public Long countSharedAlbums(User user){
- return (Long)em.createQuery("select count(a) from Album a where a.owner=:user and a.shelf.shared=true").setParameter("user", user).getSingleResult();
+ return (Long)em.createQuery("select count(a) from Album a where a.shelf.owner=:user and a.shelf.shared=true").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();
+ return (Long)em.createQuery("select count(i) from Image i where i.album.shelf.owner=:user").setParameter("user", user).getSingleResult();
}
public Long countSharedImages(User user){
- return (Long)em.createQuery("select count(i) from Image i where i.album.owner=:user and i.album.shelf.shared=true").setParameter("user", user).getSingleResult();
+ return (Long)em.createQuery("select count(i) from Image i where i.album.shelf.owner=:user and i.album.shelf.shared=true").setParameter("user", user).getSingleResult();
}
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-03-27 11:34:00 UTC (rev 13249)
+++ trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-03-27 11:34:20 UTC (rev 13250)
@@ -1,16 +1,16 @@
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, doNotShowMail, informAboutNews, hasAvatar) VALUES (1, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com', 'amarkhel', '8cb2237d0679ca88db6464eac60da96345513964', '1985-01-08', 0, 1, 1, 0);
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, doNotShowMail, informAboutNews, hasAvatar) VALUES (2, 'Nick', 'Curtis', 'nkurtis(a)iba.com', 'Viking', '8cb2237d0679ca88db6464eac60da96345513964', '1978-01-08', 1, 1, 1, 0);
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, doNotShowMail, informAboutNews, hasAvatar) VALUES (3, 'John', 'Smith', 'jsmith(a)jboss.com', 'Noname', '8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08', 1, 1, 1, 0);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, hasAvatar) VALUES (1, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com', 'amarkhel', '8cb2237d0679ca88db6464eac60da96345513964', '1985-01-08', 0, 0);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, hasAvatar) VALUES (2, 'Nick', 'Curtis', 'nkurtis(a)iba.com', 'Viking', '8cb2237d0679ca88db6464eac60da96345513964', '1978-01-08', 1, 0);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate, sex, hasAvatar) VALUES (3, 'John', 'Smith', 'jsmith(a)jboss.com', 'Noname', '8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08', 1, 0);
-INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created, shared) VALUES (1, 'Nature', 'Nature pictures', 1, '2009-12-18', true);
-INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (2, 'Sport', 'Nature pictures', 1, '2009-12-18', false);
-INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (3, 'Water', 'Nature pictures', 2, '2009-12-18', true);
-INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (4, 'Flowers', 'Nature pictures', 3, '2009-12-18', true);
+INSERT INTO shelves(shelf_id, name, description, shelf_user_id, created, shared) VALUES (1, 'Nature', 'Nature pictures', 1, '2009-12-18', true);
+INSERT INTO shelves(shelf_id, name, description, shelf_user_id, created,shared) VALUES (2, 'Sport', 'Nature pictures', 1, '2009-12-18', false);
+INSERT INTO shelves(shelf_id, name, description, shelf_user_id, created,shared) VALUES (3, 'Water', 'Nature pictures', 2, '2009-12-18', true);
+INSERT INTO shelves(shelf_id, name, description, shelf_user_id, created,shared) VALUES (4, 'Flowers', 'Nature pictures', 3, '2009-12-18', true);
---------------------------------------------------------------------
-- ALBUM - Animals
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (0, 'Animals', 'Animals pictures', 1, 1, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (0, 'Animals', 'Animals pictures', 1, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (0, 'Animals');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (0, '067.JPG', 'amarkhel/0/067.JPG', 'Animals - 067.JPG image', '2009-12-18', 0, 'Canon EOS 450D', 1024, 1917, 768, '2009-12-01', true);
@@ -65,7 +65,7 @@
---------------------------------------------------------------------
-- ALBUM - Building
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (1, 'Building', 'Building pictures', 2, 3, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (1, 'Building', 'Building pictures', 3, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (1, 'Building');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (15, '1.jpg', 'Viking/1/1.jpg', 'Building - 1.jpg image', '2009-12-18', 1, 'Canon PowerShot SX110 IS', 1024, 1917, 768, '2009-12-01', true);
@@ -130,7 +130,7 @@
---------------------------------------------------------------------
-- ALBUM - Coasts
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (2, 'Coasts', 'Coasts pictures', 3, 4, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (2, 'Coasts', 'Coasts pictures', 4, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (2, 'Coasts');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (30, '203015.JPG', 'Noname/2/203015.JPG', 'Coasts - 203015.JPG image', '2009-12-18', 2, 'Sony Alpha DSLR-A350', 1024, 1917, 768, '2009-12-01', true);
@@ -194,7 +194,7 @@
---------------------------------------------------------------------
-- ALBUM - Flora
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (3, 'Flora', 'Flora pictures', 1, 2, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (3, 'Flora', 'Flora pictures', 2, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (3, 'Flora');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (45, '132000.JPG', 'amarkhel/3/132000.JPG', 'Flora - 132000.JPG image', '2009-12-18', 3, 'Pentax Optio E40', 1024, 1917, 768, '2009-12-01', true);
@@ -264,7 +264,7 @@
---------------------------------------------------------------------
-- ALBUM - Ices
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (4, 'Ices', 'Ices pictures', 2, 3, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (4, 'Ices', 'Ices pictures', 3, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (4, 'Ices');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (60, '184023.JPG', 'Viking/4/184023.JPG', 'Ices - 184023.JPG image', '2009-12-18', 4, 'BBK DP810', 1024, 1917, 768, '2009-12-01', true);
@@ -359,7 +359,7 @@
---------------------------------------------------------------------
-- ALBUM - Sport
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (5, 'Sport', 'Sport pictures', 3, 4, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (5, 'Sport', 'Sport pictures', 4, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (5, 'Sport');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (80, '23048.JPG', 'Noname/5/23048.JPG', 'Sport - 23048.JPG image', '2009-12-18', 5, 'Canon PowerShot SX110 IS', 1024, 1917, 768, '2009-12-01', true);
@@ -424,7 +424,7 @@
---------------------------------------------------------------------
-- ALBUM - Underwater
---------------------------------------------------------------------
-INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created) VALUES (6, 'Underwater', 'Underwater pictures', 1, 1, '2009-12-18');
+INSERT INTO albums(album_id, name, description, parent_shelf_id, created) VALUES (6, 'Underwater', 'Underwater pictures', 1, '2009-12-18');
INSERT INTO metatags(metatag_id, tag) VALUES (6, 'Underwater');
INSERT INTO images(image_id, name, path, description, created, img_album_id, cameraModel, width, size, height, uploaded, allowComments) VALUES (95, '45000.JPG', 'amarkhel/6/45000.JPG', 'Underwater - 45000.JPG image', '2009-12-18', 6, 'Sony Alpha DSLR-A350', 1024, 1917, 768, '2009-12-01', true);
Added: trunk/test-applications/realworld2/ejb/src/main/resources/realworld.properties
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/resources/realworld.properties (rev 0)
+++ trunk/test-applications/realworld2/ejb/src/main/resources/realworld.properties 2009-03-27 11:34:20 UTC (rev 13250)
@@ -0,0 +1 @@
+flushStrategy=database
\ No newline at end of file
Property changes on: trunk/test-applications/realworld2/ejb/src/main/resources/realworld.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
15 years, 9 months
JBoss Rich Faces SVN: r13249 - in trunk/test-applications/realworld2/web: src/main/java/org/richfaces/realworld/manager and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-27 07:34:00 -0400 (Fri, 27 Mar 2009)
New Revision: 13249
Removed:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java
Modified:
trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF
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/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/RegistrationManager.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/FileUploadBean.java
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/util/DirectLinkHelper.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/components.xml
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumsList.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageEditInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
Log:
Modified: trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF
===================================================================
--- trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF 2009-03-27 11:34:00 UTC (rev 13249)
@@ -2,7 +2,8 @@
Class-Path: avalon-framework-4.1.3.jar commons-beanutils-1.7.0.jar com
mons-digester-2.0.jar commons-logging-1.1.jar jboss-seam-debug-2.1.0.
SP1.jar jboss-seam-jul-2.1.0.SP1.jar jboss-seam-remoting-2.1.0.SP1.ja
- r jboss-seam-ui-2.1.0.SP1.jar jsf-facelets-1.1.14.jar junit-3.8.jar l
- og4j-1.2.14.jar logkit-1.0.1.jar metadata-extractor-2.4.0-beta1.jar r
- ichfaces-impl-3.3.1-SNAPSHOT.jar richfaces-ui-3.3.1-SNAPSHOT.jar
+ r jboss-seam-ui-2.1.0.SP1.jar jhighlight-1.0.jar jsf-facelets-1.1.14.
+ jar junit-3.8.jar log4j-1.2.14.jar logkit-1.0.1.jar metadata-extracto
+ r-2.4.0-beta1.jar richfaces-impl-3.3.1-SNAPSHOT.jar richfaces-ui-3.3.
+ 1-SNAPSHOT.jar
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -33,8 +33,8 @@
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.util.FlushStrategy;
@Name("albumManager")
@Scope(ScopeType.CONVERSATION)
@@ -44,7 +44,6 @@
private static final long serialVersionUID = 2631634926126857691L;
private String oncomplete = ";";
- @In FlushStrategy flushStrategy;
@In private IAlbumAction albumAction;
@In(create=true, required=true) @Out
@@ -61,7 +60,7 @@
facesMessages.add("Shelf must be not-null", null);
return;
}
- albumAction.addAlbum(album, flushStrategy.isDatabaseStoreStrategy());
+ albumAction.addAlbum(album);
addDirectory();
model.resetModel(model.getMainArea(), model.getSelectedUser(), model.getSelectedShelf(), album, null);
Events.instance().raiseEvent("albumAdded");
@@ -75,7 +74,7 @@
}
public void editAlbum(Album album){
- albumAction.editAlbum(album, flushStrategy.isDatabaseStoreStrategy());
+ albumAction.editAlbum(album);
model.resetModel(NavigationEnum.ALBUM_PREVIEW, model.getSelectedUser(), model.getSelectedShelf(), album, null);
Events.instance().raiseEvent("albumEdited");
}
@@ -83,7 +82,7 @@
public void deleteAlbum(Album album){
//Update domain model
String string = album.getId().toString();
- albumAction.deleteAlbum(album, flushStrategy.isDatabaseStoreStrategy());
+ albumAction.deleteAlbum(album);
deleteDirectory(string);
model.resetModel(NavigationEnum.ALL_ALBUMS, model.getSelectedUser(), model.getSelectedShelf(), null, null);
Events.instance().raiseEvent("albumDeleted");
@@ -91,8 +90,7 @@
}
public Long getCountUnvisitedImages(Album album){
- if(album.getCountUnvisitedImages() == null){
- album.setCountUnvisitedImages(albumAction.getCountUnvisitedImages(album));
+ if(album.getCountUnvisitedImages() == 0){
album.setUnvisitedImages(albumAction.getUnvisitedImages(album));
}
return album.getCountUnvisitedImages();
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -31,6 +31,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.Conversation;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
@@ -62,6 +63,7 @@
@In Identity identity;
+ @Out(required=false) User user;
@In Credentials credentials;
@In FacesMessages facesMessages;
@@ -73,7 +75,7 @@
@In FileManager fileManager;
- @In(create=true) @Out Model model;
+ @In @Out Model model;
public String login(){
if(identity.hasRole("admin")){
@@ -98,12 +100,11 @@
{
if (wantLoginAnonymous()) {
identity.addRole(Constants.GUEST_ROLE);
- userAction.loginAnonymous();
model.setMainArea(NavigationEnum.ANONYM);
return true;
}
try {
- User user = userAction.login(credentials.getUsername(), passwordHolder.hash(credentials.getPassword()));
+ user = userAction.login(credentials.getUsername(), passwordHolder.hash(credentials.getPassword()));
if (user != null) {
identity.addRole(Constants.ADMIN_ROLE);
model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null);
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -151,19 +151,15 @@
model.resetModel(NavigationEnum.USER_SHARED_IMAGES, user, null, null, null);
}
- public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.getShelf().isShared();
- }
-
public boolean isUserShelf(Shelf shelf){
- return shelf.getOwner()!=null && shelf.getOwner().getId().equals(user.getId());
+ 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().equals(user);
+ return album.getOwner().getLogin().equals(user.getLogin());
}
public void showUser(User user){
@@ -175,7 +171,7 @@
}
public void showUnvisitedImages(Album album){
- model.resetModel(NavigationEnum.ALBUM_UNVISITED, album.getOwner(), album.getShelf(), album, null);
+ model.resetModel(NavigationEnum.ALBUM_UNVISITED, album.getShelf().getOwner(), album.getShelf(), album, null);
}
public void showTag(MetaTag metatag){
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -31,8 +31,8 @@
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;
-import org.richfaces.realworld.util.FlushStrategy;
@Name("dndManager")
public class DnDManager implements DropListener {
@@ -40,7 +40,6 @@
@In User user;
@In FileManager fileManager;
@In IAlbumAction albumAction;
- @In FlushStrategy flushStrategy;
public void processDrop(DropEvent dropEvent) {
Dropzone dropzone = (Dropzone) dropEvent.getComponent();
@@ -57,31 +56,10 @@
}
}
- /*private void addTreeToRerender() {
- try {
- FacesContext fc = FacesContext.getCurrentInstance();
- AjaxContext ac = AjaxContext.getCurrentInstance();
- UIComponent destTree = fc.getViewRoot().findComponent(Constants.TREE_ID);
- ac.addComponentToAjaxRender(destTree);
- } catch (Exception e) {
- System.err.print(e.getMessage());
- }
- }*/
-
private void handleAlbum(Album dragValue, Shelf dropValue) {
- if(dragValue.getShelf() != null ){
- if(dragValue.getShelf().equals(dropValue)){
- //Parent album contain this album
- return;
- }else{
- dropValue.addAlbum(dragValue);
- if(flushStrategy.isDatabaseStoreStrategy()){
- albumAction.flush();
- }
- Events.instance().raiseEvent("clearTree");
- }
- }
- //addTreeToRerender();
+ dropValue.addAlbum(dragValue);
+ albumAction.editAlbum(dragValue);
+ Events.instance().raiseEvent("clearTree");
}
private void handleImage(Image dragValue, Album dropValue) {
@@ -91,9 +69,7 @@
String newPath = getNewPathOfImage(dragValue, dropValue);
dragValue.setPath(newPath);
dropValue.addImage(dragValue);
- if(flushStrategy.isDatabaseStoreStrategy()){
- albumAction.flush();
- }
+ albumAction.editAlbum(dropValue);
}
private String getNewPathOfImage(Image dragValue, Album dropValue) {
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -26,6 +26,7 @@
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.service.Constants;
import javax.imageio.ImageIO;
@@ -231,16 +232,61 @@
file.mkdirs();
}
- public boolean addImage(String fileName, String tempFilePath) {
- createDirectoryIfNotExist(fileName);
- writeFile(fileName, tempFilePath, _SMALL80, 80, true);
- writeFile(fileName, tempFilePath, _SMALL120, 120, true);
- writeFile(fileName, tempFilePath, _SMALL160, 160, true);
- writeFile(fileName, tempFilePath, _MINI, 150, true);
- writeFile(fileName, tempFilePath, _MEDIUM, 600, true);
- return true;
- }
+ public boolean saveAvatar(String path, User user) {
+ return writeFile("/" + user.getLogin() +
+ "/avatar.jpg", path, "", 80, true);
+ }
+ public void renameImage(String fileNameOld, String fileNameNew) {
+ createDirectoryIfNotExist(fileNameNew);
+ renameImage(getFileByPath(fileNameNew), getFileByPath(fileNameOld));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _MEDIUM)),
+ getFileByPath(transformPath(fileNameOld, _MEDIUM)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL80)),
+ getFileByPath(transformPath(fileNameOld, _SMALL80)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL120)),
+ getFileByPath(transformPath(fileNameOld, _SMALL120)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL160)),
+ getFileByPath(transformPath(fileNameOld, _SMALL160)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL200)),
+ getFileByPath(transformPath(fileNameOld, _SMALL200)));
+ }
+
+
+ public void deleteImage(String fileName) {
+ deleteImage(getFileByPath(fileName));
+ deleteImage(getFileByPath(transformPath(fileName, _MEDIUM)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL80)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL120)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL160)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL200)));
+ }
+
+ public boolean addImage(String fileName, String tempFilePath) {
+ createDirectoryIfNotExist(fileName);
+ if(!writeFile(fileName, tempFilePath, _SMALL80, 80, true)){
+ return false;
+ }
+ if(!writeFile(fileName, tempFilePath, _SMALL120, 120, true)){
+ return false;
+ }
+ if(!writeFile(fileName, tempFilePath, _SMALL160, 160, true)){
+ return false;
+ }
+ if(!writeFile(fileName, tempFilePath, _SMALL200, 200, true)){
+ return false;
+ }
+ if(!writeFile(fileName, tempFilePath, _MEDIUM, 600, true)){
+ return false;
+ }
+ return true;
+ }
+
public static BufferedImage bitmapToImage(String data, String format) throws IOException {
final InputStream inb = new FileInputStream(data);
final ImageReader rdr = ImageIO.getImageReadersByFormatName(format).next();
@@ -332,13 +378,12 @@
return ret;
}
- public void writeFile(String newFileName, String fileName, String pattern, int size, boolean includeUploadRoot) {
+ public boolean writeFile(String newFileName, String fileName, String pattern, int size, boolean includeUploadRoot) {
BufferedImage bsrc = null;
try {
bsrc = bitmapToImage(fileName, "JPG");
} catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ return false;
}
final int i = bsrc.getWidth() > bsrc.getHeight() ? bsrc.getWidth() : bsrc.getHeight();
final double d = ((double) size) / i;
@@ -349,9 +394,9 @@
try {
imageToBitmap(bdest, dest, "JPG");
} catch (IOException ex) {
- // TODO Auto-generated catch block
- ex.printStackTrace();
+ return false;
}
+ return true;
}
public String transformPath(String target, String substitute) {
@@ -360,15 +405,6 @@
return begin + substitute + end;
}
- public void deleteImage(String fileName) {
- deleteImage(getFileByPath(fileName));
- deleteImage(getFileByPath(transformPath(fileName, _MINI)));
- deleteImage(getFileByPath(transformPath(fileName, _MEDIUM)));
- deleteImage(getFileByPath(transformPath(fileName, _SMALL80)));
- deleteImage(getFileByPath(transformPath(fileName, _SMALL120)));
- deleteImage(getFileByPath(transformPath(fileName, _SMALL160)));
- }
-
private void deleteImage(File file) {
if (file.exists()) {
file.delete();
@@ -380,26 +416,6 @@
return path.substring(i);
}
- public void renameImage(String fileNameOld, String fileNameNew) {
- createDirectoryIfNotExist(fileNameNew);
- renameImage(getFileByPath(fileNameNew), getFileByPath(fileNameOld));
-
- renameImage(getFileByPath(transformPath(fileNameNew, _MINI)),
- getFileByPath(transformPath(fileNameOld, _MINI)));
-
- renameImage(getFileByPath(transformPath(fileNameNew, _MEDIUM)),
- getFileByPath(transformPath(fileNameOld, _MEDIUM)));
-
- renameImage(getFileByPath(transformPath(fileNameNew, _SMALL80)),
- getFileByPath(transformPath(fileNameOld, _SMALL80)));
-
- renameImage(getFileByPath(transformPath(fileNameNew, _SMALL120)),
- getFileByPath(transformPath(fileNameOld, _SMALL120)));
-
- renameImage(getFileByPath(transformPath(fileNameNew, _SMALL160)),
- getFileByPath(transformPath(fileNameOld, _SMALL160)));
- }
-
private void renameImage(File fileNew, File fileOld) {
if (fileNew.exists()) {
fileNew.delete();
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -36,9 +36,9 @@
import org.richfaces.realworld.domain.MetaTag;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IImageAction;
import org.richfaces.realworld.util.DirectLinkHelper;
-import org.richfaces.realworld.util.FlushStrategy;
@Name("imageManager")
@Scope(ScopeType.CONVERSATION)
@@ -47,9 +47,6 @@
@In
IImageAction imageAction;
-
- @In
- FlushStrategy flushStrategy;
@In
FileManager fileManager;
@@ -60,26 +57,23 @@
@In
private User user;
- @In
- private DirectLinkHelper directLink;
-
public void deleteImage(Image image) {
String imagePath = image.getPath();
model.resetModel(NavigationEnum.ALBUM_PREVIEW, image.getAlbum().getOwner(), image.getAlbum().getShelf(), image.getAlbum(), null);
- imageAction.deleteImage(image, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.deleteImage(image);
fileManager.deleteImage(imagePath);
Events.instance().raiseEvent("imageDeleted");
}
public void editImage(Image image) {
- imageAction.editImage(image, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.editImage(image);
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT, NavigationEnum.ALBUM_IMAGE_PREVIEW);
Events.instance().raiseEvent("imageEdited");
}
@Observer(Constants.ADD_IMAGE_EVENT)
public void addImage(Image image) {
- imageAction.addImage(image, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.addImage(image);
model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW, model.getSelectedUser(), model.getSelectedShelf(), image.getAlbum(), image);
Events.instance().raiseEvent("imageAdded");
}
@@ -97,20 +91,16 @@
comment.setImage(image);
comment.setDate(new Date());
comment.setMessage(message);
- imageAction.addComment(comment, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.addComment(comment);
Events.instance().raiseEvent(Constants.CLEAR_EDITOR_EVENT, "");
}
public void deleteComment(Comment comment) {
- imageAction.deleteComment(comment, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.deleteComment(comment);
}
- public String getImageDirectLink(Image image) {
- return directLink.getDirectImageLink(image.getId());
- }
-
public List<MetaTag> popularTags() {
- return imageAction.popularTags();
+ return imageAction.getPopularTags();
}
public List<MetaTag> autoComplete(Object suggest) {
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -16,15 +16,13 @@
import org.jboss.seam.security.Identity;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IUserAction;
import org.richfaces.realworld.ui.PasswordHolder;
-import org.richfaces.realworld.util.FlushStrategy;
@Name("registerManager")
@Scope(ScopeType.CONVERSATION)
public class RegistrationManager {
-
- @In FlushStrategy flushStrategy;
@In("#{messages['user.exist']}") private String USER_WITH_THIS_LOGIN_ALREADY_EXIST;
@@ -47,7 +45,7 @@
return "";
}
user.setPasswordHash(passwordHolder.hash(user.getPassword()));
- userAction.register(user, flushStrategy.isDatabaseStoreStrategy());
+ userAction.register(user);
return "index";
}
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -36,8 +36,8 @@
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IShelfAction;
-import org.richfaces.realworld.util.FlushStrategy;
@Name("shelfManager")
@Scope(ScopeType.CONVERSATION)
@@ -56,9 +56,6 @@
private String oncomplete = ";";
- @In
- FlushStrategy flushStrategy;
-
@In @Out
Model model;
@@ -71,7 +68,7 @@
}
public void addShelf(Shelf shelf) {
- shelfAction.addShelf(shelf, flushStrategy.isDatabaseStoreStrategy());
+ shelfAction.addShelf(shelf);
model.resetModel(model.getMainArea(), model.getSelectedUser(), shelf, null, null);
setOncomplete();
Events.instance().raiseEvent("clearTree");
@@ -82,7 +79,7 @@
}
public void editShelf(Shelf shelf) {
- shelfAction.editShelf(shelf, flushStrategy.isDatabaseStoreStrategy());
+ shelfAction.editShelf(shelf);
model.resetModel(NavigationEnum.SHELF_PREVIEW, model.getSelectedUser(), shelf, null, null);
}
@@ -92,7 +89,7 @@
for (Album a : shelf.getAlbums()) {
directoriesToDelete.add(user.getLogin() + "/" + a.getId());
}
- shelfAction.deleteShelf(shelf, flushStrategy.isDatabaseStoreStrategy());
+ shelfAction.deleteShelf(shelf);
deleteDirectories(directoriesToDelete);
model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null);
Events.instance().raiseEvent("clearTree");
@@ -127,8 +124,7 @@
}
public Long getCountUnvisitedImages(Shelf shelf) {
- if (shelf.getCountUnvisitedImages() == null) {
- shelf.setCountUnvisitedImages(shelfAction.getCountUnvisitedImages(shelf));
+ if (shelf.getCountUnvisitedImages() == 0) {
shelf.setUnvisitedImages(shelfAction.getUnvisitedImages(shelf));
}
return shelf.getCountUnvisitedImages();
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -23,6 +23,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Date;
@@ -41,8 +42,8 @@
import org.richfaces.realworld.manager.Model;
import org.richfaces.realworld.manager.NavigationEnum;
import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IImageAction;
-import org.richfaces.realworld.util.FlushStrategy;
import com.drew.imaging.jpeg.JpegMetadataReader;
import com.drew.imaging.jpeg.JpegProcessingException;
@@ -67,7 +68,6 @@
private String FILE_SAVE_ERROR;
@In IImageAction imageAction;
- @In FlushStrategy flushStrategy;
@In @Out
FileWrapper fileWrapper;
@@ -85,7 +85,6 @@
public synchronized void listener(UploadEvent event) throws Exception {
UploadItem item = event.getUploadItem();
Image image = constructImage(item);
- //fileManager.writeFile(item.getFile().getPath(), item.getFile().getPath(), "_mini", 100, false);
try {
extractMetadata(item, image);
} catch (JpegProcessingException e1) {
@@ -102,15 +101,20 @@
}
String newPath = "/" +model.getSelectedAlbum().getOwner().getLogin() + "/" + model.getSelectedAlbum().getId() + "/" +item.getFileName();
image.setPath(newPath);
- fileWrapper.getFiles().add(0, image);
+
//TODO nick - file manager should be protected from another users accessing images of another people
if(!fileManager.addImage(newPath, item.getFile().getPath())){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_SAVE_ERROR));
+ item.getFile().delete();
+ return;
}
+ fileWrapper.getFiles().add(0, image);
//TODO nick - what's the point of storing image if image file save failed?
- imageAction.addImage(image, flushStrategy.isDatabaseStoreStrategy());
+ imageAction.addImage(image);
Events.instance().raiseEvent("imageAdded");
item.getFile().delete();
+ image.getAlbum().getUnvisitedImages().add(image);
+ image.getAlbum().getShelf().getUnvisitedImages().add(image);
}
private Image constructImage(UploadItem item) {
@@ -124,7 +128,7 @@
}
private void extractMetadata(UploadItem item, Image image)
- throws JpegProcessingException, MetadataException, FileNotFoundException {
+ throws JpegProcessingException, MetadataException, IOException {
InputStream in = new FileInputStream(item.getFile());
//TODO nick - close "in"?
Metadata metadata = JpegMetadataReader.readMetadata(in);
@@ -133,6 +137,7 @@
setupCameraModel(image, exifDirectory);
setupDimensions(image, exifDirectory, jpgDirectory);
setupCreatedDate(image, exifDirectory);
+ in.close();
}
private void setupCreatedDate(Image image, Directory exifDirectory)
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-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -3,9 +3,7 @@
*/
package org.richfaces.realworld.ui;
-import java.awt.image.BufferedImage;
import java.io.File;
-import java.io.IOException;
import javax.faces.model.SelectItem;
@@ -21,9 +19,10 @@
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.manager.FileManager;
import org.richfaces.realworld.manager.Model;
+import org.richfaces.realworld.manager.NavigationEnum;
import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.service.FlushStrategy;
import org.richfaces.realworld.service.IUserAction;
-import org.richfaces.realworld.util.FlushStrategy;
/**
* @author Andrey Markavtsov
@@ -34,12 +33,9 @@
public class UserPrefsHelper {
@In IUserAction userAction;
-
@In FileManager fileManager;
- @In FlushStrategy flushStrategy;
- //TODO nick - not used anywhere
- @In(create=true) @Out Model model;
- @In User user;
+ @In @Out Model model;
+ @In @Out User user;
Boolean avatarModalOpened = false;
@@ -54,31 +50,27 @@
public void uploadAvatar(UploadEvent event) {
UploadItem item = event.getUploadItem();
avatarData = item.getFile();
- //TODO nick - persist user?
- user.setHasAvatar(true);
}
//TODO nick - are we saving current user?
- public void saveUser(User user){
+ public void saveUser(){
if (avatarData != null) {
- try {
- BufferedImage image = fileManager.bitmapToImage(avatarData.getPath(),"JPG" );
- //TODO nick - use fileManager methods to access user image
- fileManager.imageToBitmap(image, fileManager.getUploadRoot().getCanonicalPath()+ "/" + user.getLogin() +
- "/avatar.jpg", "JPG");
- } catch (IOException e) {
+ if(!fileManager.saveAvatar(avatarData.getPath(), user)){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("File IO Error"));
+ return;
}
avatarData.delete();
avatarData = null;
user.setHasAvatar(true);
}
- userAction.updateUser(user, flushStrategy.isDatabaseStoreStrategy());
+ user = userAction.updateUser();
+ model.resetModel(NavigationEnum.ALL_SHELFS, user, model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage());
}
public void cancel() {
- //TODO nick - restore value of user.hasAvatar?
+ user = userAction.resetUser();
avatarData = null;
+ model.resetModel(NavigationEnum.ALL_SHELFS, user, model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage());
}
public SelectItem [] getSexs () {
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -85,7 +85,7 @@
id=imageId;
}
- public String getDirectImageLink(Long id) {
+ public String getDirectImageLink(Image image) {
if (imageDirectLinkPrefix == null) {
FacesContext context = FacesContext.getCurrentInstance();
if (context == null) {
@@ -109,6 +109,6 @@
}
}
}
- return imageDirectLinkPrefix + id;
+ return imageDirectLinkPrefix + image.getId();
}
}
\ No newline at end of file
Deleted: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java 2009-03-27 11:34:00 UTC (rev 13249)
@@ -1,42 +0,0 @@
-package org.richfaces.realworld.util;
-
-import javax.faces.context.FacesContext;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
-@Name("flushStrategy")
-(a)Scope(ScopeType.APPLICATION)
-@AutoCreate
-public class FlushStrategy {
-
- private String strategy;
-
- public String getStrategy() {
- if(strategy == null){
- FacesContext fc = FacesContext.getCurrentInstance();
- if (fc != null) {
- String initParameter = fc.getExternalContext().getInitParameter(
- "storeStrategy");
- if(initParameter.equals("conversation") || initParameter.equals("database")){
- strategy = initParameter;
- }else{
- throw new RuntimeException("Wrong storeStrategy context parameter. It should be 'conversation' or 'database'");
- }
-
- }
- }
- return strategy;
- }
-
- public void setStrategy(String strategy) {
- this.strategy = strategy;
- }
-
- //TODO nick - make this a static method
- public boolean isDatabaseStoreStrategy(){
- return getStrategy().equals("database");
- }
-}
Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/components.xml 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/components.xml 2009-03-27 11:34:00 UTC (rev 13249)
@@ -21,8 +21,6 @@
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.0.xsd">
<core:init transaction-management-enabled="false" debug="true" jndi-pattern="@jndiPattern@"/>
- <web:context-filter url-pattern="/picture/*"/>
- <web:character-encoding-filter encoding="UTF-8" override-client="true" url-pattern="*.seam"/>
<core:manager concurrent-request-timeout="20000"
conversation-timeout="120000"
conversation-id-parameter="cid"
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumsList.xhtml
===================================================================
(Binary files differ)
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/image/imageEditInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml 2009-03-27 10:44:18 UTC (rev 13248)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml 2009-03-27 11:34:00 UTC (rev 13249)
@@ -10,7 +10,7 @@
<h:panelGrid cellpadding="0">
<h:panelGroup>
<a4j:commandLink
- rendered="#{controller.isAccessToAlbumGranted(album)}"
+ rendered="#{controller.isUserAlbum(album)}"
actionListener="#{controller.showAlbum(album)}"
reRender="mainArea, tree">
<a4j:mediaOutput rendered="#{!album.isEmpty()}" id="img" element="img"
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/userPrefs.xhtml
===================================================================
(Binary files differ)
15 years, 9 months
JBoss Rich Faces SVN: r13248 - trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-03-27 06:44:18 -0400 (Fri, 27 Mar 2009)
New Revision: 13248
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/inplaceSelectTest.xhtml
Log:
fix custom events processing
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/inplaceSelectTest.xhtml
===================================================================
(Binary files differ)
15 years, 9 months
JBoss Rich Faces SVN: r13247 - trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-03-27 06:43:23 -0400 (Fri, 27 Mar 2009)
New Revision: 13247
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceSelectTestBean.java
Log:
add reset methods
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2009-03-27 10:42:38 UTC (rev 13246)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2009-03-27 10:43:23 UTC (rev 13247)
@@ -101,5 +101,10 @@
this.iiValue = iiValue;
}
+ public void reset() {
+ this.text ="";
+ this.newText = "";
+ this.iiValue = "test";
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceSelectTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceSelectTestBean.java 2009-03-27 10:42:38 UTC (rev 13246)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceSelectTestBean.java 2009-03-27 10:43:23 UTC (rev 13247)
@@ -137,4 +137,22 @@
this.isNumberValue = isNumberValue;
}
+ public void reset() {
+
+ this.treeItems = new ArrayList<SelectItem>();
+
+ this.treeNames = Arrays.asList("Pine", "Birch", "Aspen", "Spruce", "Oak", "Maple", "Ash", "Lime", "test", "999");
+
+ this.tree = "";
+
+ this.isValue = "test";
+
+ this.isNumberValue = "999";
+
+ this.newValue = null;
+
+ for (String treeName : treeNames) {
+ treeItems.add(new SelectItem(treeName, treeName));
+ }
+ }
}
15 years, 9 months
JBoss Rich Faces SVN: r13246 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-03-27 06:42:38 -0400 (Fri, 27 Mar 2009)
New Revision: 13246
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java
Log:
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2009-03-27 10:30:55 UTC (rev 13245)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2009-03-27 10:42:38 UTC (rev 13246)
@@ -37,8 +37,6 @@
private static final String INPLACE_INPUT_FIELD_POSTFIX = "tempValue";
- private final static String EVENT_TEST_RESULT_FAILED_TEXT = "No";
-
private final static String EVENT_TEST_RESULT_PASSED_TEXT = "Passed";
private static final String INPLACE_INPUT_PAGE = "inplaceInputTest.xhtml";
@@ -47,10 +45,17 @@
private static final String DEFAULTLABEL_AND_SPACES_PAGE_ID_PREFIX = "_dfas";
+ private static final String PROCESSING_INVALID_VALUE_PAGE = "testProcessingInvalidValue.xhtml";
+
+ private static final String PROCESSING_INVALID_VALUE_ID_PREFIX = "_tpiv";
+
+ private final static String INPLACE_INPUT_RESET_METHOD = "#{inplaceInputBean.reset}";
+
+
@Test
public void testInplaceInputComponentLayout(Template template) {
setTestUrl(INPLACE_INPUT_PAGE);
- renderPage(template);
+ renderPage(template, INPLACE_INPUT_RESET_METHOD);
writeStatus("Check component layout");
String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
@@ -69,21 +74,20 @@
@Test
public void testInplaceInputClientAPI(Template template) {
setTestUrl(INPLACE_INPUT_PAGE);
- renderPage(template);
+ renderPage(template,INPLACE_INPUT_RESET_METHOD);
writeStatus("Check component client API");
}
@Test
public void testInplaceInputEvents(Template template) {
setTestUrl(INPLACE_INPUT_PAGE);
- renderPage(template);
+ renderPage(template, INPLACE_INPUT_RESET_METHOD);
writeStatus("Check component event triggering");
String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
String inplaceInputDOk = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_OK;
- String inplaceInputDCancel = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_CANCEL;
writeStatus("Click first component being tested");
@@ -101,6 +105,7 @@
selenium.doubleClick(inplaceInputD);
AssertTextEquals(inplaceInputD + "_edit", EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
+
type(inplaceInputSInput, "Hello");
writeStatus("Stop editing second component being tested");
@@ -113,7 +118,7 @@
@Test
public void testInplaceInputKeyAttributes(Template template) {
setTestUrl(INPLACE_INPUT_PAGE);
- renderPage(template);
+ renderPage(template, INPLACE_INPUT_RESET_METHOD);
String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
@@ -137,7 +142,7 @@
@Test
public void testInplaceInputComponentCore(Template template) {
setTestUrl(INPLACE_INPUT_PAGE);
- renderPage(template);
+ renderPage(template, INPLACE_INPUT_RESET_METHOD);
String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
@@ -187,9 +192,27 @@
CommonUtils.getFailedTestMessage(iid));
typeAndCheck(iid, " ", "defaultLabel");
- //typeAndCheck(iid, "test", "test");
}
+/**
+ * Component displays submitted value after
+ * submission of invalid value
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testProcessingInvalidValue(Template template) {
+ setTestUrl(PROCESSING_INVALID_VALUE_PAGE);
+ init(template);
+
+ String iid = inplaceId + PROCESSING_INVALID_VALUE_ID_PREFIX;
+ String newValue = "Aspen";
+ setValue(iid, newValue);
+ clickAjaxCommandAndWait(buttonId + PROCESSING_INVALID_VALUE_ID_PREFIX);
+ String value = getTextById(iid);
+ Assert.assertTrue(value.endsWith(newValue));
+ }
+
@Override
public void setTestUrl(String testUrl) {
this.testUrl = "pages/inplaceInput/" + testUrl;
@@ -202,9 +225,9 @@
iTempValuePx = "tempValue";
}
- protected void setValue(String id, String newValue) {
- selenium.runScript("($('" + id + "')).component.setValue(\"\", {value: \""+ newValue + "\"})");
- //type(id, newValue);
+ @Override
+ protected void renderPage(Template template) {
+ renderPage(template,INPLACE_INPUT_RESET_METHOD);
}
@Override
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java 2009-03-27 10:30:55 UTC (rev 13245)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java 2009-03-27 10:42:38 UTC (rev 13246)
@@ -21,40 +21,47 @@
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.testng.util.CommonUtils;
import org.testng.Assert;
import org.testng.annotations.Test;
public class InplaceSelectTest extends InplacesTest {
+ private final String INPLACE_SELECT_PAGE = "inplaceSelectTest.xhtml";
+
+ private final String INPLACE_SELECT_RESET_METHOD = "#{inplaceSelectBean.reset}";
+
@Test
public void testInplaceSelectComponent(Template template) {
- renderPage(template);
-
+
+ setTestUrl(INPLACE_SELECT_PAGE);
+
+ renderPage(template, INPLACE_SELECT_RESET_METHOD);
+
String parentId = getParentId() + "_form:";
String inplaceSelectId = parentId + "inplaceSelect";
String okButton = parentId + "inplaceSelect" + "ok";
- //String inplaceTmpValueElemId = parentId + "inplaceSelect" + "inplaceTmpValue";
String cancelButton = parentId + "inplaceSelect" + "cancel";
- String popupId = "list" + inplaceSelectId;
+ String popupId = inplaceSelectId + "list";
writeStatus("click the component");
clickById(inplaceSelectId);
- Assert.assertFalse(isVisibleById(popupId), "Component pop-up should not show up on solitary click");
+ Assert.assertFalse(isVisible(popupId), "Component pop-up should not show up on solitary click");
writeStatus("double click the component");
selenium.doubleClick(inplaceSelectId);
- Assert.assertTrue(isVisibleById(popupId), "Component pop-up should show up on double click");
+ Assert.assertTrue(isVisible(popupId), "Component pop-up should show up on double click");
writeStatus("Check that controls buttons are present");
- Assert.assertTrue(isPresentById(okButton));
- Assert.assertTrue(isPresentById(cancelButton));
+ Assert.assertTrue(isPresent(okButton));
+ Assert.assertTrue(isPresent(cancelButton));
writeStatus("Select second element"); //Birch
- selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId + "']/span[2]");
+ selenium.mouseMove("xpath=//div[@id='" + inplaceSelectId + "list" + "']/span[2]");
selenium.mouseDown(okButton);
writeStatus("Check that a new element is selected");
@@ -65,7 +72,7 @@
selenium.doubleClick(inplaceSelectId);
- selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId + "']/span[3]");
+ selenium.mouseMove("xpath=//div[@id='" + inplaceSelectId + "list']/span[3]");
selenium.mouseDown(cancelButton);
writeStatus("Cancel selected value.");
@@ -73,31 +80,47 @@
writeStatus("Verify javascript event triggering");
- runScript("theLatestEvent='undefined'");
-
writeStatus("Double click the component");
selenium.doubleClick(inplaceSelectId);
- Assert.assertEquals(runScript("theLatestEvent"), "editactivated", "editactivated event has not been triggered");
+ assertEvent("oneditactivated");
writeStatus("Stop editing with ok");
selenium.mouseDown(okButton);
- Assert.assertEquals(runScript("theLatestEvent"), "viewactivated", "viewactivated event has not been triggered");
-
- writeStatus("Stop editing with cancel");
- selenium.mouseDown(cancelButton);
- Assert.assertEquals(runScript("theLatestEvent"), "viewactivated", "viewactivated event has not been triggered");
+ assertEvent("onviewactivated");
+
}
-
- protected void testJSApiSetValue() {
- selenium.getEval("window.inplace.setValue(\"\", {itemValue: \"JSApi\", itemLabel : \"JSApi\"})");
- Assert.assertTrue("JSApi".equals(selenium.getEval("window.inplace.getValue()")));
+
+ @Test
+ public void testJSApi(Template template) {
+ setTestUrl(JS_API_PAGE);
+ init(template);
+
+ String iid = inplaceId + JS_API_ID_PREFIX;
+ Assert.assertTrue("test".equals(getValue(iid)));
+
+ setValue(iid, "999");
+ Assert.assertTrue("999".equals(getValue(iid)));
+
+ setValue(iid, "Aspen");
+ Assert.assertTrue("Aspen".equals(getValue(iid)), CommonUtils.getFailedTestMessage(iid));
+
+ edit(iid);
+
+ selenium.click("xpath=//div[@id='" + iid + "list']/span[4]");
+ cancel(iid);
+ Assert.assertEquals("Aspen".equals(getValue(iid)), CommonUtils.getFailedTestMessage(iid));
}
-
+
@Override
public void setTestUrl(String testUrl) {
this.testUrl = "pages/inplaceSelect/" + testUrl;
}
+
+ @Override
+ protected void renderPage(Template template) {
+ renderPage(template, INPLACE_SELECT_RESET_METHOD);
+ }
public void initIds() {
super.initIds();
@@ -106,7 +129,4 @@
iTempValuePx = "inplaceTmpValue";
}
- protected void setValue(String id, String newValue) {
- selenium.runScript("($('" + id + "')).component.setValue(\"\", {itemValue: \""+ newValue + "\", itemLabel : \"" + newValue + "\"})");
- }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java 2009-03-27 10:30:55 UTC (rev 13245)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java 2009-03-27 10:42:38 UTC (rev 13246)
@@ -20,6 +20,7 @@
*/
package org.richfaces.testng;
+import java.awt.image.renderable.RenderContext;
import java.util.ArrayList;
import java.util.List;
@@ -80,14 +81,10 @@
private static final String VALUE_CHANGE_LISTENER_ID_PREFIX = "_tvcl";
- private static final String PROCESSING_INVALID_VALUE_PAGE = "testProcessingInvalidValue.xhtml";
+ protected static final String JS_API_PAGE = "testJSApi.xhtml";
- private static final String PROCESSING_INVALID_VALUE_ID_PREFIX = "_tpiv";
+ protected static final String JS_API_ID_PREFIX = "_tja";
- private static final String JS_API_PAGE = "testJSApi.xhtml";
-
- private static final String JS_API_ID_PREFIX = "_tja";
-
private static final String RENDERED_ATTRIBUTE_PAGE = "testRenderedAttribute.xhtml";
private static final String RENDERED_ATTRIBUTE_ID_PREFIX = "_tra";
@@ -173,23 +170,6 @@
clickById(iid);
Assert.assertEquals(isVisible(iid + SHOW_CONTROLS_ATTRIBUTE_BAR), false, "showControls='false' but controls are visible");
-// check(!isVisible(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-// delay(1000);
-// String clip = getStyleAttributeString(iid + iTempValuePx, "clip");
-// check(("rect(auto, auto, auto, auto)".equals(clip)) || ("rect(auto auto auto auto)".equals(clip)),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-// //selenium.fireEvent(iid + iTempValuePx, "blur");
-// selenium.focus(buttonId + SHOW_CONTROLS_ATTRIBUTE1_PAGE_ID_PREFIX);
-//
-// delay(1000);
-//
-// clip = getStyleAttributeString(iid + iTempValuePx, "clip");
-// check(("rect(0px, 0px, 0px, 0px)".equals(clip)) || ("rect(0px 0px 0px 0px)".equals(clip)),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
}
/**
@@ -207,21 +187,6 @@
clickById(iid);
Assert.assertEquals(isVisible(iid + SHOW_CONTROLS_ATTRIBUTE_BAR), true, "showControls='true' but controls are not visible");
-
-
-// check(isVisible(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// String clip = getStyleAttributeString(iid + iTempValuePx, "clip");
-// check(("rect(auto, auto, auto, auto)".equals(clip)) || ("rect(auto auto auto auto)".equals(clip)),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-// selenium.focus(buttonId + SHOW_CONTROLS_ATTRIBUTE2_PAGE_ID_PREFIX);
-// clip = getStyleAttributeString(iid + iTempValuePx, "clip");
-// check(("rect(auto, auto, auto, auto)".equals(clip)) || ("rect(auto auto auto auto)".equals(clip)),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
}
/**
@@ -269,7 +234,10 @@
check("Value isn't correct!".equals(getTextById(messageId + VALIDATOR_PAGE_ID_PREFIX + "1")),
CommonUtils.getSuccessfulTestMessage(iid + "1"),
CommonUtils.getFailedTestMessage(iid + "1"));
-
+
+ setValue(iid + "1", "Pine");
+ setValue(iid + "2", "Pine");
+
clickById(buttonId + VALIDATOR_PAGE_ID_PREFIX + "2");
waitForAjaxCompletion();
check("Value isn't correct!".equals(getTextById(messageId + VALIDATOR_PAGE_ID_PREFIX + "2")),
@@ -353,28 +321,6 @@
}
/**
- * Component displays submitted value after
- * submission of invalid value
- *
- * @param template - current template
- */
- @Test
- public void testProcessingInvalidValue(Template template) {
- setTestUrl(PROCESSING_INVALID_VALUE_PAGE);
- init(template);
-
- String iid = inplaceId + PROCESSING_INVALID_VALUE_ID_PREFIX;
- String newValue = "Aspen";
- setValue(iid, newValue);
- clickById(buttonId + PROCESSING_INVALID_VALUE_ID_PREFIX);
- waitForAjaxCompletion();
- String value = getTextById(iid);
- check(value.endsWith(newValue),
- CommonUtils.getSuccessfulTestMessage(iid),
- CommonUtils.getFailedTestMessage(iid));
- }
-
- /**
* Verify JS API of the component
*
* @param template - current template
@@ -383,38 +329,28 @@
public void testJSApi(Template template) {
setTestUrl(JS_API_PAGE);
init(template);
-
+
String iid = inplaceId + JS_API_ID_PREFIX;
-
- selenium.runScript("var inplace = ($('" + iid + "')).component;");
- Assert.assertTrue("test".equals(selenium.getEval("window.inplace.getValue()")));
+ Assert.assertTrue("test".equals(getValue(iid)));
- //testJSApiSetValue();
setValue(iid, "999");
- Assert.assertTrue("999".equals(selenium.getEval("window.inplace.getValue()")));
+ Assert.assertTrue("999".equals(getValue(iid)));
- selenium.getEval("window.inplace.edit()");
- String clip = getStyleAttributeString(iid + iTempValuePx, "clip");
- check(("rect(auto, auto, auto, auto)".equals(clip)) || ("rect(auto auto auto auto)".equals(clip)),
- CommonUtils.getSuccessfulTestMessage(iid),
- CommonUtils.getFailedTestMessage(iid));
-
- setValue(iid, "Aspen");
- Assert.assertEquals("Aspen", getValueById(iid + iTempValuePx), CommonUtils.getFailedTestMessage(iid));
+ setValue(iid, "Aspen");
+ Assert.assertEquals("Aspen", getValue(iid), CommonUtils.getFailedTestMessage(iid));
+
+ edit(iid);
+ type(iid + iTempValuePx, "Test");
+ cancel(iid);
- selenium.click(iid);
- selenium.runScript("document.getElementById('" + iid + iTempValuePx + "').value = '999';");
- selenium.getEval("window.inplace.cancel();");
- Assert.assertEquals("Aspen", getValueById(iid + iTempValuePx), CommonUtils.getFailedTestMessage(iid));
+ Assert.assertEquals("Aspen", getValue(iid), CommonUtils.getFailedTestMessage(iid));
}
- protected void testJSApiSetValue() {
- selenium.getEval("window.inplace.setValue(\"\", {value: \"JSApi\"})");
- Assert.assertTrue("JSApi".equals(selenium.getEval("window.inplace.getValue()")));
- }
+// protected void testJSApiSetValue() {
+// selenium.getEval("window.inplace.setValue(\"\", {value: \"JSApi\"})");
+// Assert.assertTrue("JSApi".equals(selenium.getEval("window.inplace.getValue()")));
+// }
- protected abstract void setValue(String id, String newValue);
-
/**
* Component is present on the page and shows model value
*
@@ -472,7 +408,7 @@
renderPage(template);
initIds();
}
-
+
public void initIds() {
formId = getParentId() + "_form:";
buttonId = formId + "bn";
@@ -486,4 +422,20 @@
public abstract void setTestUrl(String testUrl);
+ protected void setValue(String id, String newValue) {
+ selenium.runScript("$('" + id + "').component.setValue('" + newValue + "')");
+ }
+
+ protected String getValue(String id) {
+ return runScript("$('" + id + "').component.getValue()");
+ }
+
+ protected void edit(String id) {
+ runScript("$('" + id + "').component.edit()");
+ }
+
+ protected void cancel(String id) {
+ runScript("$('" + id + "').component.cancel()");
+ }
+
}
15 years, 9 months
JBoss Rich Faces SVN: r13245 - trunk/test-applications/jsp/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:30:55 -0400 (Fri, 27 Mar 2009)
New Revision: 13245
Modified:
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml 2009-03-27 10:29:56 UTC (rev 13244)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml 2009-03-27 10:30:55 UTC (rev 13245)
@@ -7,4 +7,9 @@
<managed-bean-class>colorPicker.ColorPicker</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>secondPicker</managed-bean-name>
+ <managed-bean-class>ColorPicker.secondPicker</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-03-27 10:29:56 UTC (rev 13244)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-03-27 10:30:55 UTC (rev 13245)
@@ -34,6 +34,6 @@
</converter>
<converter>
<converter-id>colorPickerConverter</converter-id>
- <converter-class>colorPicker.ColorPicker</converter-class>
+ <converter-class>colorPicker.ColorPickerConverter</converter-class>
</converter>
</faces-config>
15 years, 9 months
JBoss Rich Faces SVN: r13244 - trunk/test-applications/jsp/src/main/webapp/CustomizePage.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:29:56 -0400 (Fri, 27 Mar 2009)
New Revision: 13244
Modified:
trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp 2009-03-27 10:29:36 UTC (rev 13243)
+++ trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp 2009-03-27 10:29:56 UTC (rev 13244)
@@ -1,28 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
-<jsp:root version="2.1" xmlns:jsp="http://java.sun.com/JSP/Page"
- xmlns:c="http://java.sun.com/jsp/jstl/core"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:a4j="http://richfaces.org/a4j">
- <jsp:directive.page contentType="text/html;charset=UTF-8"
- pageEncoding="UTF-8" />
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
- <f:view>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <body>
+<f:view>
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <body>
- <h:form id="formID">
-
- </h:form>
+ <h:form id="formID">
+ <rich:messages></rich:messages>
+ <br />
+
+ <rich:colorPicker id="cp" value="#{colorPicker.value}"
+ validator="#{colorPicker.validate}"
+ colorMode="rgb"></rich:colorPicker>
+ <br />
+ <h:commandButton action="submit();" value="Submit"></h:commandButton>
+ <br />
+ <a4j:commandButton value="ReRender" reRender="formID"></a4j:commandButton>
+ <br />
+ <h:outputText value="validatorMessage: "></h:outputText>
+ <br />
+ <h:inputText value="#{colorPicker.validatorMessage}"></h:inputText>
+ <br />
+ <h:outputText value="value: #{colorPicker.value}"></h:outputText>
- </body>
- </html>
+ </h:form>
- </f:view>
-</jsp:root>
+ </body>
+ </html>
+
+</f:view>
+
15 years, 9 months
JBoss Rich Faces SVN: r13243 - in trunk/test-applications/jsp/src/main/webapp/ColorPicker: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:29:36 -0400 (Fri, 27 Mar 2009)
New Revision: 13243
Added:
trunk/test-applications/jsp/src/main/webapp/ColorPicker/images/
trunk/test-applications/jsp/src/main/webapp/ColorPicker/images/colorPicker_ico.png
Modified:
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp 2009-03-27 10:29:04 UTC (rev 13242)
+++ trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp 2009-03-27 10:29:36 UTC (rev 13243)
@@ -5,22 +5,49 @@
<f:subview id="colorPickerSubviewID">
<rich:colorPicker binding="#{colorPicker.component}"
- colorMode="hex" converter="colorPickerConverter"
+ colorMode="#{colorPicker.colorMode}" converter="colorPickerConverter"
converterMessage="#{colorPicker.converterMessage}"
- flat="#{colorPicker.flat}"
- id="colorPickerID" immediate="#{colorPicker.immediate}"
- localValueSet="#{colorPicker.localValueSet}"
- onclick="#{event.onclick}" ondblclick="#{event.ondblclick}"
- onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}"
- onkeyup="#{event.onkeyup}" onmousedown="#{event.onmousedown}"
- onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}"
- onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}"
- rendered="#{colorPicker.rendered}" required="#{colorPicker.required}"
+ flat="#{colorPicker.flat}" id="colorPickerID"
+ immediate="#{colorPicker.immediate}" onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}" onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ rendered="#{colorPicker.rendered and !colorPicker.facets}"
+ required="#{colorPicker.required}"
requiredMessage="#{colorPicker.requiredMessage}"
- showEvent="onmouseover" valid="#{colorPicker.valid}"
+ showEvent="#{colorPicker.showEvent}"
validator="#{colorPicker.validate}"
validatorMessage="#{colorPicker.validatorMessage}"
value="#{colorPicker.value}"
valueChangeListener="#{colorPicker.changeValue}">
</rich:colorPicker>
+
+ <rich:colorPicker colorMode="#{colorPicker.colorMode}" flat="#{colorPicker.flat}"
+ id="colorPickerIDFacets" onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}" onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ rendered="#{colorPicker.rendered and colorPicker.facets}"
+ required="#{colorPicker.required}"
+ requiredMessage="#{colorPicker.requiredMessage}"
+ showEvent="#{colorPicker.showEvent}" validator="#{colorPicker.validate}"
+ validatorMessage="#{colorPicker.validatorMessage}"
+ value="#{colorPicker.facetsValue}"
+ valueChangeListener="#{colorPicker.changeValue}">
+ <f:facet name="icon">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="18px" height="18px"></h:graphicImage>
+ </f:facet>
+ <f:facet name="arrows">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="30px" height="5px"></h:graphicImage>
+ </f:facet>
+ </rich:colorPicker>
+
+
+
</f:subview>
Modified: trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp 2009-03-27 10:29:04 UTC (rev 13242)
+++ trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp 2009-03-27 10:29:36 UTC (rev 13243)
@@ -1,4 +1,4 @@
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+ <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
@@ -8,53 +8,60 @@
action="#{colorPicker.addColorPicker}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="colorMode" />
- <h:selectOneRadio value="#{colorPicker.colorMode}"
- onchange="submit">
+ <h:selectOneRadio value="#{colorPicker.colorMode}">
<f:selectItem itemLabel="rgb" itemValue="rgb" />
<f:selectItem itemLabel="hex" itemValue="hex" />
</h:selectOneRadio>
+ <h:outputText value="showEvent: "></h:outputText>
+ <h:inputText value="#{colorPicker.showEvent}">
+ </h:inputText>
+
<h:outputText value="converterMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.converterMessage}"
- onchange="submit"></h:inputText>
-
+ <h:inputText value="#{colorPicker.converterMessage}">
+ </h:inputText>
+
<h:outputText value="flat" />
- <h:selectBooleanCheckbox value="#{colorPicker.flat}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.flat}">
+ </h:selectBooleanCheckbox>
<h:outputText value="immediate" />
- <h:selectBooleanCheckbox value="#{colorPicker.immediate}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.immediate}">
+ </h:selectBooleanCheckbox>
<h:outputText value="localValueSet" />
- <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}">
+ </h:selectBooleanCheckbox>
<h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{colorPicker.rendered}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.rendered}">
+ </h:selectBooleanCheckbox>
<h:outputText value="required" />
- <h:selectBooleanCheckbox value="#{colorPicker.required}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.required}">
+ </h:selectBooleanCheckbox>
+ <h:outputText value="facets" />
+ <h:selectBooleanCheckbox value="#{colorPicker.facets}">
+ </h:selectBooleanCheckbox>
+
<h:outputText value="requiredMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.requiredMessage}"
- onchange="submit"></h:inputText>
+ <h:inputText value="#{colorPicker.requiredMessage}">
+ </h:inputText>
<h:outputText value="valid" />
- <h:selectBooleanCheckbox value="#{colorPicker.valid}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.valid}">
+ </h:selectBooleanCheckbox>
<h:outputText value="validatorMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.validatorMessage}"
- onchange="submit;"></h:inputText>
+ <h:inputText value="#{colorPicker.validatorMessage}">
+ </h:inputText>
<h:commandButton actionListener="#{colorPicker.checkBinding}"
value="Binding">
<a4j:support event="onclick" reRender="bindLabelID"></a4j:support>
</h:commandButton>
<h:outputText value="#{colorPicker.bindLabel}" id="bindLabelID" />
-
+
</h:panelGrid>
</f:subview>
\ No newline at end of file
Added: trunk/test-applications/jsp/src/main/webapp/ColorPicker/images/colorPicker_ico.png
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/jsp/src/main/webapp/ColorPicker/images/colorPicker_ico.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 9 months