JBoss Rich Faces SVN: r11440 - trunk/test-applications/realworld/web/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-11-28 11:33:38 -0500 (Fri, 28 Nov 2008)
New Revision: 11440
Modified:
trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
Log:
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
16 years, 3 months
JBoss Rich Faces SVN: r11439 - trunk/test-applications/realworld/web/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-11-28 11:32:50 -0500 (Fri, 28 Nov 2008)
New Revision: 11439
Modified:
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
Log:
Modified: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
===================================================================
(Binary files differ)
16 years, 3 months
JBoss Rich Faces SVN: r11438 - in trunk/test-applications/realworld: web/src/main/java/org/richfaces/realworld/util and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-11-28 11:31:04 -0500 (Fri, 28 Nov 2008)
New Revision: 11438
Added:
trunk/test-applications/realworld/web/src/main/webapp/readMessages.xhtml
trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java
trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
Log:
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28 16:00:59 UTC (rev 11437)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28 16:31:04 UTC (rev 11438)
@@ -106,7 +106,7 @@
joinColumns = @JoinColumn(name = "USER1_ID"),
inverseJoinColumns = @JoinColumn(name = "USER2_ID")
)
- private Set<User> friends;
+ private List<User> friends;
@Temporal(TemporalType.TIMESTAMP)
private Date birthDate;
@@ -231,11 +231,11 @@
this.confirmPassword = confirmPassword;
}
- public Set<User> getFriends() {
+ public List<User> getFriends() {
return friends;
}
- public void setFriends(Set<User> friends) {
+ public void setFriends(List<User> friends) {
this.friends = friends;
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java 2008-11-28 16:00:59 UTC (rev 11437)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java 2008-11-28 16:31:04 UTC (rev 11438)
@@ -3,5 +3,5 @@
public enum NavigationEnum {
IMAGE_PREVIEW,
FILE_UPLOAD,
- USER_PREFS,
+ USER_PREFS, SEARCH, READ_MESSAGES,
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java 2008-11-28 16:00:59 UTC (rev 11437)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java 2008-11-28 16:31:04 UTC (rev 11438)
@@ -11,10 +11,14 @@
return NavigationEnum.USER_PREFS;
}
- public NavigationEnum getNavigationEnumImagePreview(){
- return NavigationEnum.IMAGE_PREVIEW;
+ public NavigationEnum getNavigationSearch(){
+ return NavigationEnum.SEARCH;
}
+ public NavigationEnum getNavigationReadMessages(){
+ return NavigationEnum.READ_MESSAGES;
+ }
+
public NavigationEnum getNavigationEnumFileUpload(){
return NavigationEnum.FILE_UPLOAD;
}
Modified: trunk/test-applications/realworld/web/src/main/webapp/index.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/readMessages.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/readMessages.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
16 years, 3 months
JBoss Rich Faces SVN: r11437 - in trunk/test-applications/realworld: ejb/src/main/java/org/richfaces/realworld/service and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-11-28 11:00:59 -0500 (Fri, 28 Nov 2008)
New Revision: 11437
Added:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
trunk/test-applications/realworld/web/src/main/webapp/scripts/
trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml
trunk/test-applications/realworld/ejb/src/main/resources/import.sql
trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/albumModalPanel.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/imagePrefs.xhtml
trunk/test-applications/realworld/web/src/main/webapp/fileUpload.xhtml
trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/template.xhtml
trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
trunk/test-applications/realworld/web/src/main/webapp/register.xhtml
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
trunk/test-applications/realworld/web/src/main/webapp/userPrefs.xhtml
Log:
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -6,7 +6,9 @@
package org.richfaces.realworld.domain;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
@@ -15,12 +17,16 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
@@ -51,10 +57,14 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String name;
@Column(length = 1024)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String description;
/*@OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@@ -81,8 +91,16 @@
@OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
@org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
- private Set<Image> images = new HashSet<Image>();
+ private List<Image> images = new ArrayList<Image>();
+ @ManyToMany
+ @JoinTable(
+ name = "SHARED_ALBUMS",
+ joinColumns = @JoinColumn(name = "ALBUM_ID"),
+ inverseJoinColumns = @JoinColumn(name = "USER_ID")
+ )
+ private List<User> sharedOwners = new ArrayList<User>();
+
/**
* No-arg constructor for JavaBean tools
*/
@@ -234,7 +252,7 @@
return owner;
}
- public Set<Image> getImages() {
+ public List<Image> getImages() {
return images;
}
@@ -252,4 +270,12 @@
public void setChangedName(String changedName) {
this.changedName = changedName;
}
+
+ public List<User> getSharedOwners() {
+ return sharedOwners;
+ }
+
+ public void setSharedOwners(List<User> sharedOwners) {
+ this.sharedOwners = sharedOwners;
+ }
}
Added: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java (rev 0)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,88 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+
+@Entity
+@Name("comment")
+@Table(name = "comments")
+public class Comment implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "COMMENT_ID")
+ private Long id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date date;
+
+ @ManyToOne
+ @JoinColumn(name="IMAGE_COMMENT_ID",
+ referencedColumnName="IMAGE_ID")
+ private Image image;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "FROM_USER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USER_ID")
+ private User author;
+
+ @Column(length = 1024, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String message;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public User getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(User author) {
+ this.author = author;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+}
Property changes on: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -6,10 +6,13 @@
package org.richfaces.realworld.domain;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -18,12 +21,16 @@
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.Version;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
@@ -54,19 +61,29 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String name;
@Column(length = 1024, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String path;
- @org.hibernate.annotations.CollectionOfElements(targetElement = java.lang.String.class)
+ @OneToOne
+ @JoinColumn(name="RANK_ID")
+ private Rank rank;
+
+/* @org.hibernate.annotations.CollectionOfElements(targetElement = java.lang.String.class)
@JoinTable(name = "IMAGE_TAGS", joinColumns = @JoinColumn(name = "IMAGE_ID"))
@Column(name = "TAG", nullable = false)
- private Set<String> tags = new HashSet<String>();
+ private Set<String> tags = new HashSet<String>();*/
@Column(length = 1024)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String description;
@Transient
@@ -78,6 +95,16 @@
@Temporal(TemporalType.TIMESTAMP)
private Date created;
+ @OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
+ @org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
+ @org.hibernate.annotations.OrderBy(clause = "tag asc")
+ private List<MetaTag> tags = new ArrayList<MetaTag>();
+
+ @OneToMany(mappedBy = "image", cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
+ @org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
+ @org.hibernate.annotations.OrderBy(clause="date asc")
+ private List<Comment> comments = new ArrayList<Comment>();
+
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="IMG_ALBUM_ID",
referencedColumnName="ALBUM_ID")
@@ -179,13 +206,13 @@
this.created = created;
}
- public Set<String> getTags() {
+ /*public Set<String> getTags() {
return tags;
}
public void setTags(Set<String> tags) {
this.tags = tags;
- }
+ }*/
public Album getAlbum() {
return album;
@@ -205,4 +232,68 @@
public void setAlbumName(String albumName) {
this.albumName = albumName;
}
+
+ public List<MetaTag> getTags() {
+ return tags;
+ }
+
+ public void setTags(List<MetaTag> tags) {
+ this.tags = tags;
+ }
+
+ //---------------------------Business methods
+
+ public void addMetaTag(MetaTag metaTag) {
+ if (metaTag == null) {
+ throw new IllegalArgumentException("Null metaTag!");
+ }
+ if (metaTag.getParent() != null && !this.equals(metaTag.getParent())) {
+ metaTag.getParent().getTags().remove(metaTag);
+ }
+ metaTag.setParent(this);
+ tags.add(metaTag);
+ }
+
+ public void removeMetaTag(MetaTag metaTag) {
+ if (metaTag == null) {
+ throw new IllegalArgumentException("Null metaTag");
+ }
+ metaTag.setParent(null);
+ tags.remove(metaTag);
+ }
+
+ public void addComment(Comment comment) {
+ if (comment == null) {
+ throw new IllegalArgumentException("Null comment!");
+ }
+ if (comment.getImage() != null && !this.equals(comment.getImage())) {
+ comment.getImage().getComments().remove(comment);
+ }
+ comment.setImage(this);
+ comments.add(comment);
+ }
+
+ public void removeComment(Comment comment) {
+ if (comment == null) {
+ throw new IllegalArgumentException("Null comment");
+ }
+ comment.setImage(null);
+ comments.remove(comment);
+ }
+
+ public List<Comment> getComments() {
+ return comments;
+ }
+
+ public void setComments(List<Comment> comments) {
+ this.comments = comments;
+ }
+
+ public Rank getRank() {
+ return rank;
+ }
+
+ public void setRank(Rank rank) {
+ this.rank = rank;
+ }
}
Added: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java (rev 0)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,86 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+@Entity
+@Name("message")
+@Table(name = "messages")
+public class Message implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "MESSAGE_ID")
+ private Long id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date date;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "AUTHOR_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS_ID")
+ private User author;
+
+ @Column(length = 2000, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String message;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "OWNER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS2_ID")
+ private User owner;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public User getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(User author) {
+ this.author = author;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public User getOwner() {
+ return owner;
+ }
+
+ public void setOwner(User owner) {
+ this.owner = owner;
+ }
+
+}
Property changes on: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java (rev 0)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,60 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Entity
+@Name("metaTag")
+@Table(name = "metatags")
+public class MetaTag implements Serializable{
+ @Id
+ @GeneratedValue
+ @Column(name = "METATAG_ID")
+ private Long id;
+
+ @Column(length = 255, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String tag;
+
+ @ManyToOne
+ @JoinColumn(name="IMAGE_METATAG_ID",
+ referencedColumnName="IMAGE_ID")
+ private Image parent;
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+ public Image getParent() {
+ return parent;
+ }
+
+ public void setParent(Image image) {
+ this.parent = image;
+ }
+}
Property changes on: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java (rev 0)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,69 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.jboss.seam.annotations.Name;
+
+@Entity
+@Name("rank")
+@Table(name = "Ranks")
+public class Rank implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "RANK_ID")
+ private Long id;
+
+ private Long total;
+
+ private Long hits;
+
+ @OneToOne(mappedBy = "rank")
+ private Image image;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getTotal() {
+ return total;
+ }
+
+ public void setTotal(Long total) {
+ this.total = total;
+ }
+
+ public Long getHits() {
+ return hits;
+ }
+
+ public void setHits(Long hits) {
+ this.hits = hits;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ public double getRating() {
+ double total2 = (double)total;
+ double result = total2/hits;
+ BigDecimal x = new BigDecimal(result);
+ x = x.setScale(2, BigDecimal.ROUND_HALF_UP);
+ return x.doubleValue();
+ }
+
+}
Property changes on: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -13,6 +13,9 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@@ -22,7 +25,10 @@
import javax.persistence.Transient;
import javax.persistence.Version;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
+import org.hibernate.validator.Pattern;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -54,35 +60,61 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String firstName;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String secondName;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Pattern(regex=".+@.+\\.[a-z]+", message="Not valid e-mail")
private String email;
@Column(length = 255)
- @NotNull
private String avatarPath;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String login;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String password;
+ @Transient
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String confirmPassword;
+
+ @ManyToMany(mappedBy = "sharedOwners")
+ private List<Album> sharedAlbums = new ArrayList<Album>();
+
+ @ManyToMany
+ @JoinTable(
+ name = "USER_FRIENDS",
+ joinColumns = @JoinColumn(name = "USER1_ID"),
+ inverseJoinColumns = @JoinColumn(name = "USER2_ID")
+ )
+ private Set<User> friends;
+
@Temporal(TemporalType.TIMESTAMP)
private Date birthDate;
@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 Set<Album> childAlbums = new HashSet<Album>();
+ private List<Album> childAlbums = new ArrayList<Album>();
//private Address address;
@@ -152,11 +184,11 @@
return id;
}
- public Set<Album> getChildAlbums() {
+ public List<Album> getChildAlbums() {
return childAlbums;
}
- public void setChildAlbums(Set<Album> childAlbums) {
+ public void setChildAlbums(List<Album> childAlbums) {
this.childAlbums = childAlbums;
}
@@ -190,4 +222,28 @@
album.setOwner(null);
childAlbums.remove(album);
}
+
+ public String getConfirmPassword() {
+ return confirmPassword;
+ }
+
+ public void setConfirmPassword(String confirmPassword) {
+ this.confirmPassword = confirmPassword;
+ }
+
+ public Set<User> getFriends() {
+ return friends;
+ }
+
+ public void setFriends(Set<User> friends) {
+ this.friends = friends;
+ }
+
+ public List<Album> getSharedAlbums() {
+ return sharedAlbums;
+ }
+
+ public void setSharedAlbums(List<Album> sharedAlbums) {
+ this.sharedAlbums = sharedAlbums;
+ }
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -4,6 +4,7 @@
import org.jboss.seam.annotations.Destroy;
import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Image;
public interface IImageAction {
@@ -30,5 +31,9 @@
public abstract void destroy();
public abstract void addImage(Image image);
+
+ public void deleteComment(Comment comment);
+
+ public void addComment(Comment comment);
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -5,6 +5,7 @@
import javax.ejb.Remove;
import org.jboss.seam.annotations.Destroy;
+import org.richfaces.realworld.domain.User;
@Local
public interface IUserAction {
@@ -14,4 +15,10 @@
@Destroy
public void destroy();
+
+ public void register(User user);
+ public boolean isUserExist(String login);
+ public void updateUser(User user);
+
+ public void resetUser(User user);
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -11,6 +11,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@@ -77,4 +78,13 @@
em.persist(image);
em.flush();
}
+
+ public void deleteComment(Comment comment){
+ comment.getImage().removeComment(comment);
+ em.flush();
+ }
+
+ public void addComment(Comment comment){
+
+ }
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -1,5 +1,9 @@
package org.richfaces.realworld.service;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.Stateless;
@@ -14,6 +18,9 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Comment;
+import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@Stateful
@@ -31,7 +38,7 @@
.setParameter("username", username)
.setParameter("password", password)
.getSingleResult();
- return user != null;
+ return user != null;
}
@Remove
@@ -43,4 +50,32 @@
public void destroy(){
}
+
+ public void register(User user) {
+ em.persist(user);
+ this.user = user;
+ }
+
+ public void updateUser(User user) {
+ em.merge(user);
+ em.flush();
+ this.user = user;
+ }
+
+ public void resetUser(User user) {
+ em.refresh(user);
+ em.flush();
+ this.user = user;
+ }
+
+ public boolean isUserExist(String login) {
+ try{
+ User tempuser = (User)em.createQuery("from User u where u.login = :login")
+ .setParameter("login", login)
+ .getSingleResult();
+ }catch(Exception e){
+ return false;
+ }
+ return true;
+ }
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml 2008-11-28 16:00:59 UTC (rev 11437)
@@ -8,11 +8,17 @@
<persistence-unit name="realworld">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/realWorldDatasource</jta-data-source>
- <properties>
+ <!--<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
+ </properties>-->
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.format_sql" value="true"/>
</properties>
</persistence-unit>
Modified: trunk/test-applications/realworld/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-11-28 16:00:59 UTC (rev 11437)
@@ -1,25 +1,79 @@
INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (1, 0, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com', 'avatar.gif', 'amarkhel', '12345', '1985-01-08');
+INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (2, 0, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com', 'avatar.gif', 'root', '12345', '1985-01-08');
+INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (3, 0, 'Andrey', 'Markhel', 'amarkhel(a)exadel.com', 'avatar.gif', 'qqqq', '12345', '1985-01-08');
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (1, 0, 'Album 1', 'Simple Album', true, 1);
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (2, 0, 'Album 2', 'Simple Album 2', false, 1);
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (3, 0, 'Album 3', 'Simple Album 3', false, 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (1, 0, 'Picture 1', 'pic1.jpg', 'Just picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (2, 0, 'Picture 2', 'pic2.jpg', 'Just picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (3, 0, 'Picture 33', 'pic3.jpg', 'Just picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (4, 0, 'Picture 2', 'pic4.jpg', 'Just picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (5, 0, 'Picture 3', 'pic5.jpg', 'Just picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (6, 0, 'Picture 4', 'pic6.jpg', 'Just picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (7, 0, 'Picture 5', 'pic7.jpg', 'Just picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (8, 0, 'Picture 1', 'pic8.jpg', 'Just picture', true, '1985-01-08', 3);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id) VALUES (9, 0, 'Picture 2', 'pic9.jpg', 'Just picture', true, '1985-01-08', 3);
-INSERT INTO image_tags(image_id, tag) VALUES (1, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (1, 'Cool2');
-INSERT INTO image_tags(image_id, tag) VALUES (2, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (3, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (4, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (5, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (6, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool2');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool3');
-INSERT INTO image_tags(image_id, tag) VALUES (8, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (9, 'Cool');
\ No newline at end of file
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (4, 0, 'Album 1', 'Simple Album', true, 2);
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (5, 0, 'Album 2', 'Simple Album 2', false, 2);
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (6, 0, 'Album 3', 'Simple Album 3', false, 2);
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (7, 0, 'Album 1', 'Simple Album', true, 3);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (1, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (2, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (3, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (4, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (5, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (6, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (7, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (8, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (9, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (10, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (11, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (12, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (13, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (14, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (15, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (16, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (17, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (18, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (19, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (20, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (21, 100, 21);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (1, 0, 'Picture 1', 'pic1.jpg', 'Just picture', true, '1985-01-08', 1, 1);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (2, 0, 'Picture 2', 'pic2.jpg', 'Just picture', true, '1985-01-08', 1, 2);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (3, 0, 'Picture 33', 'pic3.jpg', 'Just picture', true, '1985-01-08', 1, 3);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (4, 0, 'Picture 2', 'pic4.jpg', 'Just picture', true, '1985-01-08', 2, 4);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (5, 0, 'Picture 3', 'pic5.jpg', 'Just picture', true, '1985-01-08', 2, 5);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (6, 0, 'Picture 4', 'pic6.jpg', 'Just picture', true, '1985-01-08', 2, 6);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (7, 0, 'Picture 5', 'pic7.jpg', 'Just picture', true, '1985-01-08', 2, 7);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (8, 0, 'Picture 1', 'pic8.jpg', 'Just picture', true, '1985-01-08', 3, 8);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (9, 0, 'Picture 2', 'pic9.jpg', 'Just picture', true, '1985-01-08', 3, 9);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (10, 0, 'Picture 1', 'pic1.jpg', 'Just picture', true, '1985-01-08', 4, 10);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (11, 0, 'Picture 2', 'pic2.jpg', 'Just picture', true, '1985-01-08', 4, 11);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (12, 0, 'Picture 33', 'pic3.jpg', 'Just picture', true, '1985-01-08', 4, 12);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (13, 0, 'Picture 2', 'pic4.jpg', 'Just picture', true, '1985-01-08', 5, 13);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (14, 0, 'Picture 3', 'pic5.jpg', 'Just picture', true, '1985-01-08', 5, 14);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (15, 0, 'Picture 4', 'pic6.jpg', 'Just picture', true, '1985-01-08', 5, 15);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (16, 0, 'Picture 5', 'pic7.jpg', 'Just picture', true, '1985-01-08', 5, 16);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (17, 0, 'Picture 1', 'pic8.jpg', 'Just picture', true, '1985-01-08', 6, 17);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (18, 0, 'Picture 2', 'pic9.jpg', 'Just picture', true, '1985-01-08', 6, 18);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (19, 0, 'Picture 1', 'pic1.jpg', 'Just picture', true, '1985-01-08', 7, 19);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (20, 0, 'Picture 2', 'pic2.jpg', 'Just picture', true, '1985-01-08', 7, 20);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (21, 0, 'Picture 33', 'pic3.jpg', 'Just picture', true, '1985-01-08', 7, 21);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (1, 'Cool', 1);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (2, 'Cool2', 1);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (3, 'Cool', 2);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (4, 'Cool', 3);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (5, 'Cool', 4);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (6, 'Cool', 5);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (7, 'Cool', 6);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (8, 'Cool', 7);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (9, 'Cool', 8);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (10, 'Cool', 9);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (11, 'Cool', 10);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (12, 'Cool', 11);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (13, 'Cool', 12);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (14, 'Cool', 13);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (15, 'Cool', 14);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (16, 'Cool', 15);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (17, 'Cool', 16);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (18, 'Cool', 17);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (19, 'Cool', 18);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (20, 'Cool', 19);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (21, 'Cool', 20);
+INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES (1, '1985-01-08', 'Hello I am user', 1, 2);
+INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES (2, '1985-01-08', 'Hello I am user2', 1, 3);
+INSERT INTO messages(message_id, date, message, author_id, owner_id) VALUES (1, '1985-01-08', 'Hello I am user', 2, 1);
+INSERT INTO shared_albums(album_id, user_id) VALUES(4, 1);
+INSERT INTO shared_albums(album_id, user_id) VALUES(7, 1);
+INSERT INTO user_friends(user1_id, user2_id) VALUES(1, 2);
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-11-28 16:00:59 UTC (rev 11437)
@@ -7,14 +7,14 @@
<datasources>
<local-tx-datasource>
<jndi-name>realWorldDatasource</jndi-name>
- <!-- <connection-url>jdbc:postgresql://localhost:5432/realworld</connection-url>
+ <connection-url>jdbc:postgresql://localhost:5432/realworld</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>realworld</user-name>
- <password>realworld</password>-->
- <connection-url>jdbc:hsqldb:.</connection-url>
+ <password>realworld</password>
+ <!--<connection-url>jdbc:hsqldb:.</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
- <password></password>
+ <password></password>-->
</local-tx-datasource>
</datasources>
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -1,20 +1,26 @@
package org.richfaces.realworld.fileupload;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
+import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@Name("avatarUpload")
+(a)Scope(ScopeType.PAGE)
public class AvatarUpload {
-
- @In @Out
- private User user;
@In(create=true)
private FileManager fileManager;
@@ -24,22 +30,14 @@
private boolean autoUpload = false;
public void avatarListener(UploadEvent event){
- //UploadItem item = event.getUploadItem();
- //System.out.println("File : '" + item.getFileName() + "' was uploaded");
- //try {
UploadItem item = event.getUploadItem();
FileItem file = new FileItem();
file.setLength(item.getData().length);
- file.setName(item.getFileName());
+ Image image = new Image();
+ image.setName(item.getFileName());
+ file.setImage(image);
file.setData(item.getData());
this.setAvatarItem(file);
- //fileManager.deleteAllFromDirectory(user.getLogin()+fileManager.getFileSeparator()+"avatars");
- //fileManager.addImage(user.getLogin()+fileManager.getFileSeparator()+normaliseFileName(item.getFileName()), item.getData());
- //user.setAvatarPath(normaliseFileName(item.getFileName()));
- //} catch (Exception e) {
- // TODO: handle exception
- //facesMessages.add("Error during fileUpload");
- //}
}
public synchronized void paintAvatar(OutputStream stream, Object object) throws IOException {
@@ -48,6 +46,52 @@
public boolean isAutoUpload() {
return autoUpload;
}
+
+ /*public FileItem loadAvatar(User user){
+ FileItem file = new FileItem();
+ file.setName(user.getAvatarPath());
+ File image = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() + "avatars"+ fileManager.getFileSeparator() + user.getAvatarPath());
+ InputStream paintData = null;
+ byte[] data = new byte[(int)image.length() - 1];
+ FileInputStream fileInputStream = null;
+ BufferedInputStream bufferedInputStream = null;
+ if (image != null) {
+ try {
+ fileInputStream = new FileInputStream(image);
+ bufferedInputStream = new BufferedInputStream(fileInputStream);
+ paintData = bufferedInputStream;
+ paintData.read(data);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ try {
+ fileInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ bufferedInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ paintData.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ file.setData(data);
+ return file;
+ }*/
public void setAutoUpload(boolean autoUpload) {
this.autoUpload = autoUpload;
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -1,9 +1,10 @@
package org.richfaces.realworld.fileupload;
+import org.richfaces.realworld.domain.Image;
+
public class FileItem {
- private String Name;
- private String mime;
+ private Image image = new Image();
private boolean selected;
private long length;
private byte[] data;
@@ -13,27 +14,7 @@
public void setData(byte[] data) {
this.data = data;
}
- public String getName() {
- return Name;
- }
- public void setName(String name) {
- Name = name;
- int extDot = name.lastIndexOf('.');
- if(extDot > 0){
- String extension = name.substring(extDot +1);
- if("bmp".equals(extension)){
- mime="image/bmp";
- } else if("jpg".equals(extension)){
- mime="image/jpeg";
- } else if("gif".equals(extension)){
- mime="image/gif";
- } else if("png".equals(extension)){
- mime="image/png";
- } else {
- mime = "image/unknown";
- }
- }
- }
+
public long getLength() {
return length;
}
@@ -41,13 +22,16 @@
this.length = length;
}
- public String getMime(){
- return mime;
- }
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
+ public Image getImage() {
+ return image;
+ }
+ public void setImage(Image image) {
+ this.image = image;
+ }
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -55,7 +55,7 @@
@In
TreeSelectionManager treeSelectionManager;
- @In
+ @In(create=true)
TreeActionManager treeActionManager;
@In(create=true)
@@ -82,9 +82,16 @@
UploadItem item = event.getUploadItem();
FileItem file = new FileItem();
file.setLength(item.getData().length);
- file.setName(item.getFileName());
file.setData(item.getData());
file.setSelected(false);
+ Image image = new Image();
+ image.setCreated(new Date());
+ image.setDescription("Sample Description");
+ image.setName("Sample Name");
+ image.setPath(item.getFileName());
+ image.setAlbumName(treeSelectionManager.getSelectedAlbum().getName());
+ image.setAlbum(treeSelectionManager.getSelectedAlbum());
+ file.setImage(image);
files.add(file);
}
@@ -104,21 +111,14 @@
for(FileItem file:files){
if(file.isSelected()){
//Save file to disk
- String fileName = user.getLogin() + fileManager.getFileSeparator() + treeSelectionManager.getSelectedAlbumItem().getAlbum().getName() + fileManager.getFileSeparator() + file.getName();
+ String fileName = user.getLogin() + fileManager.getFileSeparator() + treeSelectionManager.getSelectedAlbum().getName() + fileManager.getFileSeparator() + file.getImage().getPath();
try {
fileManager.addImage(fileName , file.getData());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- //Update domain model
- Image image = new Image();
- image.setCreated(new Date());
- image.setPath(file.getName());
- image.setName("TODO");
- image.setDescription("TODO");
- image.setAlbum(treeSelectionManager.getSelectedAlbumItem().getAlbum());
- treeActionManager.addImage(image);
+ treeActionManager.addImage(file.getImage());
}
}
}
@@ -126,7 +126,7 @@
public void storeAll() {
for(FileItem file:files){
//Save file to disk
- String fileName = user.getLogin() + fileManager.getFileSeparator() + treeSelectionManager.getSelectedAlbumItem().getAlbum().getName() + fileManager.getFileSeparator() + file.getName();
+ String fileName = user.getLogin() + fileManager.getFileSeparator() + treeSelectionManager.getSelectedAlbum().getName() + fileManager.getFileSeparator() + file.getImage().getPath();
try {
fileManager.addImage(fileName , file.getData());
} catch (IOException e) {
@@ -134,13 +134,7 @@
e.printStackTrace();
}
//Update domain model
- Image image = new Image();
- image.setCreated(new Date());
- image.setPath(file.getName());
- image.setName("TODO");
- image.setDescription("TODO");
- image.setAlbum(treeSelectionManager.getSelectedAlbumItem().getAlbum());
- treeActionManager.addImage(image);
+ treeActionManager.addImage(file.getImage());
}
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -1,11 +1,20 @@
package org.richfaces.realworld.session;
+import java.io.IOException;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
+import org.jboss.seam.web.Session;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.fileupload.AvatarUpload;
import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.service.IUserAction;
@@ -23,7 +32,10 @@
@In(create = true)
FileManager fileManager;
-
+
+ @In(create = true)
+ AvatarUpload avatarUpload;
+
/* (non-Javadoc)
* @see org.richfaces.realworld.service.IAuthenticator#authenticate()
*/
@@ -44,4 +56,47 @@
}
return false;
}
+
+ public String register(User user){
+ boolean errorHappened = false;
+ if(!user.getPassword().equals(user.getConfirmPassword())){
+ UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
+ UIComponent component = root.findComponent("register:confirmPassword");
+ FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Confirm Password not equals password" , "Confirm Password not equals password"));
+ errorHappened = true;
+ }
+ if(userAction.isUserExist(user.getLogin())){
+ UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
+ UIComponent component = root.findComponent("register:loginName");
+ FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "User with this login already exist" , "User with this login already exist"));
+ errorHappened = true;
+ }
+ if(errorHappened){
+ return "";
+ }
+ userAction.register(user);
+ if(avatarUpload.getAvatarItem() != null){
+ user.setAvatarPath(avatarUpload.getAvatarItem().getImage().getName());
+ fileManager.deleteDirectory(user.getLogin() + fileManager.getFileSeparator() + "avatars");
+ fileManager.addDirectory(user.getLogin() + fileManager.getFileSeparator() + "avatars");
+ try {
+ fileManager.addImage(user.getLogin() + fileManager.getFileSeparator() + "avatars" + fileManager.getFileSeparator() + user.getAvatarPath(), avatarUpload.getAvatarItem().getData());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return "main";
+ }
+
+ /**
+ * Logout from session.
+ *
+ * @return outcome which redirects to login page.
+ */
+ public void logout() {
+ Session.instance().invalidate();
+ }
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -45,7 +45,8 @@
treeRoot.addAlbumToTree(albumItem);
fileManager.addDirectory(user.getLogin() + fileManager.getFileSeparator() + album.getName());
treeSelectionManager.setSelectedImage(null);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
+
}
public void editAlbum(Album album){
@@ -64,6 +65,7 @@
}
albumAction.editAlbum(album);
treeRoot.updateChild(album);
+
}
public void deleteAlbum(Album album){
@@ -74,7 +76,7 @@
treeRoot.removeChild(album.getId());
fileManager.deleteDirectory(user.getLogin() + fileManager.getFileSeparator() + albumName);
treeSelectionManager.setSelectedImage(null);
- treeSelectionManager.setSelectedAlbumItem(null);
+ treeSelectionManager.setSelectedAlbum(null);
}
public void deleteImage(Image image){
@@ -100,8 +102,8 @@
String fileNameOld = user.getLogin() + fileManager.getFileSeparator() + image.getAlbum().getName() + fileManager.getFileSeparator() + image.getPath();
String fileNameNew = user.getLogin() + fileManager.getFileSeparator() + image.getAlbumName() + fileManager.getFileSeparator() + image.getPath();
fileManager.renameImage(fileNameOld, fileNameNew);
- treeSelectionManager.setSelectedImage(imageItem);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedImage(imageItem.getImage());
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
}else{
TreeImageItem imageItem = (TreeImageItem)parent.getChild(image.getId());
imageItem.setImage(image);
@@ -113,7 +115,7 @@
TreeAlbumItem albumItem = treeRoot.getAlbumByName(image.getAlbumName());
TreeImageItem imageItem = new TreeImageItem(image.getId(),albumItem,image);
albumItem.addChild(image.getId(), imageItem);
- treeSelectionManager.setSelectedImage(imageItem);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedImage(imageItem.getImage());
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
}
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -123,5 +123,4 @@
public List<SelectItem> getAvailableAlbums() {
return availableAlbums;
}
-
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -30,6 +30,8 @@
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeRowKey;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.util.NavigationEnum;
@@ -44,31 +46,31 @@
private NavigationEnum mainArea = NavigationEnum.IMAGE_PREVIEW;
- private TreeNode selectedImage;
+ private Image selectedImage;
- private TreeAlbumItem selectedAlbumItem;
+ private Album selectedAlbum;
@In(create=true)
FileManager fileManager;
private String nodeTitle;
- public TreeAlbumItem getSelectedAlbumItem() {
- return selectedAlbumItem;
+ public Album getSelectedAlbum() {
+ return selectedAlbum;
}
public void showFileUpload(TreeAlbumItem item){
- this.setSelectedAlbumItem(item);
+ this.setSelectedAlbum(item.getAlbum());
if(item.isLeaf()){
this.setSelectedImage(null);
}else{
- this.setSelectedImage(item.getImages().get(0));
+ this.setSelectedImage(((TreeImageItem)(item.getImages().get(0))).getImage());
}
this.setMainArea(NavigationEnum.FILE_UPLOAD);
}
public void scrollerListener(DataScrollerEvent event) {
- List<TreeNode> images = this.getSelectedAlbumItem().getImages();
+ List<Image> images = this.getSelectedAlbum().getImages();
if (event.getNewScrolVal().equals("previous")) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == this.getSelectedImage()){
@@ -80,9 +82,8 @@
} else if (event.getNewScrolVal().equals("next")) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == this.getSelectedImage()){
- if(images.size() > index + 1){
this.setSelectedImage(images.get(index + 1));
- }
+ return;
}
}
} else if (event.getNewScrolVal().equals("first")) {
@@ -95,15 +96,25 @@
if (null == data) {
return;
}
- File imageResource = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() + this.getSelectedAlbumItem() + fileManager.getFileSeparator() + data.toString());
+ File imageResource = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() + this.getSelectedAlbum().getName() + fileManager.getFileSeparator() + data.toString());
if (imageResource != null) {
- InputStream paintData = new BufferedInputStream(new FileInputStream(imageResource));
+ FileInputStream fileInputStream = new FileInputStream(imageResource);
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
+ InputStream paintData = bufferedInputStream;
if (null == paintData) {
// throw new Exception("");
// TODO
}
+ try{
BufferedImage image = ImageIO.read(paintData);
ImageIO.write(image, "jpeg", out);
+ }catch(Exception e){
+
+ }finally{
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
}
}
@@ -188,37 +199,37 @@
return index;
}
- public void setSelectedAlbumItem(TreeAlbumItem selectedAlbumItem) {
- this.selectedAlbumItem = selectedAlbumItem;
- }
-
- public TreeNode getSelectedImage() {
+ public Image getSelectedImage() {
return selectedImage;
}
- public void setSelectedImage(TreeNode selectedImage) {
+ public void setSelectedImage(Image selectedImage) {
this.selectedImage = selectedImage;
}
+ public void setSelectedAlbum(Album selectedAlbum) {
+ this.selectedAlbum = selectedAlbum;
+ }
+
public Boolean adviseNodeSelected(UITree tree) {
TreeRowKey treeRowKey = (TreeRowKey) tree.getRowKey();
TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
if(treeNode instanceof TreeAlbumItem){
TreeAlbumItem currentNode = (TreeAlbumItem)treeNode;
- if(this.getSelectedAlbumItem() != null){
- return treeNode == this.getSelectedAlbumItem() && null == this.getSelectedImage() ? Boolean.TRUE: Boolean.FALSE;
+ if(this.getSelectedAlbum() != null){
+ return currentNode.getAlbum() == this.getSelectedAlbum() && null == this.getSelectedImage() ? Boolean.TRUE: Boolean.FALSE;
}else{
- this.setSelectedAlbumItem(currentNode);
- if((currentNode).isLeaf()){
+ this.setSelectedAlbum(currentNode.getAlbum());
+ if(currentNode.isLeaf()){
return Boolean.TRUE ;
}else{
- this.setSelectedImage((currentNode).getImages().get(0));
+ this.setSelectedImage(((TreeImageItem)(currentNode.getImages().get(0))).getImage());
return Boolean.FALSE ;
}
}
}else if(treeNode instanceof TreeImageItem){
- return treeNode == this.getSelectedImage() ? Boolean.TRUE : Boolean.FALSE;
+ return ((TreeImageItem)treeNode).getImage() == this.getSelectedImage() ? Boolean.TRUE : Boolean.FALSE;
}
return null;
}
@@ -228,12 +239,12 @@
TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
if(treeNode instanceof TreeAlbumItem){
TreeAlbumItem currentNode = (TreeAlbumItem)treeNode;
- if(this.getSelectedAlbumItem() != null){
- return treeNode == this.getSelectedAlbumItem() ? Boolean.TRUE: Boolean.FALSE;
+ if(this.getSelectedAlbum() != null){
+ return currentNode.getAlbum() == this.getSelectedAlbum() ? Boolean.TRUE: Boolean.FALSE;
}else{
- this.setSelectedAlbumItem(currentNode);
- if(!(currentNode).isLeaf()){
- this.setSelectedImage((currentNode).getImages().get(0));
+ this.setSelectedAlbum(currentNode.getAlbum());
+ if(!currentNode.isLeaf()){
+ this.setSelectedImage(((TreeImageItem)currentNode.getImages().get(0)).getImage());
}
return Boolean.TRUE ;
}
@@ -251,23 +262,26 @@
.getName();
}
TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if (currentNode.isLeaf()) {
- selectedImage = currentNode;
- if(((TreeAlbumItem)currentNode.getParent()) != this.getSelectedAlbumItem()){
- this.setSelectedAlbumItem((TreeAlbumItem)currentNode.getParent());
- }
- return;
- } else {
- if(currentNode == this.getSelectedAlbumItem()){
+ if(currentNode instanceof TreeImageItem){
+ this.setSelectedImage(((TreeImageItem)currentNode).getImage());
+ if(((TreeAlbumItem)currentNode.getParent()).getAlbum() != this.getSelectedAlbum()){
+ this.setSelectedAlbum(((TreeAlbumItem)currentNode.getParent()).getAlbum());
+ }
return;
+ }else if(currentNode instanceof TreeAlbumItem){
+ TreeAlbumItem node = (TreeAlbumItem)currentNode;
+ if (node.isLeaf()) {
+ this.setSelectedImage(null);
+ Album album = node.getAlbum();
+ this.setSelectedAlbum(album);
}else{
- setSelectedAlbumItem((TreeAlbumItem) currentNode);
- if(((TreeAlbumItem) currentNode).isLeaf()){
- this.setSelectedImage(null);
+ if(node.getAlbum() == this.getSelectedAlbum()){
+ return;
}else{
- this.setSelectedImage(((TreeAlbumItem) currentNode).getImages().get(0));
- }
- }
+ setSelectedAlbum(node.getAlbum());
+ this.setSelectedImage(node.getAlbum().getImages().get(0));
+ }
+ }
}
}
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,78 @@
+package org.richfaces.realworld.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.UIRepeat;
+import org.jboss.seam.annotations.Name;
+import org.richfaces.component.html.HtmlInputText;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+
+@Name(value="imageHelper")
+public class ImageHelper {
+
+ HtmlInputText metaRef;
+ private UIRepeat repeater;
+ private Set<Integer> keys = null;
+
+ /**
+ * @return the keys
+ */
+ public Set getKeys() {
+ return keys;
+ }
+
+ /**
+ * @param keys the keys to set
+ */
+ public void setKeys(Set keys) {
+ this.keys = keys;
+ }
+
+ public void setRepeater(UIRepeat repeater) {
+ this.repeater = repeater;
+ }
+
+ public UIRepeat getRepeater() {
+ return repeater;
+ }
+
+ public HtmlInputText getMetaRef() {
+ return metaRef;
+ }
+
+ public void setMetaRef(HtmlInputText metaRef) {
+ this.metaRef = metaRef;
+ }
+
+ public String change(Image image){
+
+ HashSet keys = new HashSet<Integer>();
+ int rowKey = getRepeater().getRowIndex();
+ keys.add(rowKey);
+ setKeys(keys);
+ metaRef.processValidators(FacesContext.getCurrentInstance());
+ metaRef.processUpdates(FacesContext.getCurrentInstance());
+ MetaTag metaTag = new MetaTag();
+ metaTag.setTag(metaRef.getValue().toString());
+ metaTag.setParent(image);
+ image.getTags().add(metaTag);
+ return null;
+ }
+
+ public void addTag(Image image){
+ MetaTag metaTag = new MetaTag();
+ metaTag.setTag("");
+ metaTag.setParent(image);
+ image.getTags().add(metaTag);
+ //image.getMeta().add("");
+ }
+
+ public void removeTag(MetaTag tag, Image image){
+ image.getTags().remove(tag);
+ //image.getMeta().remove(tag);
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/albumModalPanel.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/imagePrefs.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/fileUpload.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/template.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/realworld/web/src/main/webapp/register.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js (rev 0)
+++ trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js 2008-11-28 16:00:59 UTC (rev 11437)
@@ -0,0 +1,13 @@
+
+function storeButtonDisabled(){
+ var nodes = $$('.rich-message-label');
+ var disabled = false;
+ for(var i = 0; i < nodes.length; i++){
+ var node = nodes[i];
+ if(node.innerHTML != ""){
+ disabled = true;
+ break;
+ }
+ }
+ return disabled;
+ }
\ No newline at end of file
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2008-11-28 14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2008-11-28 16:00:59 UTC (rev 11437)
@@ -82,6 +82,7 @@
margin-bottom: 5px;
background-color: #F0F8FF;
font-size: 12px;
+ color: red;
}
.name {
@@ -101,6 +102,7 @@
.error {
float: left;
padding: 5px;
+ color: red;
}
.errors {
color: red;
Modified: trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/userPrefs.xhtml
===================================================================
(Binary files differ)
16 years, 3 months
JBoss Rich Faces SVN: r11436 - trunk/ui/assembly.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-11-28 09:12:17 -0500 (Fri, 28 Nov 2008)
New Revision: 11436
Modified:
trunk/ui/assembly/pom.xml
Log:
Remove tinyMCE xcss from collecting in Assembly
Modified: trunk/ui/assembly/pom.xml
===================================================================
--- trunk/ui/assembly/pom.xml 2008-11-28 13:58:15 UTC (rev 11435)
+++ trunk/ui/assembly/pom.xml 2008-11-28 14:12:17 UTC (rev 11436)
@@ -70,7 +70,7 @@
<!--
<templateXpath>/*[local-name()='template']/*</templateXpath>
-->
- <excludeXcss>**/basic.xcss, **/basic_classes.xcss, **/basic_both.xcss, **/extended.xcss, **/extended_classes.xcss, **/extended_both.xcss, **/skin*.xcss</excludeXcss>
+ <excludeXcss>**/basic.xcss, **/basic_classes.xcss, **/basic_both.xcss, **/extended.xcss, **/extended_classes.xcss, **/extended_both.xcss, **/skin*.xcss, **/tiny_mce/**</excludeXcss>
<commonStyle>org/richfaces/skin.xcss</commonStyle>
</configuration>
<executions>
16 years, 3 months
JBoss Rich Faces SVN: r11435 - trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-28 08:58:15 -0500 (Fri, 28 Nov 2008)
New Revision: 11435
Modified:
trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml
Log:
+context parameter
Modified: trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml 2008-11-28 13:56:14 UTC (rev 11434)
+++ trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml 2008-11-28 13:58:15 UTC (rev 11435)
@@ -59,6 +59,11 @@
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.queue.global.enabled</param-name>
+ <param-value>true</param-value>
</context-param>
<servlet>
16 years, 3 months
JBoss Rich Faces SVN: r11434 - in trunk/test-applications/seamApp/web/src/main/webapp: Queue and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-28 08:56:14 -0500 (Fri, 28 Nov 2008)
New Revision: 11434
Modified:
trunk/test-applications/seamApp/web/src/main/webapp/CustomizePage/CustomizePage.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml
Log:
Queue correction
Modified: trunk/test-applications/seamApp/web/src/main/webapp/CustomizePage/CustomizePage.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/CustomizePage/CustomizePage.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
+++ trunk/test-applications/seamApp/web/src/main/webapp/CustomizePage/CustomizePage.xhtml 2008-11-28 13:56:14 UTC (rev 11434)
@@ -1,37 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:a="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:rich="http://richfaces.org/rich">
- <body>
- <f:view>
- <rich:separator lineType="solid" height="1" />
- <table width="400">
- <tbody>
- <tr>
- <td onmouseover="updateName('Alex')"
- onmouseout="updateName('')">Alex</td>
- <td onmouseover="updateName('Jonh')"
- onmouseout="updateName('')">Jonh</td>
- <td onmouseover="updateName('Roger')"
- onmouseout="updateName('')">Roger</td>
- </tr>
- <tr>
- <td colspan="3"><h:outputText id="showname"
- value="Name: #{userBean.name}" /></td>
- </tr>
- </tbody>
- </table>
- <a4j:form>
- <a4j:jsFunction id="updateName" name="updateName" reRender="showname">
- <a4j:actionparam name="param1" assignTo="#{userBean.name}" />
- </a4j:jsFunction>
- </a4j:form>
+<body>
+<f:view>
+ <h:form id="form">
+ <rich:extendedDataTable value="#{testBean.rows}" var="row">
+ <rich:columns value="#{testBean.columns}" var="column" index="ind">
+ <f:facet name="header">
+ <h:outputText value="#{column.name}" />
+ </f:facet>
+ <h:outputText value="#{row[ind]}" />
+ </rich:columns>
+ </rich:extendedDataTable>
+ <a:commandButton value="Add column" action="#{testBean.addAColumn}" reRender="form" />
+ </h:form>
+</f:view>
+</body>
- <rich:separator height="1" style="padding-top:10px" />
- </f:view>
- </body>
-</ui:composition>
\ No newline at end of file
+</html>
Modified: trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
+++ trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml 2008-11-28 13:56:14 UTC (rev 11434)
@@ -9,7 +9,7 @@
onbeforedomupdate="#{event.onbeforedomupdate}"
oncomplete="#{event.oncomplete}" onerror="#{event.onerror}"
onsizeexceeded="#{event.onsizeexceeded}" onsubmit="#{event.onsubmit}"
- rendered="#{queue.rendered}" requestDelay="#{queue.requestDelay}"
+ requestDelay="#{queue.requestDelay}"
size="#{queue.size}"
sizeExceededBehavior="#{queue.sizeExceededBehavior}"
timeout="#{queue.timeout}" />
Modified: trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
+++ trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml 2008-11-28 13:56:14 UTC (rev 11434)
@@ -3,20 +3,16 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" id="queuePropertySubviewID">
-
- <h:commandButton value="add test"
- action="#{queue.addQueue}"></h:commandButton>
+
+ <h:commandButton value="add test" action="#{queue.addQueue}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="disabled" />
<h:selectBooleanCheckbox value="#{queue.disabled}" onclick="submit()" />
<h:outputText value="ignoreDupResponses" />
<h:selectBooleanCheckbox value="#{queue.ignoreDupResponses}"
- onclick="submit()" />
+ onclick="submit()" />
- <h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{queue.rendered}" onclick="submit()" />
-
<h:outputText value="requestDelay" />
<h:inputText value="#{queue.requestDelay}">
<a4j:support event="onchange" reRender="queueID"></a4j:support>
@@ -27,14 +23,19 @@
<a4j:support event="onchange" reRender="queueID"></a4j:support>
</h:inputText>
- <h:outputText value="sizeExceededBehavior" />
- <h:panelGroup>
- <h:inputText value="#{queue.sizeExceededBehavior}"
- id="sizeExceededBehaviorID">
- <a4j:support event="onchange" reRender="queueID"></a4j:support>
- </h:inputText>
- <h:outputLabel value="dropNext, dropNew, fireNext, fireNew" for="sizeExceededBehaviorID" />
- </h:panelGroup>
+ <h:outputText value="sizeExceededBehavior" />
+ <h:selectOneRadio value="#{queue.sizeExceededBehavior}"
+ onchange="submit();">
+ <f:selectItem itemLabel="dropNext" itemValue="dropNext" />
+ <f:selectItem itemLabel="dropNew" itemValue="dropNew" />
+ <f:selectItem itemLabel="fireNext" itemValue="fireNext" />
+ <f:selectItem itemLabel="fireNew" itemValue="fireNew" />
+ </h:selectOneRadio>
+
+ <h:outputText value="timeout" />
+ <h:inputText value="#{queue.timeout}">
+ <a4j:support event="onchange" reRender="queueID"></a4j:support>
+ </h:inputText>
</h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml 2008-11-28 13:48:57 UTC (rev 11433)
+++ trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/web.xml 2008-11-28 13:56:14 UTC (rev 11434)
@@ -54,7 +54,7 @@
<param-value>true</param-value>
</context-param>
- <!-- JSF -->
+ <!-- JSF -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
16 years, 3 months
JBoss Rich Faces SVN: r11433 - in trunk/test-applications/facelets/src/main: java/queue and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-28 08:48:57 -0500 (Fri, 28 Nov 2008)
New Revision: 11433
Modified:
trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java
trunk/test-applications/facelets/src/main/java/queue/Queue.java
trunk/test-applications/facelets/src/main/webapp/CustomizePage/CustomizePage.xhtml
trunk/test-applications/facelets/src/main/webapp/Queue/Queue.xhtml
trunk/test-applications/facelets/src/main/webapp/Queue/QueueProperty.xhtml
Log:
Queue correction
Modified: trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java 2008-11-28 13:30:10 UTC (rev 11432)
+++ trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java 2008-11-28 13:48:57 UTC (rev 11433)
@@ -1,7 +1,6 @@
package dataScroller;
import java.util.ArrayList;
-import java.util.Random;
import javax.faces.event.ActionEvent;
Modified: trunk/test-applications/facelets/src/main/java/queue/Queue.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/queue/Queue.java 2008-11-28 13:30:10 UTC (rev 11432)
+++ trunk/test-applications/facelets/src/main/java/queue/Queue.java 2008-11-28 13:48:57 UTC (rev 11433)
@@ -1,5 +1,9 @@
package queue;
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
import org.ajax4jsf.component.UIQueue;
import util.componentInfo.ComponentInfo;
@@ -13,7 +17,16 @@
private int size;
private String sizeExceededBehavior;
private int timeout;
+ private ArrayList<SelectItem> behaviors;
+ public ArrayList<SelectItem> getBehaviors() {
+ return behaviors;
+ }
+
+ public void setBehaviors(ArrayList<SelectItem> behaviors) {
+ this.behaviors = behaviors;
+ }
+
public Queue(){
this.disabled = false;
this.ignoreDupResponses = false;
@@ -23,6 +36,12 @@
this.size = 3;
this.sizeExceededBehavior = "dropNext";
this.timeout = 5000;
+
+ behaviors = new ArrayList<SelectItem>();
+ String[] sizeExceededBehaviors = {"dropNext", "dropNew", "fireNext", "fireNew"};
+ for(int i=0; i<sizeExceededBehaviors.length; i++){
+ behaviors.add(new SelectItem(sizeExceededBehaviors[i], sizeExceededBehaviors[i]));
+ }
}
public String addQueue(){
Modified: trunk/test-applications/facelets/src/main/webapp/CustomizePage/CustomizePage.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/CustomizePage/CustomizePage.xhtml 2008-11-28 13:30:10 UTC (rev 11432)
+++ trunk/test-applications/facelets/src/main/webapp/CustomizePage/CustomizePage.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
@@ -5,16 +5,70 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<body>
<f:view>
- <rich:modalPanel minHeight="100" minWidth="100" resizeable="true"
- moveable="true" keepVisualState="false" showWhenRendered="true"
- width="200" height="200">
- <f:facet name="header">
- <h:outputText value="MP Header" />
- </f:facet>
+ <rich:modalPanel id="mpID" showWhenRendered="true">
<h:form>
- <h:commandButton value="submit"/>
+ <f:facet name="header">
+ <h:outputText value="Modal Panel Header" />
+ </f:facet>
+
+ <f:facet name="controls">
+ <h:graphicImage value="/pics/error.gif"
+ onclick="Richfaces.hideModalPanel('mpID'); return false;" />
+ </f:facet>
+
+ <h:inputText value="#{sb.property}" id="text">
+ <f:validateLength minimum="0" maximum="30" />
+ </h:inputText>
+ <rich:suggestionbox id="suggestionBoxId"
+ ajaxSingle="#{sb.ajaxSingle}" bgcolor="#{sb.bgColor}"
+ binding="#{sb.mySuggestionBox}" bypassUpdates="#{sb.bypassUpdates}"
+ cellpadding="#{sb.cellpadding}" cellspacing="#{sb.cellspacing}"
+ dir="#{sb.dir}" entryClass="#{style.entryClass}"
+ eventsQueue="myEventsQueue" fetchValue="#{result.text}"
+ first="#{sb.first}" for="text" frame="#{sb.frame}"
+ frequency="#{sb.frequency}" height="#{sb.height}"
+ ignoreDupResponses="#{sb.ignoreDupResponses}"
+ immediate="#{sb.immediate}" limitToList="false"
+ minChars="#{sb.minchars}" nothingLabel="#{sb.nothingLabel}"
+ onbeforedomupdate="#{event.onbeforedomupdate}"
+ oncomplete="#{event.oncomplete}"
+ onobjectchange="#{event.onobjectchange}"
+ onselect="#{event.onselect}" onsubmit="#{event.onsubmit}"
+ popupStyle="background-color: black;"
+ usingSuggestObjects="#{sb.usingSuggestObjects}" reRender="label"
+ rendered="#{sb.rendered}" requestDelay="#{sb.requestDelay}"
+ selfRendered="#{sb.selfRendered}" var="result"
+ suggestionAction="#{sb.autocomplete}" width="#{sb.width}"
+ border="#{sb.border}" zindex="#{sb.zindex}" rules="#{sb.rules}"
+ tokens="#{sb.tokens}" title="#{result.text}" summary="summary"
+ shadowOpacity="#{sb.shadowOpacity}" shadowDepth="#{sb.shadowDepth}"
+ selectValueClass="mousemove" style="#{style.style}"
+ styleClass="#{style.styleClass}"
+ selectedClass="#{style.selectedClass}"
+ rowClasses="#{style.rowClasses}">
+
+ <h:column>
+ <h:outputText value="#{result.city}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.contry}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.flag}" />
+ </h:column>
+ <h:column>
+ <a4j:htmlCommandLink actionListener="#{sb.selectValue}"
+ value="Click me!" />
+ </h:column>
+ </rich:suggestionbox>
+ <br/>
+ <h:outputLink
+ onclick="Richfaces.hideModalPanel('modalPanelID');return false;">
+ <f:verbatim>Close</f:verbatim>
+ </h:outputLink>
</h:form>
</rich:modalPanel>
</f:view>
Modified: trunk/test-applications/facelets/src/main/webapp/Queue/Queue.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Queue/Queue.xhtml 2008-11-28 13:30:10 UTC (rev 11432)
+++ trunk/test-applications/facelets/src/main/webapp/Queue/Queue.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
@@ -9,7 +9,7 @@
onbeforedomupdate="#{event.onbeforedomupdate}"
oncomplete="#{event.oncomplete}" onerror="#{event.onerror}"
onsizeexceeded="#{event.onsizeexceeded}" onsubmit="#{event.onsubmit}"
- rendered="#{queue.rendered}" requestDelay="#{queue.requestDelay}"
+ requestDelay="#{queue.requestDelay}"
size="#{queue.size}"
sizeExceededBehavior="#{queue.sizeExceededBehavior}"
timeout="#{queue.timeout}" />
Modified: trunk/test-applications/facelets/src/main/webapp/Queue/QueueProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Queue/QueueProperty.xhtml 2008-11-28 13:30:10 UTC (rev 11432)
+++ trunk/test-applications/facelets/src/main/webapp/Queue/QueueProperty.xhtml 2008-11-28 13:48:57 UTC (rev 11433)
@@ -3,20 +3,16 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" id="queuePropertySubviewID">
-
- <h:commandButton value="add test"
- action="#{queue.addQueue}"></h:commandButton>
+
+ <h:commandButton value="add test" action="#{queue.addQueue}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="disabled" />
<h:selectBooleanCheckbox value="#{queue.disabled}" onclick="submit()" />
<h:outputText value="ignoreDupResponses" />
<h:selectBooleanCheckbox value="#{queue.ignoreDupResponses}"
- onclick="submit()" />
+ onclick="submit()" />
- <h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{queue.rendered}" onclick="submit()" />
-
<h:outputText value="requestDelay" />
<h:inputText value="#{queue.requestDelay}">
<a4j:support event="onchange" reRender="queueID"></a4j:support>
@@ -27,14 +23,19 @@
<a4j:support event="onchange" reRender="queueID"></a4j:support>
</h:inputText>
- <h:outputText value="sizeExceededBehavior" />
- <h:panelGroup>
- <h:inputText value="#{queue.sizeExceededBehavior}"
- id="sizeExceededBehaviorID">
- <a4j:support event="onchange" reRender="queueID"></a4j:support>
- </h:inputText>
- <h:outputLabel value="dropNext, dropNew, fireNext, fireNew" for="sizeExceededBehaviorID" />
- </h:panelGroup>
+ <h:outputText value="sizeExceededBehavior" />
+ <h:selectOneRadio value="#{queue.sizeExceededBehavior}"
+ onchange="submit();">
+ <f:selectItem itemLabel="dropNext" itemValue="dropNext"/>
+ <f:selectItem itemLabel="dropNew" itemValue="dropNew"/>
+ <f:selectItem itemLabel="fireNext" itemValue="fireNext"/>
+ <f:selectItem itemLabel="fireNew" itemValue="fireNew"/>
+ </h:selectOneRadio>
+
+ <h:outputText value="timeout" />
+ <h:inputText value="#{queue.timeout}">
+ <a4j:support event="onchange" reRender="queueID"></a4j:support>
+ </h:inputText>
</h:panelGrid>
</f:subview>
\ No newline at end of file
16 years, 3 months
JBoss Rich Faces SVN: r11432 - in trunk/test-applications/jsp/src/main: webapp/CustomizePage and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-28 08:30:10 -0500 (Fri, 28 Nov 2008)
New Revision: 11432
Modified:
trunk/test-applications/jsp/src/main/java/queue/Queue.java
trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp
trunk/test-applications/jsp/src/main/webapp/Queue/Queue.jsp
trunk/test-applications/jsp/src/main/webapp/Queue/QueueProperty.jsp
trunk/test-applications/jsp/src/main/webapp/Queue/QueueStraightforward.jsp
trunk/test-applications/jsp/src/main/webapp/pages/Rich/Rich.jsp
Log:
Queue correction
Modified: trunk/test-applications/jsp/src/main/java/queue/Queue.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/queue/Queue.java 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/java/queue/Queue.java 2008-11-28 13:30:10 UTC (rev 11432)
@@ -1,9 +1,13 @@
package queue;
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
import org.ajax4jsf.component.UIQueue;
import util.componentInfo.ComponentInfo;
-public class Queue {
+public class Queue{
private UIQueue myQueue = null;
private boolean disabled;
private boolean ignoreDupResponses;
@@ -13,6 +17,7 @@
private int size;
private String sizeExceededBehavior;
private int timeout;
+ private ArrayList<SelectItem> behaviors;
public Queue(){
this.disabled = false;
@@ -23,6 +28,12 @@
this.size = 3;
this.sizeExceededBehavior = "dropNext";
this.timeout = 5000;
+
+ behaviors = new ArrayList<SelectItem>();
+ String[] sizeExceededBehaviors = {"dropNext", "dropNew", "fireNext", "fireNew"};
+ for(int i=0;i<sizeExceededBehaviors.length; i++){
+ behaviors.add(new SelectItem(sizeExceededBehaviors[i], sizeExceededBehaviors[i]));
+ }
}
public String addQueue(){
@@ -85,4 +96,12 @@
public void setTimeout(int timeout) {
this.timeout = timeout;
}
+
+ public ArrayList<SelectItem> getBehaviors() {
+ return behaviors;
+ }
+
+ public void setBehaviors(ArrayList<SelectItem> behaviors) {
+ this.behaviors = behaviors;
+ }
}
Modified: trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/webapp/CustomizePage/CustomizePage.jsp 2008-11-28 13:30:10 UTC (rev 11432)
@@ -9,31 +9,22 @@
<head>
</head>
<body>
- <rich:separator lineType="solid" height="1" />
- <table width="400">
- <tbody>
- <tr>
- <td onmouseover="updateName('Alex')" onmouseout="updateName('')">
- Alex</td>
- <td onmouseover="updateName('Jonh')" onmouseout="updateName('')">
- Jonh</td>
- <td onmouseover="updateName('Roger')" onmouseout="updateName('')">
- Roger</td>
- </tr>
- <tr>
- <td colspan="3"><h:outputText id="showname"
- value="Name: #{userBean.name}" /></td>
- </tr>
- </tbody>
- </table>
+ <h:form>
+ <a4j:queue />
+ <a4j:queue />
+ <h:commandButton action="#" value="submit" />
+ <h:panelGrid columns="2">
+ <h:outputLabel for="a4jLodID" value="a4j:log"></h:outputLabel>
+ <h:selectBooleanCheckbox id="a4jLodID" value="#{option.log}"
+ onchange="submit();"></h:selectBooleanCheckbox>
- <a4j:form>
- <a4j:jsFunction id="updateName" name="updateName" reRender="showname">
- <a4j:actionparam name="param1" assignTo="#{userBean.name}" />
- </a4j:jsFunction>
- </a4j:form>
-
- <rich:separator height="1" style="padding-top:10px" />
+ <a4j:status id="a4jStatusID" startText="WORK!"
+ startStyle="color: red;" stopText="a4j:status"></a4j:status>
+ </h:panelGrid>
+ <rich:calendar requestDelay="500" ignoreDupResponses="true"
+ ajaxSingle="true" mode="ajax"></rich:calendar>
+ </h:form>
+ <h:form><a4j:log popup="false" rendered="#{option.log}"></a4j:log></h:form>
</body>
</f:view>
</html>
Modified: trunk/test-applications/jsp/src/main/webapp/Queue/Queue.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Queue/Queue.jsp 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/webapp/Queue/Queue.jsp 2008-11-28 13:30:10 UTC (rev 11432)
@@ -3,7 +3,7 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
-<f:subview id="queueSubviewID">
+<f:subview id="queueSubviewID">
<a4j:queue binding="#{queue.myQueue}"
disabled="#{queue.disabled}"
ignoreDupResponses="#{queue.ignoreDupResponses}"
@@ -11,9 +11,8 @@
onbeforedomupdate="#{event.onbeforedomupdate}"
oncomplete="#{event.oncomplete}"
onerror="#{event.onerror}"
- onsizeexceeded="#{event.onsizeexceeded}"
- onsubmit="#{event.onsubmit}"
- rendered="#{queue.rendered}"
+ onsizeexceeded="alert('onsizeexceeded');"
+ onsubmit="#{event.onsubmit}"
requestDelay="#{queue.requestDelay}"
size="#{queue.size}"
sizeExceededBehavior="#{queue.sizeExceededBehavior}"
Modified: trunk/test-applications/jsp/src/main/webapp/Queue/QueueProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Queue/QueueProperty.jsp 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/webapp/Queue/QueueProperty.jsp 2008-11-28 13:30:10 UTC (rev 11432)
@@ -4,37 +4,34 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="queuePropertySubviewID">
- <h:commandButton value="add test"
- action="#{queue.addQueue}"></h:commandButton>
+ <h:commandButton value="add test" action="#{queue.addQueue}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="disabled" />
<h:selectBooleanCheckbox value="#{queue.disabled}" onclick="submit()" />
<h:outputText value="ignoreDupResponses" />
<h:selectBooleanCheckbox value="#{queue.ignoreDupResponses}"
- onclick="submit()" />
+ onclick="submit()" />
- <h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{queue.rendered}" onclick="submit()" />
-
<h:outputText value="requestDelay" />
<h:inputText value="#{queue.requestDelay}">
- <a4j:support event="onchange" reRender="queueID"></a4j:support>
+ <a4j:support event="onchange" reRender="formID"></a4j:support>
</h:inputText>
<h:outputText value="size" />
<h:inputText value="#{queue.size}">
- <a4j:support event="onchange" reRender="queueID"></a4j:support>
+ <a4j:support event="onchange" reRender="formID"></a4j:support>
</h:inputText>
- <h:outputText value="requestDelay" />
- <h:panelGroup>
- <h:inputText value="#{queue.sizeExceededBehavior}"
- id="sizeExceededBehaviorID">
- <a4j:support event="onchange" reRender="queueID"></a4j:support>
- </h:inputText>
- <h:outputLabel value=" \"dropNext\", \"dropNew\", \"fireNext\", \"fireNew\"" for="sizeExceededBehaviorID" />
- </h:panelGroup>
+ <h:outputText value="sizeExceededBehavior" />
+ <h:selectOneRadio value="#{queue.sizeExceededBehavior}" onchange="submit();">
+ <f:selectItems value="#{queue.behaviors}" />
+ </h:selectOneRadio>
+ <h:outputText value="timeout" />
+ <h:inputText value="#{queue.timeout}" id="timeoutID">
+ <a4j:support event="onchange" reRender="formID"></a4j:support>
+ </h:inputText>
+
</h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/Queue/QueueStraightforward.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Queue/QueueStraightforward.jsp 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/webapp/Queue/QueueStraightforward.jsp 2008-11-28 13:30:10 UTC (rev 11432)
@@ -12,7 +12,7 @@
<h:outputText value="h:inputText" />
<h:inputText value="#{queueComponent.inputValue}" id="inputID">
- <a4j:support id="inputSupport" event="onblur"
+ <a4j:support id="inputSupport" event="onkeyup"
eventsQueue="#{queueComponent.inputQueue}"></a4j:support>
</h:inputText>
@@ -23,7 +23,7 @@
<h:outputText value="rich:calendar" />
<rich:calendar id="calendarID" value="#{queueComponent.calendarValue}"
- eventsQueue="#{queueComponent.calendarQueue}">
+ mode="ajax" reRender="panelID" eventsQueue="#{queueComponent.calendarQueue}">
</rich:calendar>
<h:selectOneMenu value="#{queueComponent.calendarQueue}"
Modified: trunk/test-applications/jsp/src/main/webapp/pages/Rich/Rich.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/pages/Rich/Rich.jsp 2008-11-28 13:24:40 UTC (rev 11431)
+++ trunk/test-applications/jsp/src/main/webapp/pages/Rich/Rich.jsp 2008-11-28 13:30:10 UTC (rev 11432)
@@ -26,7 +26,7 @@
<link rel="stylesheet" href="<%=request.getContextPath()%>/styles/styles.css" type="text/css"/>
</head>
<body>
- <a4j:queue name="org.richfaces.global_queue" disabled="false"/>
+ <a4j:queue name="org.richfaces.global_queue" disabled="false"/>
<a4j:queue name="namedQueue"/>
<a4j:queue />
<h:form id="formID">
16 years, 3 months
JBoss Rich Faces SVN: r11431 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-28 08:24:40 -0500 (Fri, 28 Nov 2008)
New Revision: 11431
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
Log:
RF-5096
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-28 11:36:24 UTC (rev 11430)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java 2008-11-28 13:24:40 UTC (rev 11431)
@@ -28,6 +28,15 @@
}
/**
+ * level selects message of respective level
+ */
+ @Test
+ public void testLevel(Template template) {
+ //TODO
+ Assert.fail("This test should be completed after resolving bug RF-5107.");
+ }
+
+ /**
* ajaxRendered message output first message for attached component by ajax request
*/
@Test
16 years, 3 months