JBoss Rich Faces SVN: r13102 - in trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld: ui and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-23 09:58:14 -0400 (Mon, 23 Mar 2009)
New Revision: 13102
Removed:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java
Log:
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -55,13 +55,13 @@
handleImage((Image)dragValue, (Album)dropValue);
}else if(dragValue instanceof Album){
handleAlbum((Album)dragValue, (Shelf)dropValue);
- }else if(dragValue instanceof FileItem){
+ }/*else if(dragValue instanceof FileItem){
if(!((Album)dropValue).getOwner().equals(user)){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You can't add photo's to that album"));
return;
}
handleUploadedImage((FileItem)dragValue, (Album)dropValue);
- }
+ }*/
}
/*private void addTreeToRerender() {
@@ -103,7 +103,7 @@
}
}
- private void handleUploadedImage(FileItem dragValue, Album dropValue) {
+ /*private void handleUploadedImage(FileItem dragValue, Album dropValue) {
String newPath = generateNewPath(dragValue.getName(), dropValue);
dragValue.getImage().setPath(newPath);
dropValue.addImage(dragValue.getImage());
@@ -112,7 +112,7 @@
}
fileManager.addImage(newPath, dragValue.getFile().getPath());
Events.instance().raiseEvent("fileAdded", dragValue);
- }
+ }*/
private String getNewPathOfImage(Image dragValue, Album dropValue) {
String fileNameOld = dragValue.getPath();
@@ -123,8 +123,8 @@
return fileNameNew;
}
- private String generateNewPath(String path, Album dropValue) {
+ /*private String generateNewPath(String path, Album dropValue) {
String fileNameNew = user.getLogin()+"/"+dropValue.getId()+"/"+path;
return fileNameNew;
- }
+ }*/
}
Deleted: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -1,77 +0,0 @@
-package org.richfaces.realworld.manager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.core.Events;
-import org.richfaces.realworld.service.Constants;
-import org.richfaces.realworld.ui.FileItem;
-import org.richfaces.realworld.ui.FileWrapper;
-
-@Name("fileUploadManager")
-(a)Scope(ScopeType.CONVERSATION)
-public class FileUploadManager {
-
- @In("#{messages['file_saving_error']}")
- private String FILE_SAVE_ERROR;
-
- @Out(required=false) FileItem file1;
- @Out(required=false) FileItem file2;
- @Out(required=false) FileItem file3;
-
- @In(create = true)
- private FileManager fileManager;
-
- @In(create = true) @Out
- FileWrapper fileWrapper;
-
- @Observer(Constants.FILE_UPLOAD_CLEAR_EVENT)
- public void clearUploadData() {
- fileWrapper.getFiles().clear();
- }
-
- public void clearSelectedData() {
- for (int i = 0; i < fileWrapper.getFiles().size(); i++) {
- if (fileWrapper.getFiles().get(i).isSelected()) {
- fileWrapper.getFiles().remove(i);
- }
- }
- }
-
- public void storeSelectedData() {
- List<FileItem> temp = new ArrayList<FileItem>();
- for (FileItem file : fileWrapper.getFiles()) {
- if (file.isSelected()) {
- // Save file to disk
- String fileName = file.getFile().getPath();
- if(!fileManager.addImage(file.getName(), fileName)){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_SAVE_ERROR));
- }
- Events.instance().raiseEvent(Constants.ADD_IMAGE_EVENT, file.getImage());
- } else {
- temp.add(file);
- }
- }
- fileWrapper.getFiles().clear();
- fileWrapper.getFiles().addAll(temp);
- }
-
- public void storeAll() {
- for (FileItem file : fileWrapper.getFiles()) {
- // Save file to disk
- String fileName = file.getFile().getPath();
- if(!fileManager.addImage(file.getName(), fileName)){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_SAVE_ERROR));
- }
- Events.instance().raiseEvent(Constants.ADD_IMAGE_EVENT, file.getImage());
- }
- fileWrapper.getFiles().clear();
- Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,NavigationEnum.ALBUM_IMAGE_PREVIEW);
- }
-}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -4,6 +4,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.MetaTag;
@@ -39,6 +40,9 @@
@Observer(Constants.UPDATE_MAIN_AREA_EVENT)
public void setMainArea(NavigationEnum mainArea) {
+ if(this.mainArea.equals(NavigationEnum.FILE_UPLOAD)){
+ Events.instance().raiseEvent("clearFileUpload");
+ }
this.mainArea = mainArea;
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -37,6 +37,7 @@
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.manager.FileManager;
+import org.richfaces.realworld.manager.Model;
import org.richfaces.realworld.service.Constants;
import com.drew.imaging.jpeg.JpegMetadataReader;
@@ -58,15 +59,14 @@
@In("#{messages['file_processing_error']}")
private String FILE_PROCESSING_ERROR;
+ @In("#{messages['file_saving_error']}")
+ private String FILE_SAVE_ERROR;
+
@In(create = true) @Out
FileWrapper fileWrapper;
-
- @Out(required=false) FileItem file1;
- @Out(required=false) FileItem file2;
- @Out(required=false) FileItem file3;
- @In(create = true)
- private FileManager fileManager;
+ @In Model model;
+ @In private FileManager fileManager;
@In("#{messages['samplename']}")
private String SAMPLE_NAME;
@@ -94,19 +94,13 @@
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_PROCESSING_ERROR));
return;
}
+ image.setAlbum(model.getSelectedAlbum());
file.setImage(image);
fileWrapper.getFiles().add(file);
- outJectLastThreeImages();
- }
-
- private void outJectLastThreeImages() {
- file1 = fileWrapper.getFiles().get(fileWrapper.getFiles().size()-1);
- if(fileWrapper.getFiles().size()-2 >=0){
- file2 = fileWrapper.getFiles().get(fileWrapper.getFiles().size()-2);
+ if(!fileManager.addImage(file.getName(), file.getFile().getPath())){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_SAVE_ERROR));
}
- if(fileWrapper.getFiles().size()-3 >=0){
- file3 = fileWrapper.getFiles().get(fileWrapper.getFiles().size()-3);
- }
+ file.getFile().delete();
}
private Image constructImage(UploadItem item, FileItem file) {
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -44,8 +44,8 @@
this.files = files;
}
- @Observer("fileAdded")
- public void removeFile(FileItem file){
- files.remove(file);
+ @Observer("clearFileUpload")
+ public void clear(){
+ files.clear();
}
}
Deleted: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java 2009-03-23 13:58:01 UTC (rev 13101)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java 2009-03-23 13:58:14 UTC (rev 13102)
@@ -1,43 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.ui;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.component.UIInputNumberSlider;
-
-@Name("slideshowHelper")
-(a)Scope(ScopeType.EVENT)
-public class SlideshowHelper {
-
- private UIInputNumberSlider inputSlider;
-
- public UIInputNumberSlider getInputSlider() {
- return inputSlider;
- }
-
- public void setInputSlider(UIInputNumberSlider inputSlider) {
- this.inputSlider = inputSlider;
- }
-
-
-}
15 years, 9 months
JBoss Rich Faces SVN: r13101 - trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-03-23 09:58:01 -0400 (Mon, 23 Mar 2009)
New Revision: 13101
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
Log:
RF-6578
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java 2009-03-23 13:57:53 UTC (rev 13100)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java 2009-03-23 13:58:01 UTC (rev 13101)
@@ -3,6 +3,7 @@
import java.util.List;
import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Shelf;
public interface ISearchAction {
public List<Image> searchByImage(String query, boolean searchInMyAlbums, boolean searchInShared);
@@ -13,4 +14,6 @@
public List<Image> searchByUsers(String query, boolean searchInMyAlbums, boolean searchInShared);
+ public List<Shelf> searchByShelfs(String query,boolean searchInMyAlbums, boolean searchInShared);
+
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-23 13:57:53 UTC (rev 13100)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-23 13:58:01 UTC (rev 13101)
@@ -11,6 +11,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
@Name("searchAction")
@@ -84,4 +85,16 @@
return query.getResultList();
}
+ public List<Shelf> searchByShelfs(String searchQuery, boolean searchInMyAlbums,
+ boolean searchInShared) {
+ StringBuilder b = new StringBuilder("from Shelf sh where lower(sh.name) like :name or lower(sh.description) like :name ");
+ if (searchInShared) {
+ b.append(" and sh.shared=true");
+ }
+ Query query = em.createQuery(b.toString());
+
+ query.setParameter("name", "%" + searchQuery.toLowerCase() + "%");
+ return query.getResultList();
+ }
+
}
15 years, 9 months
JBoss Rich Faces SVN: r13100 - in trunk/test-applications/realworld2/web/src/main: webapp/includes/search and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-03-23 09:57:53 -0400 (Mon, 23 Mar 2009)
New Revision: 13100
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByShelf.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/shelfResult.xhtml
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchWidget.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelvesList.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
Log:
RF-6578
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-03-23 13:40:27 UTC (rev 13099)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-03-23 13:57:53 UTC (rev 13100)
@@ -39,6 +39,7 @@
public ImageSearchHelper() {
options = new ArrayList<ISearchOption>();
+ options.add(new SearchOptionByShelf());
options.add(new SearchOptionByAlbum());
options.add(new SearchOptionByImage());
options.add(new SearchOptionByUser());
Added: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByShelf.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByShelf.java (rev 0)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByShelf.java 2009-03-23 13:57:53 UTC (rev 13100)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces.realworld.search;
+
+import java.util.List;
+
+import org.richfaces.realworld.domain.Shelf;
+import org.richfaces.realworld.service.ISearchAction;
+
+/**
+ * @author Andrey
+ *
+ */
+public class SearchOptionByShelf extends ISearchOption {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getName()
+ */
+ @Override
+ public String getName() {
+ return "Shelves";
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getSearchResultName()
+ */
+ @Override
+ public String getSearchResultName() {
+ return "Shelf search result";
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getSearchResultTemplate()
+ */
+ @Override
+ public String getSearchResultTemplate() {
+ return "/includes/search/result/shelfResult.xhtml";
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#getTemplate()
+ */
+ @Override
+ public String getTemplate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.search.ISearchOption#search(org.richfaces.realworld.service.ISearchAction, java.lang.String, boolean, boolean)
+ */
+ @Override
+ public void search(ISearchAction action, String searchQuery,
+ boolean searchInMyAlbums, boolean searchInShared) {
+ List<Shelf> list = action.searchByShelfs(searchQuery, searchInMyAlbums, searchInShared);
+ setSearchResult(list);
+
+ }
+
+}
Added: trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/shelfResult.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/shelfResult.xhtml (rev 0)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/shelfResult.xhtml 2009-03-23 13:57:53 UTC (rev 13100)
@@ -0,0 +1,14 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <a4j:outputPanel rendered="#{result.size() > 0}">
+ <ui:decorate template="/includes/shelf/shelvesList.xhtml">
+ <ui:param name="shelfs" value="#{result}" />
+ <ui:define name="header" />
+ </ui:decorate>
+ </a4j:outputPanel>
+ <h:outputText rendered="#{result.size() == 0}" value="No results found" />
+</ui:composition>
\ No newline at end of file
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search/searchWidget.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelvesList.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-23 13:40:27 UTC (rev 13099)
+++ trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-23 13:57:53 UTC (rev 13100)
@@ -425,7 +425,7 @@
.search-options {
background: transparent none repeat scroll 0% 0%;
overflow: hidden;
- height: 90px;
+ height: 110px;
width: 327px;
position: absolute;
top: 107px;
@@ -459,7 +459,7 @@
.search-hide-options-div {
position: absolute;
- top: 70px;
+ bottom: 5px;
left: 163px;
}
15 years, 9 months
JBoss Rich Faces SVN: r13099 - in trunk/test-applications/realworld2/web/src/main: webapp/includes/album and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-23 09:40:27 -0400 (Mon, 23 Mar 2009)
New Revision: 13099
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumEditInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelfEditInfo.xhtml
Log:
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-03-23 13:31:03 UTC (rev 13098)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-03-23 13:40:27 UTC (rev 13099)
@@ -124,7 +124,7 @@
if(image == null || image.getAlbum() == null || image.getAlbum().getOwner() == null){
return false;
}
- return image.getAlbum().getOwner().equals(user);
+ return image.getAlbum().getOwner().getLogin().equals(user.getLogin());
}
public void startEditAlbum(Album album){
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumEditInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelfEditInfo.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelfEditInfo.xhtml 2009-03-23 13:31:03 UTC (rev 13098)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/shelfEditInfo.xhtml 2009-03-23 13:40:27 UTC (rev 13099)
@@ -48,4 +48,7 @@
</tr>
</table>
</div>
+ <ui:include src="/includes/album/albumsList.xhtml">
+ <ui:param name="albums" value="#{shelf.albums}" />
+ </ui:include>
</ui:composition>
\ No newline at end of file
15 years, 9 months
JBoss Rich Faces SVN: r13098 - trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-23 09:31:03 -0400 (Mon, 23 Mar 2009)
New Revision: 13098
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
https://jira.jboss.org/jira/browse/RF-5211
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2009-03-23 13:21:33 UTC (rev 13097)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2009-03-23 13:31:03 UTC (rev 13098)
@@ -1349,6 +1349,21 @@
return result;
},
+ setupTimeForDate: function (date) {
+ if (this.selectedDate && !this.params.resetTimeOnDateSelect ||
+ (this.selectedDate.getFullYear() == date.getFullYear() &&
+ this.selectedDate.getMonth() == date.getMonth() &&
+ this.selectedDate.getDate() == date.getDate()))
+ {
+ date.setHours(this.selectedDate.getHours());
+ date.setMinutes(this.selectedDate.getMinutes());
+ } else
+ {
+ date.setHours(this.params.defaultTime.hours);
+ date.setMinutes(this.params.defaultTime.minutes);
+ }
+ },
+
eventCellOnClick: function (e, obj) {
var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
if (daydata.enabled && daydata._month==0)
@@ -1357,15 +1372,7 @@
date.setDate(daydata.day);
if (this.timeType)
{
- if (this.selectedDate && !this.params.resetTimeOnDateSelect)
- {
- date.setHours(this.selectedDate.getHours());
- date.setMinutes(this.selectedDate.getMinutes());
- } else
- {
- date.setHours(this.params.defaultTime.hours);
- date.setMinutes(this.params.defaultTime.minutes);
- }
+ this.setupTimeForDate(date);
}
if (this.selectDate(date,true, {event:e, element:obj}) && !this.showApplyButton)
@@ -1381,15 +1388,7 @@
var date = new Date(daydata.date);
if (this.timeType)
{
- if (this.selectedDate && !this.params.resetTimeOnDateSelect)
- {
- date.setHours(this.selectedDate.getHours());
- date.setMinutes(this.selectedDate.getMinutes());
- } else
- {
- date.setHours(this.params.defaultTime.hours);
- date.setMinutes(this.params.defaultTime.minutes);
- }
+ this.setupTimeForDate(date);
}
if (this.selectDate(date, false, {event:e, element:obj}) && !this.showApplyButton)
@@ -1869,15 +1868,7 @@
var date = new Date(today.getFullYear(), today.getMonth(), today.getDate());
if (this.timeType)
{
- if (this.selectedDate && !this.params.resetTimeOnDateSelect)
- {
- date.setHours(this.selectedDate.getHours());
- date.setMinutes(this.selectedDate.getMinutes());
- } else
- {
- date.setHours(this.params.defaultTime.hours);
- date.setMinutes(this.params.defaultTime.minutes);
- }
+ this.setupTimeForDate(date);
}
if (daydata.enabled && this.selectDate(date,true) && !this.showApplyButton)
{
15 years, 9 months
JBoss Rich Faces SVN: r13096 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2009-03-23 09:14:59 -0400 (Mon, 23 Mar 2009)
New Revision: 13096
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
RF-6024 - updated code example for necessary section.
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2009-03-23 13:13:08 UTC (rev 13095)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2009-03-23 13:14:59 UTC (rev 13096)
@@ -767,8 +767,8 @@
</f:facet>
<h:outputText value="#{cap.text}"></h:outputText>
</h:column>
- <a4j:support event="onselect" action="#{bean.action}">
- <f:setPropertyActionListener value="#{cap.label}" target="#{bean.property1}" />
+ <a4j:support event="onselect">
+ <a4j:actionparam value="#{cap.label}" actionListener="#{bean.action}" />
</a4j:support>
</rich:suggestionbox>
...
15 years, 9 months
JBoss Rich Faces SVN: r13095 - trunk/docs/faq.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-03-23 09:13:08 -0400 (Mon, 23 Mar 2009)
New Revision: 13095
Modified:
trunk/docs/faq/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-6556 - necessary repo was added to FAQ
Modified: trunk/docs/faq/pom.xml
===================================================================
--- trunk/docs/faq/pom.xml 2009-03-23 12:55:15 UTC (rev 13094)
+++ trunk/docs/faq/pom.xml 2009-03-23 13:13:08 UTC (rev 13095)
@@ -33,7 +33,20 @@
<pluginRepositories>
<pluginRepository>
<releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
<enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <id>snapshots.jboss.com</id>
+ <name>Jboss Repository for Maven</name>
+ <url>http://snapshots.jboss.com/maven2/</url>
+ <layout>default</layout>
+ </pluginRepository>
+ <pluginRepository>
+ <releases>
+ <enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
15 years, 9 months
JBoss Rich Faces SVN: r13094 - in trunk: samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples and 14 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-03-23 08:55:15 -0400 (Mon, 23 Mar 2009)
New Revision: 13094
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java
trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java
Removed:
trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/samples/colorPickerDemo/pom.xml
trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml
trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/ui/colorPicker/src/main/config/component/colorPicker.xml
trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
Color Picker Skinning
Modified: trunk/samples/colorPickerDemo/pom.xml
===================================================================
--- trunk/samples/colorPickerDemo/pom.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/pom.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,47 +1,62 @@
-<?xml version="1.0"?><project>
- <parent>
- <artifactId>samples</artifactId>
- <groupId>org.richfaces</groupId>
- <version>3.3.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.samples</groupId>
- <artifactId>colorPickerDemo</artifactId>
- <packaging>war</packaging>
- <name>colorPicker Maven Webapp</name>
- <build>
- <finalName>colorPickerDemo</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>core</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-impl</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>colorPicker</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.3.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples</groupId>
+ <artifactId>colorPickerDemo</artifactId>
+ <packaging>war</packaging>
+ <name>colorPicker Maven Webapp</name>
+ <build>
+ <finalName>colorPickerDemo</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin
+ </artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.framework
+ </groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples
+ </groupId>
+ <artifactId>skins</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>dataTable</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>colorPicker</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
===================================================================
--- trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -29,8 +29,8 @@
public class Bean {
private String color = "rgb(255, 250, 240)";
- private String color2 = "#ffffff";
-
+ private String color2 = "#ffffff";
+
public Bean() {
}
Modified: trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -2,9 +2,15 @@
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
- <managed-bean>
- <managed-bean-name>bean</managed-bean-name>
- <managed-bean-class>org.richfaces.sandbox.samples.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.sandbox.samples.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,58 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>Archetype Created Web Application</display-name>
- <context-param>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
-
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+>
+ <display-name>Archetype Created Web Application</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
<context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>blueSky</param-value>
- </context-param>
- <context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
-<!--context-param>
- <param-name>org.richfaces.LoadStyleStrategy</param-name>
- <param-value>NONE</param-value>
-</context-param-->
-
- <!--
- -->
- <filter>
- <display-name>Ajax4jsf Filter</display-name>
- <filter-name>ajax4jsf</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>ajax4jsf</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- <dispatcher>ERROR</dispatcher>
- </filter-mapping>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
- <login-config>
- <auth-method>BASIC</auth-method>
- </login-config>
+ <!--
+ context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>NONE</param-value> </context-param
+ -->
+
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
</web-app>
Modified: trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,33 +1,35 @@
-<%@ page contentType="application/xhtml+xml; charset=ISO-8859-1" %>
-
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/colorPicker" prefix="colorPicker"%>
-<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
-<html>
- <head>
- <title>ColorPicker sample page</title>
- </head>
- <body>
- <f:view>
- <h:form>
- <colorPicker:colorPicker id="cp"></colorPicker:colorPicker>
- <a4j:commandButton value="submit" reRender="cp"></a4j:commandButton>
- <br /><br /><br /><br /><br /><br /><br /><br /><br />
- <br /><br /><br /><br /><br />
- <colorPicker:colorPicker value="#{bean.color2}" flat="true" colorMode="rgb">
- <f:facet name="icon">
- <f:verbatim>
- <h:graphicImage value="/pages/colorPicker_ico.png" width="18px" height="18px"/>
- </f:verbatim>
- </f:facet>
- <f:facet name="arrows">
- <f:verbatim>
- <div style="width: 30px; height: 5px; border: 1px solid gray; background:none;"></div>
- </f:verbatim>
- </f:facet>
- </colorPicker:colorPicker>
- </h:form>
- </f:view>
- </body>
-</html>
+<%@ page contentType="application/xhtml+xml; charset=ISO-8859-1" %>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/dataTable" prefix="rich" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/colorPicker" prefix="colorPicker"%>
+<html>
+ <head>
+ <title>ColorPicker sample page</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="skinForm" >
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <h:outputText value=" Current skin: #{skinBean.skin}" /><br />
+ </h:form>
+
+ <h:form>
+ <rich:dataTable value="1" id="Selenium_Test_DataTable" rowKeyVar="row">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data Table" />
+ </f:facet>
+
+ <colorPicker:colorPicker id="cp" value="#ff0000" />
+
+ <h:outputText value="#{row}"/>
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java
===================================================================
--- trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -27,20 +27,17 @@
/**
*/
-public class BeanTest
- extends TestCase
-{
+public class BeanTest extends TestCase {
/**
* Create the test case
- *
- * @param testName name of the test case
+ *
+ * @param testName - name of the test case
*/
- public BeanTest( String testName )
- {
- super( testName );
+ public BeanTest(String testName) {
+ super(testName);
}
-
+
public void testStub() throws Exception {
-
+
}
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -0,0 +1,92 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.ajax4jsf.bean;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+public class ColorPickerBean implements Validator, Converter{
+
+ private String value = "#ff0000";
+ private String trace;
+
+ private Boolean filterNewValues;
+
+ public ColorPickerBean() {
+ }
+
+ public void init() {
+ value = "#ff0000";
+ trace = null;
+
+ filterNewValues = true;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setTrace(String trace) {
+ this.trace = trace;
+ }
+
+ public String getTrace() {
+ return trace;
+ }
+
+ public void valueChangeListener(ValueChangeEvent event) {
+ trace = "changed";
+ }
+
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ if ("#ff00ff".equals(value)) {
+ throw new ValidatorException(new FacesMessage("Value mustn't be equal #ff00ff."));
+ }
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ return value != null ? value.substring(2): null;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ return value != null ? "c:" + value.toString(): null;
+ }
+
+ public void setFilterNewValues(Boolean filterNewValues) {
+ this.filterNewValues = filterNewValues;
+ }
+
+ public Boolean getFilterNewValues() {
+ return filterNewValues;
+ }
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -122,6 +122,7 @@
list.add(new ComponentItem("<rich:effect>", "effect/effectTest.xhtml"));
list.add(new ComponentItem("<rich:graphValidator>", "graphValidator/graphValidatorTest.xhtml"));
list.add(new ComponentItem("<rich:panel>", "panel/panelTest.xhtml"));
+ list.add(new ComponentItem("<rich:colorPicker>", "colorPicker/colorPickerTest.xhtml"));
sortList();
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,25 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS ENTITY="JSFProcess">
- <PROCESS-ITEM ENTITY="JSFProcessGroup"
- NAME="rules:#pages#ajaxInclude#step1.xhtml"
- PATH="/pages/ajaxInclude/step1.xhtml" SHAPE="32,17,0,0">
- <PROCESS-ITEM ENTITY="JSFProcessItem"
- ID="rules:#pages#ajaxInclude#step1.xhtml:0" NAME="item" PATH="/pages/ajaxInclude/step1.xhtml">
- <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
- ID="next::#pages#ajaxInclude#step2.xhtml" NAME="output"
- PATH="/pages/ajaxInclude/step2.xhtml"
- TARGET="rules:#pages#ajaxInclude#step2.xhtml" TITLE="next"/>
+<PROCESS model-entity="JSFProcess">
+ <PROCESS-ITEM NAME="rules:#pages#ajaxInclude#step1.xhtml"
+ PATH="/pages/ajaxInclude/step1.xhtml" SHAPE="32,17,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#pages#ajaxInclude#step1.xhtml:0" NAME="item"
+ PATH="/pages/ajaxInclude/step1.xhtml" model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT ID="next::#pages#ajaxInclude#step2.xhtml"
+ NAME="output" PATH="/pages/ajaxInclude/step2.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step2.xhtml" TITLE="next" model-entity="JSFProcessItemOutput"/>
</PROCESS-ITEM>
</PROCESS-ITEM>
- <PROCESS-ITEM ENTITY="JSFProcessGroup"
- NAME="rules:#pages#ajaxInclude#step2.xhtml"
- PATH="/pages/ajaxInclude/step2.xhtml" SHAPE="240,33,0,0">
- <PROCESS-ITEM ENTITY="JSFProcessItem"
- ID="rules:#pages#ajaxInclude#step2.xhtml:0" NAME="item" PATH="/pages/ajaxInclude/step2.xhtml">
- <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
- ID="previous::#pages#ajaxInclude#step1.xhtml" NAME="output"
- PATH="/pages/ajaxInclude/step1.xhtml"
- TARGET="rules:#pages#ajaxInclude#step1.xhtml" TITLE="previous"/>
+ <PROCESS-ITEM NAME="rules:#pages#ajaxInclude#step2.xhtml"
+ PATH="/pages/ajaxInclude/step2.xhtml" SHAPE="240,33,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#pages#ajaxInclude#step2.xhtml:0" NAME="item"
+ PATH="/pages/ajaxInclude/step2.xhtml" model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT ID="previous::#pages#ajaxInclude#step1.xhtml"
+ NAME="output" PATH="/pages/ajaxInclude/step1.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step1.xhtml" TITLE="previous" model-entity="JSFProcessItemOutput"/>
</PROCESS-ITEM>
</PROCESS-ITEM>
+ <PROCESS-ITEM
+ NAME="rules:#pages#ajaxSupport#testAjaxSingleAttribute3.xhtml"
+ PATH="/pages/ajaxSupport/testAjaxSingleAttribute3.xhtml"
+ SHAPE="32,129,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM
+ ID="rules:#pages#ajaxSupport#testAjaxSingleAttribute3.xhtml:0"
+ NAME="item" PATH="/pages/ajaxSupport/testAjaxSingleAttribute3.xhtml" model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT
+ ID="navigate::#pages#ajaxSupport#successNavigation.xhtml"
+ NAME="output" PATH="/pages/ajaxSupport/successNavigation.xhtml"
+ TARGET="rules:#pages#ajaxSupport#successNavigation.xhtml"
+ TITLE="navigate" model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM NAME="rules:#*" PATH="/*" SHAPE="32,241,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#*:0" NAME="item" PATH="/*" model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT
+ ID="autoTestNavigation::#layout#autotest#autoTestNavigationPage.xhtml"
+ NAME="output" PATH="/layout/autotest/autoTestNavigationPage.xhtml"
+ TARGET="rules:#layout#autotest#autoTestNavigationPage.xhtml"
+ TITLE="autoTestNavigation" model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM
+ NAME="rules:#layout#autotest#autoTestNavigationPage.xhtml"
+ PATH="/layout/autotest/autoTestNavigationPage.xhtml"
+ SHAPE="240,257,0,0" model-entity="JSFProcessGroup"/>
+ <PROCESS-ITEM NAME="rules:#pages#ajaxSupport#successNavigation.xhtml"
+ PATH="/pages/ajaxSupport/successNavigation.xhtml" SHAPE="240,145,0,0" model-entity="JSFProcessGroup"/>
</PROCESS>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -146,6 +146,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>colorPickerBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.ColorPickerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>ddmenuBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.DropDownMenuTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:colorPicker id="componentId"
+ value="#{colorPickerBean.value}"
+
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ >
+
+ <!-- rendered="#{autoTestBean.rendered}"
+ required="#{autoTestBean.required}"
+ requiredMessage="#{autoTestBean.requiredMessage}"
+ immediate="#{autoTestBean.immediate}"
+ style="width: 100%; color: yellow"
+ styleClass="noname"-->
+
+ </rich:colorPicker>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="autoTestForm">
+ <rich:colorPicker
+ id="componentId"
+ value="#{colorPickerBean.value}"
+
+
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ />
+
+ <a4j:commandButton id="submit" value="Submit" reRender="outputPanel"></a4j:commandButton>
+ </h:form>
+
+ <a4j:outputPanel id="outputPanel">
+ <h:outputText id="value" value="#{colorPickerBean.value}"></h:outputText>
+ <h:outputText id="trace" value="#{colorPickerBean.trace}"></h:outputText>
+ <rich:message id="message" for="comboBox"></rich:message>
+ </a4j:outputPanel>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -0,0 +1,260 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class ColorPickerTest extends SeleniumTestBase {
+
+ private String colorPicker;
+ private String colorPickerButton;
+ private String colorPickerList;
+ private String xPathInput;
+ private String xPathColorArea;
+ private String hexInputId;
+
+ private String submit;
+// private String value;
+// private String trace;
+// private String message;
+
+ private void init(Template template) {
+ renderPage(null, template, "#{comboBean.init}");
+ String mainForm = getParentId() + "autoTestForm";
+
+ colorPicker = mainForm + ":componentId";
+ colorPickerButton = colorPicker;
+ colorPickerList = colorPicker + "-colorPicker-popup";
+ hexInputId = colorPicker + "-colorPicker-hex";
+ xPathInput = "xpath=id('" + colorPickerButton + "')/input";
+
+ submit = mainForm + ":submit";
+
+// value = getParentId() + "value";
+// trace = getParentId() + "trace";
+// message = getParentId() + "message";
+ }
+
+// @Test
+// public void testColorPickerComponent(Template template) {
+// init(template);
+//
+// // Test setted value
+// testValueSettedOnPage(template);
+//
+// // Select color on RGB
+// testSetValueOnRGB(template);
+//
+// // open colorPicker and close it by Cancel button
+// testSetValueOnHSB(template);
+//
+// // open colorPicker and close it by Cancel button
+// testInputValueByColorArea(template);
+//
+// // test cancel button
+// testCancelButton(template);
+//
+// // test cancel button
+// testValue(template);
+// }
+
+ @Test
+ public void testCancelButton(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ final String oldValue = selenium.getValue(xPathInput);
+
+ setValueOnRGB("255", "0", "255");
+
+ Assert.assertTrue(isVisible(hexInputId), "Hex Input must be presented");
+ Assert.assertEquals("#" + selenium.getValue(hexInputId), "#ff00ff");
+
+ final String xPathButtonCancel = "xpath=id('" + colorPickerList + "')//button[@name='cancel']";
+ Assert.assertTrue(isVisible(xPathButtonCancel), "Button Cancel must be presented");
+ selenium.click(xPathButtonCancel);
+
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Button Ok must be presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), oldValue); // value from page
+ }
+
+
+ public void testInputValueByColorArea(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ xPathColorArea = "xpath=id('" + colorPickerList + "')//div[@class='rich-colorPicker-color']/div";
+ selenium.clickAt(xPathColorArea, "0,0"); // don't work
+
+ testInputedValue("#ffffff");
+ }
+
+ @Test
+ public void testValueSettedOnPage(Template template) { // don't work in tables
+ init(template);
+
+ Assert.assertTrue(isVisible(colorPickerButton), "Component must be visible");
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Input must be presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), "#ff0000"); // value from page
+ }
+
+ @Test
+ public void testSetValueOnHSB(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ selenium.type(colorPicker + "-colorPicker-hsb-h", "120");
+ selenium.type(colorPicker + "-colorPicker-hsb-s", "100");
+ selenium.type(colorPicker + "-colorPicker-hsb-b", "100");
+
+ testInputedValue("#00ff00");
+ }
+
+ @Test
+ public void testSetValueOnRGB(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ setValueOnRGB("0", "0", "255");
+
+ testInputedValue("#0000ff");
+ }
+
+ private void setValueOnRGB(String r, String g, String b) {
+ selenium.type(colorPicker + "-colorPicker-rgb-r", r);
+ selenium.type(colorPicker + "-colorPicker-rgb-g", g);
+ selenium.type(colorPicker + "-colorPicker-rgb-b", b);
+ }
+
+ private void testInputedValue(final String expectedValue) {
+ Assert.assertTrue(isVisible(hexInputId), "Hex Input must be presented");
+ Assert.assertEquals("#" + selenium.getValue(hexInputId), expectedValue);
+
+ final String xPathButtonOk = "xpath=id('" + colorPickerList + "')//button[@name='submit']";
+ Assert.assertTrue(isVisible(xPathButtonOk), "Button Cancel must be presented");
+ selenium.click(xPathButtonOk);
+
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Button Ok must be presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), expectedValue); // value from page
+ }
+
+ /**
+ * Check that valueChangeListener triggered
+ * when user select new value from popup.
+ * Selected value should be correctly applied.
+ */
+ @Test
+ public void testValue(Template template) {
+ init(template);
+
+ openColorPicker();
+ setValueOnRGB("0", "255", "255");
+ testInputedValue("#00ffff");
+
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getValue(xPathInput), "#00ffff");
+ }
+
+ private void openColorPicker() {
+ clickById(colorPickerButton);
+ Assert.assertTrue(isVisible(colorPickerList), "Component's pop-up must show up on click");
+ }
+
+// /**
+// * Check component validation.
+// * Specific validator defined in "validator" attribute
+// * should be triggered either as the ones defined using nested validator tags
+// */
+// @Test
+// public void testValidators(Template template) {
+// init(template);
+//
+// Assert.assertEquals(selenium.getText(message), "");
+//
+// AutoTester
+// openColorPicker();
+// setValueOnRGB("0", "255", "255");
+// testInputedValue("#00ffff");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal 11.");
+//
+// openColorPicker();
+// setValueOnRGB("255", "255", "255");
+// testInputedValue("#ffffff");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal 44.");
+// }
+//
+// /**
+// * The same as for RF-6064 but for the case of validation failure.
+// * Submitted value should be output back unchanged after submit
+// */
+// @Test
+// public void testValidationFailure(Template template) {
+// init(template);
+// Assert.assertEquals(selenium.getText(value), "");
+// Assert.assertEquals(selenium.getText(message), "");
+// selenium.click(colorPickerButton);
+// selenium.mouseMove("xpath=id('" + colorPickerList + "')/span[4]");
+// selenium.click("xpath=id('" + colorPickerList + "')/span[4]");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(value), "");
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal 44.");
+// }
+//
+// /**
+// * Check "immediate", "required" & "requiredMessage" attributes
+// */
+// @Test
+// public void testImmediateAndRequired(Template template) {
+// AutoTester autoTester = getAutoTester(this);
+// autoTester.renderPage(template, null);
+// autoTester.testImmediate(false);
+// autoTester.testRequiredAndRequiredMessageAttributes();
+// }
+
+ @Override
+ public void setValueEmpty() {
+ selenium.type(getParentId() + "autoTestForm:componentIdcolorPickerValue", "");
+ }
+
+ public String getTestUrl() {
+ return "pages/colorPicker/colorPickerTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/colorPicker/colorPickerAutoTest.xhtml";
+ }
+}
\ No newline at end of file
Modified: trunk/ui/colorPicker/src/main/config/component/colorPicker.xml
===================================================================
--- trunk/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -54,7 +54,8 @@
</description>
<defaultvalue><![CDATA["#ffffff"]]></defaultvalue>
</property>
- &ui_component_attributes;
+
+ &ui_component_attributes;
&html_events;
&ui_input_attributes;
</component>
Modified: trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java
===================================================================
--- trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -15,5 +15,12 @@
public static final String COMPONENT_TYPE = "org.richfaces.ColorPicker";
public static final String COMPONENT_FAMILY = "org.richfaces.ColorPicker";
+
+ @Override
+ public void setValue(Object value) {
+ // TODO Remove it
+ super.setValue(value);
+ }
+
}
Modified: trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
===================================================================
--- trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -15,10 +15,10 @@
public void decode(FacesContext context, UIComponent component){
ExternalContext external = context.getExternalContext();
- Map requestParams = external.getRequestParameterMap();
+ Map<String, String> requestParams = external.getRequestParameterMap();
UIColorPicker colorPicker = (UIColorPicker)component;
String clientId = colorPicker.getClientId(context);
- String submittedValue = (String)requestParams.get(clientId);
+ String submittedValue = requestParams.get(clientId);
if (submittedValue != null) {
colorPicker.setSubmittedValue(submittedValue);
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-23 12:55:15 UTC (rev 13094)
@@ -171,17 +171,26 @@
<u:selector name=".rich-colorPicker-ext">
<u:style name="border-color" skin="panelBorderColor"/>
- <u:style name="background-color" skin="additionalBackgroundColor"/>
+ <u:style name="background-color" skin="generalBackgroundColor"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
<u:selector name=".rich-colorPicker-span input">
<u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.html.images.InputBackgroundImage" />
+ <f:resource f:key="org.richfaces.renderkit.html.images.InputBackgroundImage" />
</u:style>
<u:style name="border-color" skin="panelBorderColor"/>
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
+ <u:selector name=".rich-colorPicker-ext input">
+ <u:style name="color" skin="controlTextColor"/>
+ <u:style name="background-color" skin="controlBackgroundColor"/>
+ </u:selector>
+ <u:selector name=".rich-colorPicker-ext label">
+ <u:style name="color" skin="generalSizeFont"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
<u:selector name=".rich-colorPicker-icon">
<u:style name="border-color" skin="panelBorderColor"/>
</u:selector>
@@ -194,6 +203,18 @@
<u:selector name=".rich-colorPicker-current-color">
<u:style name="border-color" skin="panelBorderColor"/>
</u:selector>
+ <u:selector name=".rich-colorPicker-cancel">
+ <u:style name="font-size" skin="buttonFontSize"/>
+ <u:style name="font-family" skin="buttonFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ <u:style name="border-color" skin="headerBackgroundColor"/>
+ </u:selector>
+ <u:selector name=".rich-colorPicker-submit">
+ <u:style name="font-size" skin="buttonFontSize"/>
+ <u:style name="font-family" skin="buttonFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ <u:style name="border-color" skin="headerBackgroundColor"/>
+ </u:selector>
<u:selector name=".rich-colorPicker-color div">
<u:style name="background-image">
<f:resource f:key="/org/richfaces/renderkit/html/images/colorpicker_overlay.png" />
Modified: trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-23 12:55:15 UTC (rev 13094)
@@ -25,21 +25,17 @@
<span id="#{clientId}" class="rich-colorPicker-span" x:passThruWithExclusions="value,name,type,id,styleClass,class,style">
<input readonly="readonly" type="text" name="#{clientId}" value="#{this:getInputValue(context, component)}"/>
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {]]>
- </jsp:scriptlet>
+ <jsp:scriptlet><![CDATA[
+ if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {
+ ]]></jsp:scriptlet>
<u:insertFacet name="icon" />
- <jsp:scriptlet>
- <![CDATA[
+ <jsp:scriptlet><![CDATA[
}else{
- ]]>
- </jsp:scriptlet>
- <img src="#{arrow}" class="rich-colorPicker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" vertical-align="middle"/>
- <jsp:scriptlet>
- <![CDATA[
+ ]]></jsp:scriptlet>
+ <img src="#{arrow}" class="rich-colorPicker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" vertical-align="middle"/>
+ <jsp:scriptlet><![CDATA[
}
- ]]>
- </jsp:scriptlet>
+ ]]></jsp:scriptlet>
</span>
<div id="#{clientId}-colorPicker-popup" class="rich-colorPicker-wrapper">
Copied: trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java (from rev 13022, trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java (rev 0)
+++ trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -0,0 +1,183 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for simple Component.
+ */
+public class ColorPickerTest extends AbstractAjax4JsfTestCase {
+ private UIForm form;
+ private UIColorPicker colorPicker;
+ private UIColorPicker colorPicker2;
+
+ private ColorPickerBean targetBean = null;
+
+ /**
+ * Create the test case
+ *
+ * @param testName - name of the test case
+ */
+ public ColorPickerTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent(UIColorPicker.COMPONENT_TYPE,
+ "org.richfaces.component.html.HtmlColorPicker");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ colorPicker = (UIColorPicker) application.createComponent(UIColorPicker.COMPONENT_TYPE);
+ form.getChildren().add(colorPicker);
+
+ targetBean = new ColorPickerBean();
+ externalContext.getRequestMap().put("targetBean", targetBean);
+ colorPicker.setValueBinding("value", application.createValueBinding("#{targetBean.value}"));
+
+ colorPicker2 = (UIColorPicker) application.createComponent(UIColorPicker.COMPONENT_TYPE);
+ }
+
+ public void tearDown() throws Exception {
+ form = null;
+ colorPicker = null;
+ colorPicker2 = null;
+
+ targetBean = null;
+
+ super.tearDown();
+ }
+
+ /**
+ * Tests if component accepts request parameters and stores them in
+ * submittedValue(). If component is immediate, validation (possibly with
+ * conversion) should occur on that phase.
+ *
+ * @throws Exception
+ */
+ public void testDecode() throws Exception {
+ final String value = "value";
+
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext), value);
+ colorPicker.processDecodes(facesContext);
+
+ Object submittedValue = colorPicker.getSubmittedValue();
+ assertEquals(value, submittedValue);
+ }
+
+ public void testDecodeImmediate() throws Exception {
+ colorPicker.setImmediate(true);
+ colorPicker.addValidator(new Validator() {
+
+ public void validate(FacesContext arg0, UIComponent arg1, Object arg2) throws ValidatorException {
+ FacesMessage mess = new FacesMessage("Fake test message.");
+ throw new ValidatorException(mess);
+
+ }
+ });
+
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext), "value");
+ colorPicker.processDecodes(facesContext);
+
+ assertTrue(facesContext.getMessages().hasNext());
+ }
+
+ /**
+ * Tests if component handles value bindings correctly
+ *
+ * @throws Exception
+ */
+ public void testUpdate() throws Exception {
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext), "value");
+
+ colorPicker.processDecodes(facesContext);
+ colorPicker.processValidators(facesContext);
+ colorPicker.processUpdates(facesContext);
+
+ assertEquals("value", targetBean.getValue());
+ }
+
+ /**
+ * Tests if component handles validation correctly
+ *
+ * @throws Exception
+ */
+ public void testValidate() throws Exception {
+ colorPicker.addValidator(new Validator() {
+
+ public void validate(FacesContext arg0, UIComponent arg1,
+ Object arg2) throws ValidatorException {
+ FacesMessage mess = new FacesMessage("Fake test message.");
+ throw new ValidatorException(mess);
+
+ }
+
+ });
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext), "value");
+
+ colorPicker.processDecodes(facesContext);
+ colorPicker.processValidators(facesContext);
+
+ assertTrue(facesContext.getMessages().hasNext());
+ assertNotNull(colorPicker.getSubmittedValue());
+ }
+
+ public void testSaveRestore() throws Exception {
+ final String value = "value";
+
+ colorPicker.setValueBinding("value", null);
+ assertNull(colorPicker.getValueBinding("value"));
+
+ colorPicker.setValue(value);
+ assertEquals(value, colorPicker.getValue());
+
+ Object state = colorPicker.saveState(facesContext);
+
+ colorPicker2.restoreState(facesContext, state);
+ assertEquals(value, colorPicker2.getValue());
+ }
+
+ protected class ColorPickerBean {
+ private String value = null;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+}
Deleted: trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
15 years, 9 months
JBoss Rich Faces SVN: r13093 - Plan and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-23 08:10:39 -0400 (Mon, 23 Mar 2009)
New Revision: 13093
Modified:
trunk/test-applications/qa/Test Plan/TestPlan-RF.doc
Log:
Modified: trunk/test-applications/qa/Test Plan/TestPlan-RF.doc
===================================================================
(Binary files differ)
15 years, 9 months