JBoss Rich Faces SVN: r20677 - in branches/RF-7654: examples/validator-demo/src/main/java/org/richfaces/example and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-19 01:02:48 -0500 (Sun, 19 Dec 2010)
New Revision: 20677
Added:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
Removed:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java
Modified:
branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
Log:
RESOLVED - issue RF-9222: CSV: development sample subtask
https://issues.jboss.org/browse/RF-9222
Modified: branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,6 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>validator-demo</display-name>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>true</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>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- Faces Servlet Mapping -->
+ <!--
+
+ This mapping identifies a jsp page as having JSF content. If a request
+ comes to the server for foo.faces, the container will send the request
+ to the FacesServlet, which will expect a corresponding foo.jsp page to
+ exist containing the content.
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
Modified: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,70 +1,22 @@
-/**
- * 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.example;
-
-import javax.validation.constraints.Pattern;
-
-
-/**
- * JSF bean with text property validation.
- */
-public class Bean {
-
- /**
- * Text property
- */
- private String email;
-
- private String creditCardNumber;
-
- /**
- * @return the creditCardNumber
- */
- @Pattern(regexp="\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d")
- public String getCreditCardNumber() {
- return creditCardNumber;
- }
-
- /**
- * @param creditCardNumber the creditCardNumber to set
- */
- public void setCreditCardNumber(String creditCardNumber) {
- this.creditCardNumber = creditCardNumber;
- }
-
- /**
- * @return the text
- */
-// @Email
-// @Pattern(regexp="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9](a)[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$")
- public String getEmail() {
- return email;
- }
-
- /**
- * @param text the text to set
- */
- public void setEmail(String text) {
- this.email = text;
- }
-
-}
\ No newline at end of file
+package org.richfaces.example;
+
+public class Bean {
+
+ public static final String FOO_VALUE = "fooValue";
+
+ private String value=FOO_VALUE;
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java (rev 0)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.example;
+
+import javax.faces.validator.LengthValidator;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CustomValidator extends LengthValidator {
+
+ public CustomValidator() {
+ setMinimum(1);
+ setMaximum(3);
+ }
+}
Property changes on: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,49 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.validation.Valid;
-import javax.validation.constraints.Max;
-
-
-/**
- * @author asmirnov
- *
- */
-public class DataBean {
-
- private final List<Validable> beans;
-
- /**
- * @return the beans
- */
- @Valid
- public List<Validable> getBeans() {
- return beans;
- }
-
- public DataBean() {
- beans = new ArrayList<Validable>(6);
- beans.add(new NotNullBean());
- beans.add(new NotEmptyBean());
- beans.add(new LengthBean());
- beans.add(new MinBean());
- beans.add(new MaxBean());
- beans.add(new MinMaxBean());
- }
-
- @Max(value=20,message="Total value should be less then 20")
- public int getTotal(){
- int total = 0;
- for (Validable bean : beans) {
- total += bean.getIntValue();
- }
- return total;
- }
-
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,99 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-
-/**
- * @author asmirnov
- *
- */
-public class GraphValidatorBean implements Cloneable {
-
- @Min(0)
- @Max(10)
- private int first ;
-
- @Min(value=5,message="Value {0} should be more than {value}")
- @Max(15)
- private int second ;
-
- @Min(0)
- @Max(20)
- private int third ;
-
- private String actionResult;
-
- /**
- * @return the actionResult
- */
- public String getActionResult() {
- return actionResult;
- }
-
- /**
- * @param actionResult the actionResult to set
- */
- public void setActionResult(String actionResult) {
- this.actionResult = actionResult;
- }
-
- /**
- * @return the first
- */
- public int getFirst() {
- return first;
- }
-
- /**
- * @param first the first to set
- */
- public void setFirst(int first) {
- this.first = first;
- }
-
- /**
- * @return the second
- */
- public int getSecond() {
- return second;
- }
-
- /**
- * @param second the second to set
- */
- public void setSecond(int second) {
- this.second = second;
- }
-
- /**
- * @return the third
- */
- public int getThird() {
- return third;
- }
-
- /**
- * @param third the third to set
- */
- public void setThird(int third) {
- this.third = third;
- }
-
- /**
- * @return total summ of the list values.
- */
- @Max(value=20,message="Total value should be less then 20")
- public int getSumm(){
- return first+second+third;
- }
-
- public String action() {
- // Persist your data here
- setActionResult("Data have been saved");
- return "ok";
- }
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,64 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Size;
-
-
-/**
- * @author asmirnov
- *
- */
-public class LengthBean implements Validable {
-
- @Size(max=10,min=2,message="incorrect field length")
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Validate String Length, for a range 2-10 chars";
- }
-
- public String getIntDescription() {
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- return "Invalid user name";
- }
-
- public String getTextSummary() {
- return "Invalid user name";
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,69 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Pattern;
-
-/**
- * @author asmirnov
- *
- */
-public class MaxBean implements Validable {
-
- private String text;
-
- @Max(10)
- private int intValue;
-
- /**
- * @return the text
- */
-// @CreditCardNumber
- @Pattern(regexp="\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d")
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, should be correct credit card number";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, less then 10";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid number of items";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid payment card";
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Min;
-
-/**
- * @author asmirnov
- *
- */
-public class MinBean implements Validable {
-
- private String text;
-
- @Min(2)
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, no restrictions";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, more then 1";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid rooms qty";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,68 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-/**
- * @author asmirnov
- *
- */
-public class MinMaxBean implements Validable {
-
- private String text;
-
- @Min(value=2,message="Value {0} should be more than {value}")
- @Max(10)
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text Value, no restrictions";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, valid values from 2 to 10";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid price";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,67 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Size;
-
-
-/**
- * @author asmirnov
- *
- */
-public class NotEmptyBean implements Validable {
-
- @Size(min=1)
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, Not Empty Validation";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid password";
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class NotNullBean implements Validable {
-
- @NotNull
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text Value, Not Null Validation";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid address";
- }
-
-}
Deleted: branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,21 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-/**
- * @author asmirnov
- *
- */
-public interface Validable {
-
- public String getText();
-
- public String getTextDescription();
-
- public String getTextSummary();
-
- public int getIntValue();
-
- public String getIntSummary();
-}
Modified: branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,6 +1,14 @@
<?xml version="1.0"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+<managed-bean>
+ <managed-bean-name>test</managed-bean-name>
+ <managed-bean-class>org.richfaces.example.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+</managed-bean>
+<validator>
+ <validator-id>custom</validator-id>
+ <validator-class>org.richfaces.example.CustomValidator</validator-class>
+</validator>
-
</faces-config>
Added: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml (rev 0)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:csv="http://richfaces.org/csv">
+ <h:head><title>Ajax validator</title></h:head>
+ <h:body>
+ <h:form id="form">
+ <h:inputText id="text" value="#{test.value}">
+ <f:validator validatorId="custom" />
+ <csv:validator event="blur" />
+ </h:inputText>
+ <h:outputText id="out" value="#{test.value}"></h:outputText>
+ <csv:message id="uiMessage" for="text" />
+ </h:form>
+ </h:body>
+</html>
Property changes on: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,37 +0,0 @@
-<!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:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:ajaxValidator> usage" />
- <ui:param name="javaBean" value="org/richfaces/example/Bean.java" />
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:ajaxValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="content">
- <h:form id="form">
- <h:panelGrid columns="3">
- <h:outputLabel for="email" value="Email Address:" />
- <h:inputText id="email" value="#{bean.email}" label="Email">
- <rich:ajaxValidator event="onkeyup" summary="Invalid Email address" profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="email"/>
- <h:outputLabel for="card" value="Credit card number:" />
- <h:inputText id="card" value="#{bean.creditCardNumber}" label="Credit card">
- <rich:ajaxValidator event="onkeyup" summary="Invalid credit card number" profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="card"/>
- </h:panelGrid>
- <h:commandButton value="Submit"></h:commandButton>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
\ No newline at end of file
Deleted: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,37 +0,0 @@
-<!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:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:beanValidator> usage" />
- <ui:param name="javaBean" value="org/richfaces/example/Bean.java" />
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:beanValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="content">
- <h:form id="form">
- <h:panelGrid columns="3">
- <h:outputLabel for="email" value="Email Address:" />
- <h:inputText id="email" value="#{bean.email}" label="Email">
- <rich:beanValidator summary="Invalid Email address" />
- </h:inputText>
- <rich:message for="email"/>
- <h:outputLabel for="card" value="Credit card number:" />
- <h:inputText id="card" value="#{bean.creditCardNumber}" label="Credit card">
- <rich:beanValidator summary="Invalid credit card number" profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="card"/>
- </h:panelGrid>
- <h:commandButton value="Submit"></h:commandButton>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
Added: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml (rev 0)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:csv="http://richfaces.org/csv">
+ <h:head><title>Client Side Validator</title></h:head>
+ <h:body>
+ <h:form id="form">
+ <h:inputText id="text" value="#{test.value}">
+ <f:validateLength minimum="1" maximum="3"/>
+ <csv:validator event="blur" />
+ </h:inputText>
+ <h:outputText id="out" value="#{test.value}"></h:outputText>
+ <csv:message id="uiMessage" for="text" />
+ </h:form>
+ </h:body>
+</html>
Property changes on: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml
===================================================================
--- branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,59 +0,0 @@
-<!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:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:graphValidator> usage" />
- <ui:param name="javaBean" value="org/richfaces/example/GraphValidatorBean.java" />
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:graphValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="description">
- <p>In that sampe <rich:graphValidator> component appends JSR-303 or Hibernate validators to all enclosed input components
- that check restrictions for field values, and, in addition, validates whole bean.</p>
- <p>JSF bean fields are annotated with @Min/@Max restrictions and getter for the 'total' attribute is also annotated by the @Max</p>
- <p>As a result, even valid field values would make whole bean an invalid. For example, values '2','7','15' are valid for fields values but their sum exceed maximum total value '20'</p>
- <p>Validator assignes new values to a cloned bean instance hence model is not updated with invalid values.</p>
- </ui:define>
- <ui:define name="content">
- <h:form id="form">
- <rich:graphValidator value="#{graphValidatorBean}" id="validator" profiles="javax.validation.groups.Default">
- <h:panelGrid columns="4">
- <h:outputText value=""/>
- <h:outputText value="Input"/>
- <h:outputText value="Message"/>
- <h:outputText value="Model value"/>
-
- <h:outputLabel for="value0" value="First value, integer from 0 to 10:" />
- <h:inputText id="value0" value="#{graphValidatorBean.first}" label="First" />
- <rich:message for="value0"/>
- <h:outputText value="#{graphValidatorBean.first}"/>
-
- <h:outputLabel for="value1" value="Second value,integer from 5 to 15:" />
- <h:inputText id="value1" value="#{graphValidatorBean.second}" label="Second" />
- <rich:message for="value1"/>
- <h:outputText value="#{graphValidatorBean.second}"/>
-
- <h:outputLabel for="value2" value="Third value,integer from 0 to 20:" />
- <h:inputText id="value2" value="#{graphValidatorBean.third}" label="Third" />
- <rich:message for="value2"/>
- <h:outputText value="#{graphValidatorBean.third}"/>
-
- <h:outputLabel for="total" value="Total, should be no more then 20:" />
- <h:outputText id="total" value="#{graphValidatorBean.summ}"/>
- </h:panelGrid>
- <h:commandButton value="Submit" action="#{graphValidatorBean.action}"></h:commandButton>
- <h:outputText id="result" value="#{graphValidatorBean.actionResult}"/>
- </rich:graphValidator>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
\ No newline at end of file
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -69,7 +69,7 @@
HtmlInput input = getInput(page);
input.setValueAttribute(value);
input.fireEvent("blur");
- HtmlElement message = page.getElementById("form:uiMessage");
+ HtmlElement message = page.getElementById("uiMessage");
assertThat(message.getTextContent(), matcher);
// System.out.println(page.asXml());
}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -71,7 +71,7 @@
page = (HtmlPage) input.setValueAttribute(value);
input.fireEvent("blur");
System.out.println(page.asXml());
- HtmlElement message = page.getElementById("form:uiMessage");
+ HtmlElement message = page.getElementById("uiMessage");
assertThat(message.getTextContent(), matcher);
}
Deleted: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -1,33 +0,0 @@
-package org.richfaces.javascript.client;
-
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
-public class TestCriteria {
-
- private final Object value;
-
- private final Map<String, Object> options = Maps.newHashMap();
-
- public TestCriteria(Object value) {
- this.value = value;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the string
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the options
- */
- public Map<String, Object> getOptions() {
- return options;
- }
-
-}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -29,6 +29,7 @@
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.javascript.host.Event;
/**
* <p class="changed_added_4_0"></p>
@@ -53,6 +54,6 @@
@Test
public void testUnload() throws Exception {
sendMessage();
- qunit.getPage().getDocumentElement().fireEvent("unload");
+ qunit.getPage().getDocumentElement().fireEvent(Event.TYPE_UNLOAD);
}
}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-19 06:02:48 UTC (rev 20677)
@@ -8,6 +8,7 @@
import org.junit.Rule;
import org.richfaces.javascript.Message;
+import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -31,9 +32,15 @@
}
protected Builder createQunitPage() {
- return Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
+ return Qunit.builder().emulate(BrowserVersion.FIREFOX_3_6).loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
.loadJsfResource("richfaces-event.js").loadJsfResource("richfaces-base-component.js").
- loadJsfResource("csv.js", "org.richfaces").loadJsfResource("message.js", "org.richfaces").content("<div id=\"foo\" ><ul id=\"" + MY_MESSAGE + "\">"+getMessageContent()+"</ul></div>");
+ loadJsfResource("csv.js", "org.richfaces").loadJsfResource("message.js", "org.richfaces").content(/*"<form id=\"form\" name=\"form\" method=\"post\" action=\"/client-test.jsf\" enctype=\"application/x-www-form-urlencoded\">\n" + */
+ " <input type=\"hidden\" name=\"form\" value=\"form\"/>\n" +
+ " <input id=\"form:text\" type=\"text\" name=\"form:text\" value=\"fooValue\" onblur=\"form_3Atext_3Av("form:text",this,event)\"/>\n" +
+ " <span id=\"form:out\">\n" +
+ " fooValue\n" +
+ " </span><div id=\"foo\" ><ul id=\"" + MY_MESSAGE + "\">"+getMessageContent()+"</ul></div><input type=\"hidden\" name=\"javax.faces.ViewState\" id=\"javax.faces.ViewState\" value=\"4262028796446907996:-2607792463910755035\" autocomplete=\"off\"/>\n"
+ /*+ " </form>"*/);
}
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -10,7 +10,7 @@
<csv:validator event="blur" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:message id="uiMessage" for="text" />
</h:body>
</html>
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-18 00:39:32 UTC (rev 20676)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-19 06:02:48 UTC (rev 20677)
@@ -10,7 +10,7 @@
<csv:validator event="blur" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:message id="uiMessage" for="text" />
</h:body>
</html>
14 years
JBoss Rich Faces SVN: r20676 - branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-17 19:39:32 -0500 (Fri, 17 Dec 2010)
New Revision: 20676
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-18 00:16:51 UTC (rev 20675)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-18 00:39:32 UTC (rev 20676)
@@ -50,4 +50,9 @@
assertTrue(text.contains(getErrorMessage().getSummary()));
}
+ @Test
+ public void testUnload() throws Exception {
+ sendMessage();
+ qunit.getPage().getDocumentElement().fireEvent("unload");
+ }
}
14 years
JBoss Rich Faces SVN: r20675 - in trunk: archetypes/rf-gae-sample/src/main/resources/archetype-resources and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 19:16:51 -0500 (Fri, 17 Dec 2010)
New Revision: 20675
Modified:
trunk/archetypes/rf-gae-sample/pom.xml
trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/pom.xml
trunk/examples/richfaces-showcase/pom.xml
Log:
https://issues.jboss.org/browse/RF-10051
Modified: trunk/archetypes/rf-gae-sample/pom.xml
===================================================================
--- trunk/archetypes/rf-gae-sample/pom.xml 2010-12-18 00:11:17 UTC (rev 20674)
+++ trunk/archetypes/rf-gae-sample/pom.xml 2010-12-18 00:16:51 UTC (rev 20675)
@@ -8,6 +8,7 @@
<relativePath>../../build/parent/pom.xml</relativePath>
</parent>
+ <description>This archetype creates a simple RichFaces 4 application with all the settings and custom artifacts you need to perform deploy to GAE cloud</description>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.archetypes</groupId>
<artifactId>richfaces-archetype-gae</artifactId>
Modified: trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/pom.xml
===================================================================
--- trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/pom.xml 2010-12-18 00:11:17 UTC (rev 20674)
+++ trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/pom.xml 2010-12-18 00:16:51 UTC (rev 20675)
@@ -30,6 +30,7 @@
so that generated project uses correct version of richfaces.
-->
<org.richfaces.bom.version>${richfaces-version}</org.richfaces.bom.version>
+ <gae.version>1.4.0</gae.version>
</properties>
<build>
@@ -127,9 +128,63 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>net.kindleit</groupId>
+ <artifactId>maven-gae-plugin</artifactId>
+ <version>0.7.3</version>
+ <dependencies>
+ <dependency>
+ <groupId>net.kindleit</groupId>
+ <artifactId>gae-runtime</artifactId>
+ <version>${gae.version}</version>
+ <type>pom</type>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.appengine.orm</groupId>
+ <artifactId>jdo2-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>unpack-gae-sdk</id>
+ <activation>
+ <property>
+ <name>!gae.home</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.appengine</groupId>
+ <artifactId>appengine-java-sdk</artifactId>
+ <version>${gae.version}</version>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>net.kindleit</groupId>
+ <artifactId>maven-gae-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
<dependencyManagement>
<dependencies>
<dependency>
@@ -147,6 +202,10 @@
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
<dependency>
<groupId>com.sun.faces</groupId>
Modified: trunk/examples/richfaces-showcase/pom.xml
===================================================================
--- trunk/examples/richfaces-showcase/pom.xml 2010-12-18 00:11:17 UTC (rev 20674)
+++ trunk/examples/richfaces-showcase/pom.xml 2010-12-18 00:16:51 UTC (rev 20675)
@@ -397,6 +397,14 @@
<name>!gae.home</name>
</property>
</activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.appengine</groupId>
+ <artifactId>appengine-java-sdk</artifactId>
+ <version>${gae.version}</version>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
14 years
JBoss Rich Faces SVN: r20674 - in branches/RF-7654: core/impl/src/main/java/org/richfaces/component and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-17 19:11:17 -0500 (Fri, 17 Dec 2010)
New Revision: 20674
Added:
branches/RF-7654/core/api/src/main/java/org/ajax4jsf/javascript/JSWithDependencies.java
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
Modified:
branches/RF-7654/core/impl/src/main/java/org/richfaces/component/UIScripts.java
branches/RF-7654/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Added: branches/RF-7654/core/api/src/main/java/org/ajax4jsf/javascript/JSWithDependencies.java
===================================================================
--- branches/RF-7654/core/api/src/main/java/org/ajax4jsf/javascript/JSWithDependencies.java (rev 0)
+++ branches/RF-7654/core/api/src/main/java/org/ajax4jsf/javascript/JSWithDependencies.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -0,0 +1,66 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.ajax4jsf.javascript;
+
+import java.io.IOException;
+
+import org.richfaces.resource.ResourceKey;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * <p class="changed_added_4_0">Wrapper object that adds dependencies to any object whether it implements {@link ScriptString} or not.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class JSWithDependencies extends ScriptStringBase implements ScriptWithDependencies {
+
+ private final Iterable<ResourceKey> resources;
+
+ private final Object wrapped;
+
+ public JSWithDependencies(Object wrapped,Iterable<ResourceKey> resources) {
+ this.wrapped = wrapped;
+ this.resources = ImmutableList.copyOf(resources);
+ }
+
+ public JSWithDependencies(Object wrapped,ResourceKey... resources) {
+ this.wrapped = wrapped;
+ this.resources = ImmutableList.copyOf(resources);
+ }
+ /* (non-Javadoc)
+ * @see org.richfaces.resource.ResourceLibrary#getResources()
+ */
+ public Iterable<ResourceKey> getResources() {
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.javascript.ScriptString#appendScript(java.lang.Appendable)
+ */
+ public void appendScript(Appendable target) throws IOException {
+ ScriptUtils.appendScript(target, wrapped);
+ }
+
+}
Modified: branches/RF-7654/core/impl/src/main/java/org/richfaces/component/UIScripts.java
===================================================================
--- branches/RF-7654/core/impl/src/main/java/org/richfaces/component/UIScripts.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/core/impl/src/main/java/org/richfaces/component/UIScripts.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -50,7 +50,7 @@
private final List<Object> pageReadyScripts = Lists.newArrayList();
- private String target = "form";
+ private String target = "body";
/* (non-Javadoc)
* @see org.richfaces.component.ScriptsHolder#getScripts()
Modified: branches/RF-7654/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java
===================================================================
--- branches/RF-7654/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -29,10 +29,12 @@
"<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
" xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
" xmlns:h=\"http://java.sun.com/jsf/html\">"+
+ "<h:body>\n"+
"<h:form id=\"helloForm\" >"+
" <h:inputText id=\"input\" value=\"#{test.value}\" />\n" +
" <h:commandButton id=\"command\" value=\"Ok\" action=\"#{test.action}\"/>\n" +
"</h:form>\n" +
+ "</h:body>\n" +
"</html>").
withResource(FacesEnvironment.FACES_CONFIG_XML, "org/richfaces/component/faces-config.xml").
start();
Modified: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -33,9 +33,14 @@
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.javascript.JavaScriptService;
import org.richfaces.renderkit.util.RendererUtils;
import com.google.common.base.Predicate;
+import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
@@ -52,15 +57,13 @@
private static final ImmutableMap<Severity, SeverityAttributes> SEVERITY_MAP = ImmutableMap
.of(FacesMessage.SEVERITY_INFO,
- attrs("infoStyle", "infoClass", "infoMarkerStyle", "infoMarkerClass", "infoLabelStyle", "infoLabelClass"),
+ attrs("info", "inf", null),
FacesMessage.SEVERITY_WARN,
- attrs("warnStyle", "warnClass", "warnMarkerStyle", "warnMarkerClass", "warnLabelStyle", "warnLabelClass"),
+ attrs("warn","wrn", null),
FacesMessage.SEVERITY_ERROR,
- attrs("errorStyle", "errorClass", "errorMarkerStyle", "errorMarkerClass", "errorLabelStyle",
- "errorLabelClass"),
+ attrs("error","err", null),
FacesMessage.SEVERITY_FATAL,
- attrs("fatalStyle", "fatalClass", "fatalMarkerStyle", "fatalMarkerClass", "fatalLabelStyle",
- "fatalLabelClass"));
+ attrs("fatal","ftl",null));
protected Iterator<FacesMessage> getMessages(FacesContext context, String forClientId, UIComponent component) {
@@ -127,19 +130,58 @@
responseWriter.writeText(message.getSummary(),"value");
}
- static SeverityAttributes attrs(String styleAttribute, String classAttribute, String markerStyleAttribute,
- String markerClassAttribute, String labelStyleAttribute, String labelClassAttribute) {
+ protected void encodeScript(FacesContext facesContext, UIComponent component) throws IOException {
+ JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
+ JSFunction messageObject = new JSObject("RichFaces.ui.Message", component.getClientId(facesContext));
+ String forId = (String) component.getAttributes().get("for");
+ if(!Strings.isNullOrEmpty(forId)){
+ UIComponent target = RendererUtils.getInstance().findComponentFor(component, forId);
+ if(null != target){
+ messageObject.addParameter(ImmutableMap.<String, String>of("forComponentId",target.getClientId(facesContext)));
+ }
+ }
+// RendererUtils.getInstance().writeScript(facesContext, component, messageObject);
+ javaScriptService.addPageReadyScript(facesContext, messageObject);
+ }
+
+ protected String getMsgClass(FacesContext facesContext, UIComponent component, Object msg) throws IOException{
+ FacesMessage message = (FacesMessage) msg;
+ SeverityAttributes severityAttributes = SEVERITY_MAP.get(message.getSeverity());
+ String styleClass = buildSeverityAttribute(component, severityAttributes.skinClass, severityAttributes.classAttribute, ' ');
+ return styleClass;
+ }
+
+ protected String getMsgStyle(FacesContext facesContext, UIComponent component, Object msg) throws IOException{
+ FacesMessage message = (FacesMessage) msg;
+ SeverityAttributes severityAttributes = SEVERITY_MAP.get(message.getSeverity());
+ String style = buildSeverityAttribute(component, severityAttributes.skinStyle, severityAttributes.styleAttribute, ';');
+ return style;
+ }
+
+ private String buildSeverityAttribute(UIComponent component, String skinValue, String attrName, char delimiter) {
+ StringBuilder style = new StringBuilder();
+ if(null != skinValue){
+ style.append(skinValue).append(delimiter);
+ }
+ Object componentStyle = component.getAttributes().get(attrName);
+ if(null != componentStyle){
+ style.append(componentStyle);
+ }
+ return style.toString();
+ }
+
+ static SeverityAttributes attrs(String attPrefix, String skinSuffix,String skinStyle) {
SeverityAttributes attrs =
- new SeverityAttributes(styleAttribute, classAttribute, markerStyleAttribute, markerClassAttribute,
- labelStyleAttribute, labelClassAttribute);
+ new SeverityAttributes(attPrefix+"Style", attPrefix+"Class", "rf-msg-"+skinSuffix, skinStyle,
+ null, null);
return attrs;
}
private static final class SeverityAttributes {
private final String styleAttribute;
private final String classAttribute;
- private final String markerStyleAttribute;
- private final String markerClassAttribute;
+ private final String skinStyle;
+ private final String skinClass;
private final String labelStyleAttribute;
private final String labelClassAttribute;
@@ -147,8 +189,8 @@
String markerClassAttribute2, String labelStyleAttribute2, String labelClassAttribute2) {
this.styleAttribute = styleAttribute2;
this.classAttribute = classAttribute2;
- this.markerStyleAttribute = markerStyleAttribute2;
- this.markerClassAttribute = markerClassAttribute2;
+ this.skinStyle = markerStyleAttribute2;
+ this.skinClass = markerClassAttribute2;
this.labelStyleAttribute = labelStyleAttribute2;
this.labelClassAttribute = labelClassAttribute2;
}
Modified: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -8,22 +8,22 @@
public abstract class ValidatorScriptBase extends JSFunctionDefinition implements ComponentValidatorScript {
- protected static final String ELEMENT = "element";
- protected static final JSReference ELEMENT_LITERAL = new JSReference(ELEMENT);
- protected static final String EVENT = "event";
- protected static final JSReference EVENT_LITERAL = new JSReference(EVENT);
- protected static final String DISABLE_AJAX = "disableAjax";
- protected static final String EOL = ";\n";
- protected static final String CLIENT_ID = "clientId";
- protected static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
- protected static final String SOURCE_ID = "sourceId";
- protected static final JSReference SOURCE_ID_LITERAL = new JSReference(SOURCE_ID);
- protected static final NullConverterScript NULL_CONVERTER_SCRIPT = new NullConverterScript();
- protected static final String CSV_NAMESPACE = "RichFaces.csv.";
- protected static final String VALUE_FUNCTION_NAME = CSV_NAMESPACE+"getValue";
- protected static final JSFunction GET_VALUE_FUNCTION = new JSFunction(VALUE_FUNCTION_NAME,CLIENT_ID_LITERAL,ELEMENT_LITERAL);
- protected static final JSFunction SEND_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"sendMessage",CLIENT_ID_LITERAL,new JSReference("e"));
- protected static final JSFunction CLEAR_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"clearMessage",CLIENT_ID_LITERAL);
+ public static final String ELEMENT = "element";
+ public static final JSReference ELEMENT_LITERAL = new JSReference(ELEMENT);
+ public static final String EVENT = "event";
+ public static final JSReference EVENT_LITERAL = new JSReference(EVENT);
+ public static final String DISABLE_AJAX = "disableAjax";
+ public static final String EOL = ";\n";
+ public static final String CLIENT_ID = "clientId";
+ public static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
+ public static final String SOURCE_ID = "sourceId";
+ public static final JSReference SOURCE_ID_LITERAL = new JSReference(SOURCE_ID);
+ public static final NullConverterScript NULL_CONVERTER_SCRIPT = new NullConverterScript();
+ public static final String CSV_NAMESPACE = "RichFaces.csv.";
+ public static final String VALUE_FUNCTION_NAME = CSV_NAMESPACE+"getValue";
+ public static final JSFunction GET_VALUE_FUNCTION = new JSFunction(VALUE_FUNCTION_NAME,CLIENT_ID_LITERAL,ELEMENT_LITERAL);
+ public static final JSFunction SEND_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"sendMessage",CLIENT_ID_LITERAL,new JSReference("e"));
+ public static final JSFunction CLEAR_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"clearMessage",CLIENT_ID_LITERAL);
private boolean bodyProcessed = false;
Modified: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js 2010-12-18 00:11:17 UTC (rev 20674)
@@ -54,16 +54,16 @@
if (!this.options.forComponentId) {
var index = componentHash[data.sourceId];
if (typeof index != undefined) {
- $(rf.getDomElement(this.id+":Content"+index)).remove();
+ $(rf.getDomElement(this.id+index)).remove();
}
- var content = content = $(rf.getDomElement(this.id+":Content"));
+ var content = content = $(rf.getDomElement(this.id));
componentIndex ++;
- if (data.message) content.append('<li id="'+this.id+":Content"+componentIndex+'">'+data.message.summary+'</li>');
+ if (data.message) content.append('<li id="'+this.id+componentIndex+'">'+data.message.summary+'</li>');
componentHash[data.sourceId] = componentIndex;
} else if (this.options.forComponentId==data.sourceId) {
- rf.getDomElement(this.id+":Content").innerHTML = data.message ? '<li>'+data.message.summary+'</li>' : '';
+ rf.getDomElement(this.id).innerHTML = data.message ? '<li>'+data.message.summary+'</li>' : '';
}
}
Added: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties 2010-12-18 00:11:17 UTC (rev 20674)
@@ -0,0 +1 @@
+resources=jquery.js, richfaces.js, richfaces-event.js, richfaces-base-component.js, org.richfaces:message.js
\ No newline at end of file
Property changes on: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml 2010-12-18 00:11:17 UTC (rev 20674)
@@ -1,46 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright ${year}, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-
-This software 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 software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
- xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite" xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
- xmlns:xi="http://www.w3.org/2001/XInclude">
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors. This is
+ free software; you can redistribute it and/or modify it under the terms of
+ the GNU Lesser General Public License as published by the Free Software Foundation;
+ either version 2.1 of the License, or (at your option) any later version.
+ This software 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 software; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the
+ FSF site: http://www.fsf.org. -->
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+ xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:xi="http://www.w3.org/2001/XInclude">
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.HtmlMessageRenderer</cdk:class>
<cdk:superclass>org.richfaces.renderkit.MessageRendererBase</cdk:superclass>
<cdk:component-family>javax.faces.Message</cdk:component-family>
<cdk:renderer-type>org.richfaces.MessageRenderer</cdk:renderer-type>
- <cdk:resource-dependency library="org.richfaces" name="base-component.reslib" />
- <cdk:resource-dependency library="org.richfaces" name="message.js" />
+ <cdk:resource-dependency library="org.richfaces"
+ name="message.reslib" />
</cc:interface>
<cc:implementation>
- <span id="#{clientId}" class="rf-msg #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
- <ul id="#{clientId}:Content" >
- <c:forEach var="msg" items="#{getVisibleMessages(facesContext,component)}">
- <li><cdk:call>encodeMessage(facesContext,component,msg)</cdk:call></li>
- </c:forEach>
- </ul>
- </span>
+ <ul id="#{clientId}" class="rf-msg #{component.attributes['styleClass']}"
+ cdk:passThroughWithExclusions="id class">
+ <c:forEach var="msg"
+ items="#{getVisibleMessages(facesContext,component)}">
+ <li class="#{getMsgClass(facesContext,component,msg)}" style="#{getMsgStyle(facesContext,component,msg)}">
+ <cdk:call>encodeMessage(facesContext,component,msg)</cdk:call>
+ </li>
+ </c:forEach>
+ <cdk:call>encodeScript(facesContext,component)</cdk:call>
+ </ul>
</cc:implementation>
</cdk:root>
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -44,7 +44,7 @@
@Test
public void testRequest() throws Exception {
HtmlPage page = requestPage();
- HtmlInput input = hetInput(page);
+ HtmlInput input = getInput(page);
assertNotNull(input);
}
@@ -66,14 +66,14 @@
private void submitValueAndCheckMesage(String value, Matcher<String> matcher) throws Exception {
HtmlPage page = requestPage();
- HtmlInput input = hetInput(page);
+ HtmlInput input = getInput(page);
input.setValueAttribute(value);
- input.fireEvent("keyup");
- HtmlElement message = page.getElementById("form:message");
+ input.fireEvent("blur");
+ HtmlElement message = page.getElementById("form:uiMessage");
assertThat(message.getTextContent(), matcher);
// System.out.println(page.asXml());
}
- private HtmlInput hetInput(HtmlPage page) {
+ private HtmlInput getInput(HtmlPage page) {
HtmlForm htmlForm = page.getFormByName("form");
assertNotNull(htmlForm);
HtmlInput input = htmlForm.getInputByName("form:text");
@@ -82,7 +82,7 @@
private HtmlPage requestPage() throws MalformedURLException, IOException {
HtmlPage page = environment.getPage("/test.jsf");
-// System.out.println(page.asXml());
+ System.out.println(page.asXml());
return page;
}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -45,17 +45,17 @@
@Test
public void testRequest() throws Exception {
HtmlPage page = requestPage();
- HtmlInput input = hetInput(page);
+ HtmlInput input = getInput(page);
assertNotNull(input);
}
- @Test @Ignore
+ @Test
public void testSubmitTooShortValue() throws Exception {
submitValueAndCheckMesage("",containsString("Error"));
}
- @Test @Ignore
+ @Test
public void testSubmitTooLongValue() throws Exception {
submitValueAndCheckMesage("123456",containsString("Error"));
}
@@ -67,14 +67,15 @@
private void submitValueAndCheckMesage(String value, Matcher<String> matcher) throws Exception {
HtmlPage page = requestPage();
- HtmlInput input = hetInput(page);
- input.setValueAttribute(value);
- input.fireEvent("keyup");
- HtmlElement message = page.getElementById("form:message");
+ HtmlInput input = getInput(page);
+ page = (HtmlPage) input.setValueAttribute(value);
+ input.fireEvent("blur");
+ System.out.println(page.asXml());
+ HtmlElement message = page.getElementById("form:uiMessage");
assertThat(message.getTextContent(), matcher);
-// System.out.println(page.asXml());
}
- private HtmlInput hetInput(HtmlPage page) {
+
+ private HtmlInput getInput(HtmlPage page) {
HtmlForm htmlForm = page.getFormByName("form");
assertNotNull(htmlForm);
HtmlInput input = htmlForm.getInputByName("form:text");
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -41,6 +41,7 @@
@Test
public void testClear() throws Exception {
+ setUpMessage();
sendMessage();
HtmlElement htmlElement = getMessageContentElement();
String text = htmlElement.asText();
Added: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -0,0 +1,53 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript.client.message;
+
+import static org.junit.Assert.*;
+
+import org.jboss.test.qunit.Qunit.Builder;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class DocumentReadyTest extends MessageTestBase {
+
+ @Override
+ protected Builder createQunitPage() {
+ return super.createQunitPage().loadContent("$(document).ready(function(){"+MESSAGE_INIT+"});");
+ }
+
+ @Test
+ public void testSend() throws Exception {
+ sendMessage();
+ HtmlElement htmlElement = getMessageContentElement();
+ String text = htmlElement.asText();
+ assertTrue(text.contains(getErrorMessage().getSummary()));
+ }
+
+}
Property changes on: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -16,22 +16,24 @@
@Rule
public final Qunit qunit;
- public static final String COMPONENT = "component";
+ public static final String COMPONENT = "form:component";
- public static final String MY_MESSAGE = "myMessage";
+ public static final String MY_MESSAGE = "form:uiMessage";
+ public static final String MESSAGE_INIT = "new RichFaces.ui.Message(\"" + MY_MESSAGE + "\", {forComponentId:\"" + COMPONENT + "\"})";
+
public MessageTestBase() {
this.qunit = createQunitPage().build();
}
public void setUpMessage(){
- qunit.runScript("new RichFaces.ui.Message(\"" + MY_MESSAGE + "\", {forComponentId:\"" + COMPONENT + "\"})");
+ qunit.runScript(MESSAGE_INIT);
}
protected Builder createQunitPage() {
return Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
.loadJsfResource("richfaces-event.js").loadJsfResource("richfaces-base-component.js").
- loadJsfResource("csv.js", "org.richfaces").loadJsfResource("message.js", "org.richfaces").content("<div id=\"" + MY_MESSAGE + "\" ><ul id=\"" + MY_MESSAGE + ":Content\">"+getMessageContent()+"</ul></div>");
+ loadJsfResource("csv.js", "org.richfaces").loadJsfResource("message.js", "org.richfaces").content("<div id=\"foo\" ><ul id=\"" + MY_MESSAGE + "\">"+getMessageContent()+"</ul></div>");
}
@@ -40,7 +42,6 @@
}
protected Object sendMessage() {
- setUpMessage();
JSFunction clientSideFunction = new JSFunction("RichFaces.csv." + getJavaScriptFunctionName(),COMPONENT,getErrorMessage());
return qunit.runScript(clientSideFunction.toScript());
@@ -55,7 +56,7 @@
protected HtmlElement getMessageContentElement() {
HtmlPage page = qunit.getPage();
- HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
+ HtmlElement htmlElement = page.getElementById(MY_MESSAGE);
assertNotNull(htmlElement);
return htmlElement;
}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-18 00:11:17 UTC (rev 20674)
@@ -38,6 +38,7 @@
@Test
public void testSend() throws Exception {
+ setUpMessage();
sendMessage();
HtmlElement htmlElement = getMessageContentElement();
String text = htmlElement.asText();
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-18 00:11:17 UTC (rev 20674)
@@ -7,10 +7,10 @@
<h:form id="form">
<h:inputText id="text" value="#{test.value}">
<f:validateLength minimum="1" maximum="3"/>
- <csv:validator event="keyup" />
+ <csv:validator event="blur" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <csv:message id="message" for="text" />
+ <csv:message id="uiMessage" for="text" />
</h:form>
</h:body>
</html>
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-17 23:38:58 UTC (rev 20673)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-18 00:11:17 UTC (rev 20674)
@@ -7,10 +7,10 @@
<h:form id="form">
<h:inputText id="text" value="#{test.value}">
<f:validator validatorId="custom" />
- <csv:validator event="keyup" />
+ <csv:validator event="blur" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <csv:message id="message" for="text" />
+ <csv:message id="uiMessage" for="text" />
</h:form>
</h:body>
</html>
14 years
JBoss Rich Faces SVN: r20673 - in trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main: webapp-gae/WEB-INF and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 18:38:58 -0500 (Fri, 17 Dec 2010)
New Revision: 20673
Modified:
trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp-gae/WEB-INF/web.xml
trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
Log:
https://issues.jboss.org/browse/RF-10051
Modified: trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml 2010-12-17 20:54:32 UTC (rev 20672)
+++ trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml 2010-12-17 23:38:58 UTC (rev 20673)
@@ -5,15 +5,15 @@
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>RichFaces 4 GAE Application</display-name>
- <context-param>
- <param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.SKIP_COMMENTS</param-name>
- <param-value>true</param-value>
- </context-param>
<context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.SKIP_COMMENTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
@@ -25,30 +25,30 @@
<param-name>org.richfaces.skin</param-name>
<param-value>blueSky</param-value>
</context-param>
- <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>*.jsf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <session-config>
- <session-timeout>30</session-timeout>
- </session-config>
- <mime-mapping>
- <extension>ecss</extension>
- <mime-type>text/css</mime-type>
- </mime-mapping>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+ <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>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
- <login-config>
- <auth-method>BASIC</auth-method>
- </login-config>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
</web-app>
Modified: trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp-gae/WEB-INF/web.xml
===================================================================
--- trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp-gae/WEB-INF/web.xml 2010-12-17 20:54:32 UTC (rev 20672)
+++ trunk/archetypes/rf-gae-sample/src/main/resources/archetype-resources/src/main/webapp-gae/WEB-INF/web.xml 2010-12-17 23:38:58 UTC (rev 20673)
@@ -32,7 +32,7 @@
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
+ <param-value>client</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.staticResourceLocation</param-name>
14 years
JBoss Rich Faces SVN: r20672 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-17 15:54:32 -0500 (Fri, 17 Dec 2010)
New Revision: 20672
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
Log:
fix NPE bug
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-17 19:59:51 UTC (rev 20671)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-17 20:54:32 UTC (rev 20672)
@@ -37,7 +37,8 @@
increaseSelectedClass: "rf-insl-inc-sel",
init: function (id, options, selectedClasses) {
- jQuery.extend(this, options);
+ $superInputNumberSlider.constructor.call(this, id);
+ jQuery.extend(this, options);
this.range = this.maxValue - this.minValue;
this.id = id;
this.element = jQuery(this.attachToDom());
@@ -182,7 +183,8 @@
destroy: function (event) {
jQuery(document).unbind("mousemove", this.__mousemoveHandler);
- $super.destroy.call(this);
+ $superInputNumberSlider.destroy.call(this);
}
});
+ $superInputNumberSlider = richfaces.ui.InputNumberSlider.$super;
}(window.RichFaces, jQuery));
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20671 - trunk/examples/dnd-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-17 14:59:51 -0500 (Fri, 17 Dec 2010)
New Revision: 20671
Modified:
trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
fix examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Modified: trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
===================================================================
--- trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-17 19:58:01 UTC (rev 20670)
+++ trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-17 19:59:51 UTC (rev 20671)
@@ -58,21 +58,21 @@
<tr>
<td><a4j:outputPanel id="drg1" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue1}"/>
- <dnd:dragBehavior event="mouseover" type="drg1" dragValue="#{dataBean.dragValue1}"/>
+ <dnd:dragSource type="drg1" dragValue="#{dataBean.dragValue1}"/>
</a4j:outputPanel></td>
<td><a4j:outputPanel id="drg2" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue2}"/>
- <dnd:dragBehavior event="mouseover" type="drg2" dragIndicator="ind" dragValue="#{dataBean.dragValue2}"/>
+ <dnd:dragSource type="drg2" dragIndicator="ind" dragValue="#{dataBean.dragValue2}"/>
</a4j:outputPanel></td>
<td><a4j:outputPanel id="drg3" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue3}"/>
- <dnd:dragBehavior event="mouseover" type="drg3" dragIndicator="ind" dragValue="#{dataBean.dragValue3}"/>
+ <dnd:dragSource type="drg3" dragIndicator="ind" dragValue="#{dataBean.dragValue3}"/>
</a4j:outputPanel></td>
</tr>
</table>
<a4j:outputPanel id="drp" layout="block" styleClass="droppable">
- <dnd:dropBehavior event="mouseover" acceptedTypes="drg1, drg2" listener="#{dataBean.processEvent}" render="grid"></dnd:dropBehavior>
+ <dnd:dropTarget acceptedTypes="drg1, drg2" dropListener="#{dataBean.processEvent}" render="grid"></dnd:dropTarget>
<h:dataTable id="grid" var="dropValue" value="#{dataBean.dropValues}">
<h:column>
<h:outputText value="#{dropValue}"/>
14 years
JBoss Rich Faces SVN: r20670 - in trunk/ui/dnd/api/src/main/java/org/richfaces: event and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-17 14:58:01 -0500 (Fri, 17 Dec 2010)
New Revision: 20670
Removed:
trunk/ui/dnd/api/src/main/java/org/richfaces/component/
trunk/ui/dnd/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
Modified:
trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropListener.java
Log:
redesign dnd behavior to dnd component
Modified: trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-17 19:57:18 UTC (rev 20669)
+++ trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-17 19:58:01 UTC (rev 20670)
@@ -23,53 +23,43 @@
package org.richfaces.event;
import javax.faces.component.UIComponent;
-import javax.faces.event.BehaviorEvent;
+import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
-import org.richfaces.component.behavior.ClientDragBehavior;
-import org.richfaces.component.behavior.ClientDropBehavior;
-
/**
* @author abelevich
*
*/
-public class DropEvent extends BehaviorEvent {
+public class DropEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -8093828320587434589L;
- private static final long serialVersionUID = 3717071628237886288L;
+ private UIComponent dragSource;
- private ClientDragBehavior dragBehavior;
+ private UIComponent dropTarget;
- private UIComponent dragComponent;
-
- private ClientDropBehavior dropBehavior;
-
- private UIComponent dropComponent;
-
private Object dropValue;
private Object dragValue;
-
- public DropEvent(UIComponent component, ClientDropBehavior behavior) {
- super(component, behavior);
- this.dropComponent = component;
- this.dropBehavior = behavior;
+
+ public DropEvent(UIComponent dragSource, UIComponent dropTarget) {
+ super(dropTarget);
}
-
-
- public void setDropBehavior(ClientDropBehavior dropBehavior) {
- this.dropBehavior = dropBehavior;
+
+ public UIComponent getDragSource() {
+ return dragSource;
}
-
- public ClientDropBehavior getDropBehavior() {
- return this.dropBehavior;
+
+ public void setDragSource(UIComponent dragSource) {
+ this.dragSource = dragSource;
}
-
- public void setDropComponent(UIComponent dropComponent) {
- this.dropComponent = dropComponent;
+
+ public UIComponent getDropTarget() {
+ return dropTarget;
}
-
- public UIComponent getDropComponent() {
- return this.dropComponent;
+
+ public void setDropTarget(UIComponent dropTarget) {
+ this.dropTarget = dropTarget;
}
public Object getDropValue() {
@@ -88,22 +78,6 @@
this.dragValue = dragValue;
}
- public ClientDragBehavior getDragBehavior() {
- return dragBehavior;
- }
-
- public void setDragBehavior(ClientDragBehavior dragBehavior) {
- this.dragBehavior = dragBehavior;
- }
-
- public UIComponent getDragComponent() {
- return dragComponent;
- }
-
- public void setDragComponent(UIComponent dragComponent) {
- this.dragComponent = dragComponent;
- }
-
@Override
public boolean isAppropriateListener(FacesListener listener) {
return (listener instanceof DropListener);
Modified: trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropListener.java
===================================================================
--- trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropListener.java 2010-12-17 19:57:18 UTC (rev 20669)
+++ trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropListener.java 2010-12-17 19:58:01 UTC (rev 20670)
@@ -22,14 +22,14 @@
package org.richfaces.event;
-import javax.faces.event.BehaviorListener;
+import javax.faces.event.FacesListener;
/**
* @author abelevich
*
*/
-public interface DropListener extends BehaviorListener {
+public interface DropListener extends FacesListener {
public void processDrop(DropEvent event);
Deleted: trunk/ui/dnd/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
===================================================================
--- trunk/ui/dnd/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java 2010-12-17 19:57:18 UTC (rev 20669)
+++ trunk/ui/dnd/api/src/main/java/org/richfaces/event/MethodExpressionDropListener.java 2010-12-17 19:58:01 UTC (rev 20670)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.event;
-
-import javax.el.MethodExpression;
-import javax.faces.context.FacesContext;
-
-
-/**
- * @author abelevich
- *
- */
-public class MethodExpressionDropListener implements DropListener {
- private MethodExpression methodExpression;
-
- public MethodExpressionDropListener() {
- super();
- }
-
- public MethodExpressionDropListener(MethodExpression methodExpression) {
- super();
- this.methodExpression = methodExpression;
- }
-
- public void processDrop(DropEvent event) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
- }
-}
14 years
JBoss Rich Faces SVN: r20669 - in trunk/ui/dnd/ui/src/main: java/org/richfaces/component and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-17 14:57:18 -0500 (Fri, 17 Dec 2010)
New Revision: 20669
Added:
trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDragSource.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDropTarget.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/event/
trunk/ui/dnd/ui/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/
trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DragScript.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DropScript.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDRenderBase.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragSourceRenderer.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropTargetRenderer.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropHandler.java
Removed:
trunk/ui/dnd/ui/src/main/java/org/richfaces/component/behavior/
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/tag/
Modified:
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
Log:
redesign dnd behaviors to dnd components
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDragSource.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDragSource.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDragSource.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.ajax4jsf.component.AjaxComponent;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author abelevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDragSource.COMPONENT_TYPE,
+ family = AbstractDragSource.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDragSource",
+ renderer = @JsfRenderer(type = "org.richfaces.DragSourceRenderer"),
+ tag = @Tag(name="dragSource")
+)
+public abstract class AbstractDragSource extends UIComponentBase implements AjaxComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DragSource";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.DragSource";
+
+
+ @Attribute
+ public abstract String getDragIndicator();
+
+ @Attribute
+ public abstract String getType();
+
+ @Attribute
+ public abstract Object getDragValue();
+
+}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDropTarget.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDropTarget.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/component/AbstractDropTarget.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.event.DropEvent;
+import org.richfaces.event.DropListener;
+
+/**
+ * @author abelevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDropTarget.COMPONENT_TYPE,
+ family = AbstractDropTarget.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDropTarget",
+ renderer = @JsfRenderer(type = "org.richfaces.DropTargetRenderer"),
+ tag = @Tag(name="dropTarget" ,handler="org.richfaces.view.facelets.DropHandler", type = TagType.Facelets)
+)
+public abstract class AbstractDropTarget extends AbstractActionComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DropTarget";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.DropTarget";
+
+
+ @Attribute
+ public abstract Object getDropValue();
+
+ public abstract Object getAcceptedTypes();
+
+ public void addDropListener(DropListener listener) {
+ addFacesListener(listener);
+ }
+
+ public void removeDropListener(DropListener listener) {
+ removeFacesListener(listener);
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ if(event instanceof DropEvent) {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ super.queueEvent(event);
+ }
+}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/event/MethodExpressionDropListener.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/event/MethodExpressionDropListener.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/event/MethodExpressionDropListener.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+
+/**
+ * @author abelevich
+ *
+ */
+public class MethodExpressionDropListener implements DropListener {
+ private MethodExpression methodExpression;
+
+ public MethodExpressionDropListener() {
+ super();
+ }
+
+ public MethodExpressionDropListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processDrop(DropEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,83 @@
+package org.richfaces.javascript;
+
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.ajax4jsf.javascript.ScriptWithDependencies;
+import org.richfaces.resource.ResourceKey;
+
+public abstract class DnDScript implements ScriptWithDependencies {
+
+ private static final Set<ResourceKey> BASE_RESOURCES = new LinkedHashSet<ResourceKey>();
+
+ static {
+ BASE_RESOURCES.add(new ResourceKey("jquery.js", null));
+ BASE_RESOURCES.add(new ResourceKey("jquery.position.js", null));
+ BASE_RESOURCES.add(new ResourceKey("richfaces.js", null));
+ BASE_RESOURCES.add(new ResourceKey("jquery-ui-core.js", "org.richfaces"));
+ BASE_RESOURCES.add(new ResourceKey("jquery-dnd.js", "org.richfaces"));
+ }
+
+ private final String name;
+
+ public DnDScript(String name) {
+ this.name = name;
+ }
+
+ public Set<ResourceKey> getBaseResources() {
+ return BASE_RESOURCES;
+ }
+
+ public void appendScriptToStringBuilder(StringBuilder stringBuilder) {
+ try {
+ appendScript(stringBuilder);
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ public String toScript() {
+ return name;
+ }
+
+ public void appendScript(Appendable target) throws IOException {
+ target.append(name);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ DnDScript other = (DnDScript) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+
+ return true;
+ }
+
+}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DragScript.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DragScript.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DragScript.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,24 @@
+package org.richfaces.javascript;
+
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.richfaces.resource.ResourceKey;
+
+public final class DragScript extends DnDScript{
+
+ private static final Set<ResourceKey> DRAG_SCRIPT = Collections.singleton(new ResourceKey("dnd-draggable.js", "org.richfaces"));
+
+ public DragScript(String name) {
+ super(name);
+ }
+
+ public Iterable<ResourceKey> getResources() {
+ Set<ResourceKey> dragResourceKeys = new LinkedHashSet<ResourceKey>();
+ dragResourceKeys.addAll(getBaseResources());
+ dragResourceKeys.addAll(DRAG_SCRIPT);
+ return dragResourceKeys;
+ }
+
+}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DropScript.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DropScript.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DropScript.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,24 @@
+package org.richfaces.javascript;
+
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.richfaces.resource.ResourceKey;
+
+public final class DropScript extends DnDScript{
+
+ private static final Set<ResourceKey> DRAG_SCRIPT = Collections.singleton(new ResourceKey("dnd-droppable.js", "org.richfaces"));
+
+ public DropScript(String name) {
+ super(name);
+ }
+
+ public Iterable<ResourceKey> getResources() {
+ Set<ResourceKey> dragResourceKeys = new LinkedHashSet<ResourceKey>();
+ dragResourceKeys.addAll(getBaseResources());
+ dragResourceKeys.addAll(DRAG_SCRIPT);
+ return dragResourceKeys;
+ }
+
+}
Deleted: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDBehaviorRenderBase.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.renderkit;
-
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.render.ClientBehaviorRenderer;
-
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
-import org.richfaces.renderkit.util.RendererUtils;
-
-/**
- * @author abelevich
- *
- */
-public abstract class DnDBehaviorRenderBase extends ClientBehaviorRenderer {
-
- private static final RendererUtils UTILS = RendererUtils.getInstance();
-
-
- protected abstract Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior clientBehavior);
-
- protected abstract String getScriptName();
-
- public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
- UIComponent parent = behaviorContext.getComponent();
- String scriptName = getScriptName();
- String script = null;
- if(!"".equals(scriptName)) {
- JSFunction function = new JSFunction(scriptName);
- function.addParameter(JSReference.EVENT);
- function.addParameter(parent.getClientId(behaviorContext.getFacesContext()));
- function.addParameter(getOptions(behaviorContext, behavior));
- script = function.toScript();
- }
- return script;
- }
-
- public RendererUtils getUtils() {
- return UTILS;
- }
-
-}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDRenderBase.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDRenderBase.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DnDRenderBase.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,57 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.javascript.DnDScript;
+import org.richfaces.javascript.JavaScriptService;
+
+
+/**
+ * @author abelevich
+ *
+ */
+public abstract class DnDRenderBase extends RendererBase{
+
+ public void buildAndStoreScript(FacesContext facesContext, UIComponent component) {
+ JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
+ DnDScript dragScript = buildClientScript(facesContext, component);
+ if(javaScriptService != null && dragScript != null) {
+ javaScriptService.addPageReadyScript(facesContext, dragScript);
+ }
+ }
+
+ public abstract Map<String, Object> getOptions(FacesContext facesContext, UIComponent component);
+
+ public abstract String getScriptName();
+
+ public abstract DnDScript createScript(String name);
+
+ public String getParentClientId(FacesContext facesContext, UIComponent component) {
+ UIComponent parent = component.getParent();
+ return (parent != null) ? parent.getClientId(facesContext) : "";
+ }
+
+ private DnDScript buildClientScript(FacesContext facesContext, UIComponent component) {
+ DnDScript script = null;
+ String scriptName = getScriptName();
+ if(!"".equals(scriptName)) {
+ JSFunction function = new JSFunction(scriptName);
+ function.addParameter(component.getClientId(facesContext));
+ function.addParameter(getOptions(facesContext, component));
+ script = createScript(function.toScript());
+ }
+ return script;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ buildAndStoreScript(context, component);
+ }
+}
Deleted: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.renderkit;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.context.FacesContext;
-import javax.faces.render.FacesBehaviorRenderer;
-import javax.faces.render.RenderKitFactory;
-
-import org.richfaces.component.behavior.ClientDragBehavior;
-import org.richfaces.component.behavior.DragBehavior;
-
-/**
- * @author abelevich
- *
- */
-
-
-@FacesBehaviorRenderer(rendererType = DragBehavior.BEHAVIOR_ID, renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
-
-@ResourceDependencies({
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-ui-core.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-dnd.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-draggable.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
-})
-public class DragBehaviorRendererBase extends DnDBehaviorRenderBase {
-
- public Map<String, Object> getOptions(ClientBehaviorContext clientBehaviorContext, ClientBehavior behavior) {
- Map<String, Object> options = new HashMap<String, Object>();
- if(behavior instanceof ClientDragBehavior) {
- ClientDragBehavior dragBehavior = (ClientDragBehavior)behavior;
- options.put("indicator", getDragIndicatorClientId(clientBehaviorContext, dragBehavior));
- options.put("type", dragBehavior.getType());
- }
- return options;
- }
-
- @Override
- protected String getScriptName() {
- return "RichFaces.ui.DnDManager.draggable";
- }
-
- public String getDragIndicatorClientId(ClientBehaviorContext clientBehaviorContext, ClientDragBehavior dragBehavior) {
- String indicatorId = dragBehavior.getDragIndicator();
- if(indicatorId != null) {
- FacesContext facesContext = clientBehaviorContext.getFacesContext();
- UIComponent clientBehaviorHolder = clientBehaviorContext.getComponent();
- UIComponent indicator = getUtils().findComponentFor(facesContext, clientBehaviorHolder, indicatorId);
-
- if(indicator != null) {
- indicatorId = indicator.getClientId(facesContext);
- }
- }
- return indicatorId;
- }
-}
Modified: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -24,8 +24,12 @@
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import org.richfaces.component.AbstractDragSource;
+
/**
* @author abelevich
*
@@ -39,4 +43,16 @@
@ResourceDependency(library = "org.richfaces", name = "dnd-indicator.js"),
@ResourceDependency(library = "org.richfaces", name = "indicator.ecss") })
public class DragIndicatorRendererBase extends RendererBase {
+
+
+ public String getDragIndicatorClientId(FacesContext facesContext, AbstractDragSource dragSource) {
+ String indicatorId = dragSource.getDragIndicator();
+ if(!"".equals(indicatorId)) {
+ UIComponent indicator = getUtils().findComponentFor(facesContext, dragSource, indicatorId);
+ if(indicator != null) {
+ indicatorId = indicator.getClientId(facesContext);
+ }
+ }
+ return indicatorId;
+ }
}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragSourceRenderer.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragSourceRenderer.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DragSourceRenderer.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,55 @@
+package org.richfaces.renderkit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDragSource;
+import org.richfaces.javascript.DnDScript;
+import org.richfaces.javascript.DragScript;
+
+/**
+ * @author abelevich
+ *
+ */
+
+@JsfRenderer(type = "org.richfaces.DragSourceRenderer", family = AbstractDragSource.COMPONENT_FAMILY)
+public class DragSourceRenderer extends DnDRenderBase {
+
+ @Override
+ public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) {
+ Map<String, Object> options = new HashMap<String, Object>();
+ if(component instanceof AbstractDragSource) {
+ AbstractDragSource dragSource = (AbstractDragSource)component;
+ options.put("indicator", getDragIndicatorClientId(facesContext, dragSource));
+ options.put("type", dragSource.getType());
+ options.put("parentId", getParentClientId(facesContext, component));
+ }
+ return options;
+ }
+
+ @Override
+ public String getScriptName() {
+ return "new RichFaces.ui.Draggable";
+ }
+
+ @Override
+ public DnDScript createScript(String name) {
+ return new DragScript(name);
+ }
+
+ public String getDragIndicatorClientId(FacesContext facesContext, AbstractDragSource dragSource) {
+ String indicatorId = dragSource.getDragIndicator();
+ if(indicatorId != null) {
+ UIComponent indicator = getUtils().findComponentFor(facesContext, dragSource, indicatorId);
+ if(indicator != null) {
+ indicatorId = indicator.getClientId(facesContext);
+ }
+ }
+ return indicatorId;
+ }
+
+}
Deleted: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -1,196 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.renderkit;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.ActionSource;
-import javax.faces.component.ContextCallback;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
-import javax.faces.render.FacesBehaviorRenderer;
-import javax.faces.render.RenderKitFactory;
-
-import org.richfaces.component.behavior.ClientDragBehavior;
-import org.richfaces.component.behavior.ClientDropBehavior;
-import org.richfaces.component.behavior.DropBehavior;
-import org.richfaces.event.DropEvent;
-
-
-/**
- * @author abelevich
- *
- */
-
-
-@FacesBehaviorRenderer(rendererType = DropBehavior.BEHAVIOR_ID, renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
-
-@ResourceDependencies({
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-ui-core.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-dnd.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-droppable.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
-})
-public class DropBehaviorRendererBase extends DnDBehaviorRenderBase {
-
- @Override
- public void decode(FacesContext facesContext, UIComponent component, ClientBehavior behavior) {
- if (null == facesContext || null == component || behavior == null) {
- throw new NullPointerException();
- }
-
- Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
- String dragSource = (String) requestParamMap.get("dragSource");
-
- DragBehaviorContextCallBack dragBehaviorContextCallBack = new DragBehaviorContextCallBack();
- facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, dragBehaviorContextCallBack);
-
- if(behavior instanceof ClientDropBehavior) {
- ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
- DropEvent dropEvent = new DropEvent(component, dropBehavior);
- dropEvent.setDropValue(dropBehavior.getDropValue());
- dropEvent.setDragComponent(dragBehaviorContextCallBack.getDragComponent());
- dropEvent.setDragBehavior(dragBehaviorContextCallBack.getDragBehavior());
- dropEvent.setDragValue(dragBehaviorContextCallBack.getDragValue());
- queueEvent(dropEvent);
- }
- }
-
- @Override
- protected String getScriptName() {
- return "RichFaces.ui.DnDManager.droppable";
- }
-
- public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
- Map<String, Object> options = new HashMap<String, Object>();
-
- if(behavior instanceof ClientDropBehavior) {
- ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
- options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
- }
- return options;
- }
-
- private final class DragBehaviorContextCallBack implements ContextCallback {
-
- private Object dragValue;
-
- private ClientDragBehavior dragBehavior;
-
- private UIComponent dragComponent;
-
- public void invokeContextCallback(FacesContext context, UIComponent target) {
- ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
- this.dragValue = dragBehavior.getDragValue();
- this.dragBehavior = dragBehavior;
- this.dragComponent = target;
- }
-
- public Object getDragValue() {
- return dragValue;
- }
-
- public ClientDragBehavior getDragBehavior() {
- return dragBehavior;
- }
-
- public UIComponent getDragComponent() {
- return dragComponent;
- }
-
- private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
- if(parent instanceof ClientBehaviorHolder) {
- Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
- Set<Map.Entry<String, List<ClientBehavior>>> entries = behaviorsMap.entrySet();
-
- for(Entry<String, List<ClientBehavior>> entry: entries) {
- if(event.equals(entry.getKey())){
- List<ClientBehavior> behaviors = entry.getValue();
- for(ClientBehavior behavior: behaviors) {
- if(behavior instanceof ClientDragBehavior) {
- return (ClientDragBehavior)behavior;
- }
- }
- }
- }
-
- }
- return null;
- }
-
- }
-
- protected void queueEvent(DropEvent dropEvent){
- UIComponent component = dropEvent.getComponent();
- ClientDropBehavior dropBehavior = dropEvent.getDropBehavior();
-
- if(component != null && dropBehavior != null) {
- PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
-
- if (isImmediate(component, dropBehavior)) {
- phaseId = PhaseId.APPLY_REQUEST_VALUES;
- } else if (isBypassUpdates(component, dropBehavior)) {
- phaseId = PhaseId.PROCESS_VALIDATIONS;
- }
-
- dropEvent.setPhaseId(phaseId);
- component.queueEvent(dropEvent);
- }
- }
-
- private boolean isImmediate(UIComponent component, ClientDropBehavior dropBehavior){
- boolean immediate = dropBehavior.isImmediate();
- if(!immediate) {
- if (component instanceof EditableValueHolder) {
- immediate = ((EditableValueHolder) component).isImmediate();
- } else if (component instanceof ActionSource) {
- immediate = ((ActionSource) component).isImmediate();
- }
- }
- return immediate;
- }
-
- private boolean isBypassUpdates(UIComponent component, ClientDropBehavior dropBehavior){
- boolean bypassUpdates = dropBehavior.isBypassUpdates();
- if (!bypassUpdates) {
- bypassUpdates = getUtils().isBooleanAttribute(component, "bypassUpdates");
- }
- return bypassUpdates;
- }
-
-}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropTargetRenderer.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropTargetRenderer.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropTargetRenderer.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,103 @@
+package org.richfaces.renderkit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.ContextCallback;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDragSource;
+import org.richfaces.component.AbstractDropTarget;
+import org.richfaces.event.DropEvent;
+import org.richfaces.javascript.DnDScript;
+import org.richfaces.javascript.DropScript;
+import org.richfaces.renderkit.util.AjaxRendererUtils;
+import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
+
+
+/**
+ * @author abelevich
+ *
+ */
+
+@JsfRenderer(type = "org.richfaces.DropTargetRenderer", family = AbstractDropTarget.COMPONENT_FAMILY)
+public class DropTargetRenderer extends DnDRenderBase {
+
+ @Override
+ protected void doDecode(FacesContext facesContext, UIComponent component) {
+ if(component instanceof AbstractDropTarget) {
+ Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
+ String dragSourceId = (String) requestParamMap.get("dragSource");
+
+ if(!"".equals(dragSourceId)) {
+ DragSourceContextCallBack dragSourceContextCallBack = new DragSourceContextCallBack();
+ facesContext.getViewRoot().invokeOnComponent(facesContext, dragSourceId, dragSourceContextCallBack);
+
+ AbstractDropTarget dropTarget = (AbstractDropTarget)component;
+ DropEvent dropEvent = new DropEvent(dragSourceContextCallBack.getDragSource(), dropTarget);
+ dropEvent.setDragValue(dragSourceContextCallBack.getDragValue());
+ dropEvent.setDropValue(dropTarget.getDropValue());
+ dropEvent.queue();
+ }
+ }
+ }
+
+ private final class DragSourceContextCallBack implements ContextCallback {
+
+ private AbstractDragSource dragSource;
+
+ private Object dragValue;
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ if(target instanceof AbstractDragSource) {
+ this.dragSource = (AbstractDragSource)target;
+ this.dragValue = this.dragSource.getDragValue();
+ }
+ }
+
+ public AbstractDragSource getDragSource() {
+ return dragSource;
+ }
+
+ public Object getDragValue() {
+ return dragValue;
+ }
+ }
+
+ @Override
+ public DnDScript createScript(String name) {
+ return new DropScript(name);
+ }
+
+ @Override
+ public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) {
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ if(component instanceof AbstractDropTarget) {
+ JSReference dragSourceId = new JSReference("dragSourceId");
+ JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId);
+
+ AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component);
+ ajaxFunction.getOptions().setParameter("dragSource", dragSourceId);
+ ajaxFunction.setSource(new JSReference("event", "target"));
+ ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext));
+ function.addToBody(ajaxFunction);
+
+ AbstractDropTarget dropTarget = (AbstractDropTarget)component;
+ options.put("acceptedTypes", CoreAjaxRendererUtils.asSimpleSet(dropTarget.getAcceptedTypes()));
+ options.put("ajaxFunction", function);
+ options.put("parentId", getParentClientId(facesContext, component));
+ }
+ return options;
+ }
+
+ @Override
+ public String getScriptName() {
+ return "new RichFaces.ui.Droppable";
+ }
+
+}
Deleted: trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.view.facelets;
-
-import javax.faces.view.facelets.BehaviorConfig;
-import javax.faces.view.facelets.MetaRuleset;
-
-import org.richfaces.view.facelets.html.CustomBehaviorHandler;
-import org.richfaces.view.facelets.tag.DropBehaviorRule;
-
-/**
- * @author abelevich
- *
- */
-public class DropBehaviorHandler extends CustomBehaviorHandler{
-
- private static final DropBehaviorRule METARULE = new DropBehaviorRule();
-
- public DropBehaviorHandler(BehaviorConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(METARULE);
- return m;
- }
-}
Added: trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropHandler.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropHandler.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/view/facelets/DropHandler.java 2010-12-17 19:57:18 UTC (rev 20669)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractDropTarget;
+import org.richfaces.event.MethodExpressionDropListener;
+
+/**
+ * @author abelevich
+ *
+ */
+public class DropHandler extends ComponentHandler{
+
+
+ private static final DropHandlerMetaRule METARULE = new DropHandlerMetaRule();
+
+ public DropHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class DropHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractDropTarget.class) && "dropListener".equals(name)) {
+ return new DropTargetMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class DropTargetMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DropEvent.class };
+
+ private final TagAttribute attribute;
+
+ public DropTargetMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractDropTarget) instance).addDropListener((new MethodExpressionDropListener(
+ this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
Modified: trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-17 19:57:18 UTC (rev 20669)
@@ -11,7 +11,10 @@
rf.ui = rf.ui || {};
rf.ui.Draggable = function(id, options) {
- this.dragElement = $(document.getElementById(id));
+ this.id = id;
+ this.options = options;
+
+ this.dragElement = $(document.getElementById(this.options.parentId));
this.dragElement.draggable();
if(options.indicator) {
@@ -25,10 +28,9 @@
this.dragElement.draggable("option", "addClasses", false);
- this.options = options;
-
this.dragElement.data('type', this.options.type);
this.dragElement.data("init", true);
+ this.dragElement.data("id", this.id);
this.dragElement.bind('dragstart', $.proxy(this.dragStart, this));
this.dragElement.bind('drag', $.proxy(this.drag, this));
Modified: trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
--- trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-17 19:39:26 UTC (rev 20668)
+++ trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-12-17 19:57:18 UTC (rev 20669)
@@ -12,8 +12,9 @@
rf.ui.Droppable = function(id, options) {
this.options = options;
- this.dropElement = $(document.getElementById(id));
+ this.id = id;
+ this.dropElement = $(document.getElementById(this.options.parentId));
this.dropElement.droppable({addClasses: false});
this.dropElement.data("init", true);
this.dropElement.bind('drop', $.proxy(this.drop, this));
@@ -70,13 +71,13 @@
},
__callAjax: function(e, ui){
- var options = {};
- var originalEvent = this.options['event'];
if(ui.draggable) {
- options['dragSource'] = ui.draggable.attr("id");
- options['javax.faces.behavior.event'] = originalEvent.type;
+ var dragSource = ui.draggable.data("id");
+ var ajaxFunc = this.options.ajaxFunction;
+ if(ajaxFunc && typeof ajaxFunc == 'function' ) {
+ ajaxFunc.call(this,e, dragSource);
+ }
}
- rf.ajax(this.dropElement[0], originalEvent, {parameters: options});
}
}
})());
14 years
JBoss Rich Faces SVN: r20668 - in trunk/ui/output/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-17 14:39:26 -0500 (Fri, 17 Dec 2010)
New Revision: 20668
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.js
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
trunk/ui/output/ui/src/main/templates/toolbar.template.xml
Log:
RF-9969 Toolbar: attributes for event handlers ignored
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-17 18:54:05 UTC (rev 20667)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-17 19:39:26 UTC (rev 20668)
@@ -49,8 +49,10 @@
@ResourceDependencies({
@ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(library = "org.richfaces", name = "toolbar.js"),
@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
- })
+})
+
public abstract class ToolbarRendererBase extends RendererBase {
public static final String RENDERER_TYPE = "org.richfaces.ToolbarRenderer";
@@ -376,7 +378,7 @@
for (ComponentAttribute componentAttribute :ITEMS_HANDLER_ATTRIBUTES.values()) {
Object attr = component.getAttributes().get(componentAttribute.getComponentAttributeName());
if (attr != null) {
- RenderKitUtils.addToScriptHash(tbEvents, componentAttribute.getHtmlAttributeName(),
+ RenderKitUtils.addToScriptHash(tbEvents, componentAttribute.getHtmlAttributeName().substring(2),
attr, null, ScriptHashVariableWrapper.eventHandler);
}
}
@@ -399,7 +401,7 @@
for (ComponentAttribute componentAttribute :ITEMS_HANDLER_ATTRIBUTES.values()) {
Object attr = tbg.getAttributes().get(componentAttribute.getComponentAttributeName());
if (attr != null) {
- RenderKitUtils.addToScriptHash(tbgEvents, componentAttribute.getHtmlAttributeName(),
+ RenderKitUtils.addToScriptHash(tbgEvents, componentAttribute.getHtmlAttributeName().substring(2),
attr, null, ScriptHashVariableWrapper.eventHandler);
}
}
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.js 2010-12-17 19:39:26 UTC (rev 20668)
@@ -0,0 +1,23 @@
+function toolbarHandlers(options) {
+ if (options.id && options.events) {
+ jQuery('.rf-tb-itm', document.getElementById(options.id)).bind(
+ options.events);
+ }
+ var groups = options.groups;
+ if (groups && groups.length > 0) {
+ var group;
+ var i;
+ for (i in groups) {
+ group = groups[i];
+ if (group) {
+ var groupIds = group.ids;
+ var y;
+ var groupElements = [];
+ for (y in groupIds) {
+ groupElements.push(document.getElementById(groupIds[y]));
+ }
+ jQuery(groupElements).bind(group.events);
+ }
+ }
+ }
+}
Property changes on: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/output/ui/src/main/templates/toolbar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-17 18:54:05 UTC (rev 20667)
+++ trunk/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-17 19:39:26 UTC (rev 20668)
@@ -19,14 +19,14 @@
height="#{getHeightToolbar(component)}"
class="rf-tb #{component.attributes['styleClass']}"
style="#{ component.attributes['style']}"
- cdk:passThroughWithExclusions="">
+ cdk:passThroughWithExclusions="">
<cdk:call expression="renderColElements(facesContext, component)" />
<tr class="rf-tb-cntr">
<cdk:body />
</tr>
</table>
<script type="text/javascript">
- #{toScriptArgs(getOptions(component))}
+ toolbarHandlers(#{toScriptArgs(getOptions(component))});
</script>
</cc:implementation>
</cdk:root>
14 years