Seam SVN: r12686 - in modules/faces/trunk: impl/src/main/java/org/jboss/seam/faces/component and 1 other directory.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-06 12:06:11 -0400 (Thu, 06 May 2010)
New Revision: 12686
Modified:
modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
Log:
Additional developer feedback messages, and some corrections in the documentation.
Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-06 14:32:43 UTC (rev 12685)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-06 16:06:11 UTC (rev 12686)
@@ -43,9 +43,9 @@
Performing cross-field form validation is simple - just place the <s:validateForm> component
in the form you wish to validate, then attach your custom Validator.
<programlisting><![CDATA[<h:form id="locationForm">
- <h:inputText id="city" value="#{bean.author}" />
- <h:inputText id="state" value="#{bean.title}" />
- <h:inputText id="zip" value="#{bean.text}" />
+ <h:inputText id="city" value="#{bean.city}" />
+ <h:inputText id="state" value="#{bean.state}" />
+ <h:inputText id="zip" value="#{bean.zip}" />
<h:commandButton id="submit" value="Submit" action="#{bean.submitPost}" />
<s:validateForm validatorId="locationValidator" />
@@ -103,9 +103,9 @@
ID alias (see below.)
<programlisting><![CDATA[<h:form id="locationForm">
- <h:inputText id="cityId" value="#{bean.author}" />
- <h:inputText id="stateId" value="#{bean.title}" />
- <h:inputText id="zip" value="#{bean.text}" />
+ <h:inputText id="cityId" value="#{bean.city}" />
+ <h:inputText id="stateId" value="#{bean.state}" />
+ <h:inputText id="zip" value="#{bean.zip}" />
<h:commandButton id="submit" value="Submit" action="#{bean.submitPost}" />
<s:validateForm fields="city=cityId state=stateId" validatorId="locationValidator" />
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java 2010-05-06 14:32:43 UTC (rev 12685)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java 2010-05-06 16:06:11 UTC (rev 12686)
@@ -35,7 +35,6 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.inject.Inject;
@@ -65,7 +64,7 @@
public void interceptComponentTree(@Observes @Before final UIValidateForm event)
{
validator = event;
- form = locateForm(event);
+ form = validator.locateForm();
components = locateAliasedComponents(event);
}
@@ -124,20 +123,6 @@
return parameterName;
}
- private UIForm locateForm(final UIComponent component)
- {
- UIComponent parent = component.getParent();
- while (!(parent instanceof UIForm))
- {
- parent = parent.getParent();
- if ((parent == null) || (parent instanceof UIViewRoot))
- {
- throw new IllegalStateException("The form validator must be placed within a UIForm");
- }
- }
- return (UIForm) parent;
- }
-
public HashMap<String, UIInput> locateAliasedComponents(final UIValidateForm validator)
{
HashMap<String, UIInput> result = new HashMap<String, UIInput>();
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java 2010-05-06 14:32:43 UTC (rev 12685)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java 2010-05-06 16:06:11 UTC (rev 12686)
@@ -23,14 +23,13 @@
package org.jboss.seam.faces.component;
import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
import javax.enterprise.util.AnnotationLiteral;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.PostValidateEvent;
import javax.faces.event.PreValidateEvent;
@@ -40,8 +39,6 @@
import org.jboss.seam.faces.event.qualifier.After;
import org.jboss.seam.faces.event.qualifier.Before;
import org.jboss.seam.faces.util.BeanManagerAccessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
@@ -65,10 +62,6 @@
private String validatorId = "";
private String fields = "";
- private final Logger log = LoggerFactory.getLogger(UIValidateForm.class);
-
- private final Map<String, UIInput> components = Collections.synchronizedMap(new HashMap<String, UIInput>());
-
@Override
public String getFamily()
{
@@ -90,12 +83,10 @@
try
{
UIComponent parent = this.getParent();
- validator.validate(context, parent, components);
+ validator.validate(context, parent, null);
}
catch (ValidatorException e)
{
- // TODO fire components invalid event
- setComponentsInvalid();
setValid(false);
context.addMessage(null, e.getFacesMessage());
}
@@ -104,16 +95,22 @@
context.getApplication().publishEvent(context, PostValidateEvent.class, UIValidateForm.class, this);
}
- private void setComponentsInvalid()
+ /**
+ * Attempt to locate the form in which this component resides. If the
+ * component is not within a UIForm tag, throw an exception.
+ */
+ public UIForm locateForm()
{
- for (UIComponent comp : components.values())
+ UIComponent parent = this.getParent();
+ while (!(parent instanceof UIForm))
{
- if ((comp != null) && (comp instanceof UIInput))
+ if ((parent == null) || (parent instanceof UIViewRoot))
{
- UIInput input = (UIInput) comp;
- input.setValid(false);
+ throw new IllegalStateException("The UIValidateForm (<s:validateForm />) component must be placed within a UIForm (<h:form>)");
}
+ parent = parent.getParent();
}
+ return (UIForm) parent;
}
/*
@@ -123,6 +120,7 @@
@Override
public void encodeAll(final FacesContext context) throws IOException
{
+ locateForm();
}
@Override
13 years, 11 months
Seam SVN: r12685 - in modules/jms/trunk: impl and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-05-06 10:32:43 -0400 (Thu, 06 May 2010)
New Revision: 12685
Modified:
modules/jms/trunk/impl/pom.xml
modules/jms/trunk/pom.xml
Log:
JBQA-3325, code coverage profile
Modified: modules/jms/trunk/impl/pom.xml
===================================================================
--- modules/jms/trunk/impl/pom.xml 2010-05-06 13:18:46 UTC (rev 12684)
+++ modules/jms/trunk/impl/pom.xml 2010-05-06 14:32:43 UTC (rev 12685)
@@ -1,66 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jms-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jms-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>seam-jms-impl</artifactId>
- <name>Seam JMS Implementation</name>
- <description>Implementation of the Seam JMS Module</description>
+ <artifactId>seam-jms-impl</artifactId>
+ <name>Seam JMS Implementation</name>
+ <description>Implementation of the Seam JMS Module</description>
- <properties>
- <arquillian.version>1.0.0.Alpha1</arquillian.version>
- </properties>
+ <properties>
+ <arquillian.version>1.0.0.Alpha1</arquillian.version>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <scope>provided</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jms</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jms</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-extensions</artifactId>
- <scope>runtime</scope>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <scope>runtime</scope>
+ </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-junit</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-jbossas-remote-60</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
</project>
Modified: modules/jms/trunk/pom.xml
===================================================================
--- modules/jms/trunk/pom.xml 2010-05-06 13:18:46 UTC (rev 12684)
+++ modules/jms/trunk/pom.xml 2010-05-06 14:32:43 UTC (rev 12685)
@@ -1,97 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-parent</artifactId>
- <version>9</version>
- </parent>
+ <parent>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-parent</artifactId>
+ <version>9</version>
+ </parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jms-parent</artifactId>
- <packaging>pom</packaging>
- <name>Seam JMS Parent</name>
- <version>3.0.0-SNAPSHOT</version>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jms-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Seam JMS Parent</name>
+ <version>3.0.0-SNAPSHOT</version>
- <url>http://sfwk.org/Seam3/JMSModule</url>
-
- <properties>
- <seam.jms.version>3.0.0-SNAPSHOT</seam.jms.version>
- <weld.api.version>1.0-SP1</weld.api.version>
- </properties>
+ <url>http://sfwk.org/Seam3/JMSModule</url>
- <modules>
- <module>api</module>
- <module>impl</module>
- <module>docs/reference</module>
- <!--
+ <properties>
+ <seam.jms.version>3.0.0-SNAPSHOT</seam.jms.version>
+ <weld.api.version>1.0-SP1</weld.api.version>
+ <emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
+ <emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
+ <jboss.maven.plugin.version>1.4</jboss.maven.plugin.version>
+ <maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
+ <cargo.maven2.plugin.version>1.0-beta-2</cargo.maven2.plugin.version>
+ </properties>
+
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <module>docs/reference</module>
+ <!--
<module>examples</module>
-->
- </modules>
+ </modules>
- <!-- Only build the distribution if requested explicitly -->
- <profiles>
- <profile>
- <id>distribution</id>
- <modules>
- <module>dist</module>
- </modules>
- </profile>
- </profiles>
-
- <developers>
- <developer>
- <name>Jordan Ganoff</name>
- <email>jganoff(a)gmail.com</email>
- <timezone>EST</timezone>
- <roles>
- <role>Project Lead</role>
- </roles>
- </developer>
- </developers>
+ <!-- Only build the distribution if requested explicitly -->
+ <profiles>
+ <profile>
+ <id>distribution</id>
+ <modules>
+ <module>dist</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>${emma.maven.plugin.version}</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>instrumentation</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ <configuration>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <id>cleaning</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- <dependencyManagement>
- <dependencies>
- <dependency>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <forkMode>once</forkMode>
+ <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>${cargo.maven2.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss5x</containerId>
+ <home>${env.JBOSS_HOME}</home>
+ <timeout>300000</timeout> <!-- 5 minutes -->
+ </container>
+ <configuration>
+ <type>existing</type>
+ <home>${env.JBOSS_HOME}/server/default</home>
+ <properties>
+ <cargo.jboss.configuration>default</cargo.jboss.configuration>
+ <cargo.rmi.port>1099</cargo.rmi.port>
+ </properties>
+ </configuration>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${maven.antrun.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>deploy-emma-jar</id>
+ <phase>process-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo message="Deploying emma jar to server lib directory" />
+ <copy file="${emma.jar.file}" todir="${env.JBOSS_HOME}/server/default/lib"
+ overwrite="true" />
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>retrieve-coverage-file</id>
+ <phase>test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo
+ message="Moving coverage.ec file to current modele from parent module" />
+ <property name="coverage.file" value="${basedir}/../coverage.ec" />
+ <waitfor maxwait="30" maxwaitunit="second">
+ <available file="${coverage.file}" />
+ </waitfor>
+ <move file="${coverage.file}" todir="${basedir}"
+ failonerror="false" />
+ <delete file="${basedir}/transaction.log" failonerror="false" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ <version>${emma4it.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <sourceSets>
+ <sourceSet>
+ <directory>${project.build.sourceDirectory}</directory>
+ </sourceSet>
+ </sourceSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
+
+ <developers>
+ <developer>
+ <name>Jordan Ganoff</name>
+ <email>jganoff(a)gmail.com</email>
+ <timezone>EST</timezone>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-api-bom</artifactId>
<version>${weld.api.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
-
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-extensions</artifactId>
- <version>1.0.0.Alpha1</version>
- </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>1.1</version>
+ </dependency>
- <!-- Modules defined again here to prevent need to explicitly specify version where used -->
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jms</artifactId>
- <version>${seam.jms.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0.Alpha1</version>
+ </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>seam-jms-impl</artifactId>
- <version>${seam.jms.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <!--
+ Modules defined again here to prevent need to explicitly specify
+ version where used
+ -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jms</artifactId>
+ <version>${seam.jms.version}</version>
+ </dependency>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/jms/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/jms/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/Seam/modules/jms/trunk</url>
- </scm>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jms-impl</artifactId>
+ <version>${seam.jms.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/jms/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/jms/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/jms/trunk</url>
+ </scm>
</project>
13 years, 11 months
Seam SVN: r12683 - in modules/faces/trunk: docs/reference/src/main/docbook/en-US and 4 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-05 19:05:46 -0400 (Wed, 05 May 2010)
New Revision: 12683
Added:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationTypeOverrideExtension.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerAccessor.java
Modified:
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java
modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java
modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
modules/faces/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
Log:
* Committing cross-field-validation v2 - still writing tests.
Modified: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -22,6 +22,7 @@
package org.jboss.seam.faces.validation;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
@@ -98,7 +99,7 @@
*/
@Qualifier
@Retention(RUNTIME)
-@Target( { FIELD })
+@Target( { FIELD, METHOD })
public @interface InputField
{
@Nonbinding
Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-05 23:05:46 UTC (rev 12683)
@@ -22,7 +22,7 @@
xmlns:s="http://jboss.com/products/seam/faces"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h1>This is a page using Seam Faces</h1>
+ <h1>This is a view using Seam Faces</h1>
<h:outputText value="#{bean.sayHello()}" />
</html>]]></programlisting>
@@ -37,7 +37,11 @@
<section id="validateForm">
<title><s:validateForm></title>
<para>
- Performing cross-field form validation is simple using the Form Validation component.
+ On many occasions you might find yourself needing to compare the values of multiple input fields
+ on a given page submit: confirming a password; re-enter password; address lookups; and so on.
+
+ Performing cross-field form validation is simple - just place the <s:validateForm> component
+ in the form you wish to validate, then attach your custom Validator.
<programlisting><![CDATA[<h:form id="locationForm">
<h:inputText id="city" value="#{bean.author}" />
<h:inputText id="state" value="#{bean.title}" />
@@ -56,32 +60,48 @@
@Inject
Directory directory;
+ @Inject
@InputField
- private String city;
+ private Object city;
+ @Inject
@InputField
- private String state;
+ private Object state;
+ @Inject
@InputField
- private String zip;
+ private ZipCode zip;
@Override
public void validate(final FacesContext context, final UIComponent comp, final Object values) throws ValidatorException
{
if(!directory.exists(city, state, zip))
{
- throw new ValidatorException(new FacesMessage("Multiple fields-- failed validation baby!"));
+ throw new ValidatorException(new FacesMessage("Sorry, that location is not in our database. Please try again."));
}
}
}</programlisting>
-
-
-
+ </para>
+
+ <tip>
+ <para>
+ You may inject the correct type directly.
+ <programlisting>@Inject
+@InputField
+private ZipCode zip;</programlisting>
+ </para>
+ </tip>
+
+ <para>
Notice that the IDs of the inputText components match the IDs of your Validator
- @InputFields. The name of the @InputField will automatically
+ @InputFields; each @Inject @InputField member will be injected with the value of the form input field
+ who's ID matches the name of the variable.
+ </para>
+ <para>
+ In other words - the name of the @InputField annotated member variable will automatically
be matched to the ID of the input component, unless overridden by using a field
- ID alias (see below.) Notice that "zip" will still be referenced normally; you need only
- specify aliases for fields that differ in name from the Validator @InputFields.
+ ID alias (see below.)
+
<programlisting><![CDATA[<h:form id="locationForm">
<h:inputText id="cityId" value="#{bean.author}" />
<h:inputText id="stateId" value="#{bean.title}" />
@@ -91,9 +111,29 @@
<s:validateForm fields="city=cityId state=stateId" validatorId="locationValidator" />
</h:form>]]></programlisting>
+ Notice that "zip" will still be referenced normally; you need only
+ specify aliases for fields that differ in name from the Validator @InputFields.
+
+ </para>
+ <para>
+ <tip>
+ <para>
+ <literal>Using @InputField("customID")</literal> with an ID override can also be used to
+ specify a custom ID, instead of using the default: the name of the field. This gives you
+ the ability to change the name of the private field, without worrying about changing the
+ name of input fields in the View itself.
+ <programlisting>@Inject
+@InputField("state")
+private String sectorTwo;</programlisting>
+ </para>
+ </tip>
</para>
</section>
+
+
+
+
<section id="viewaction">
<title><s:viewAction></title>
<para>
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationFieldProducer.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -0,0 +1,189 @@
+/*
+ * 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.jboss.seam.faces.component;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.inject.Inject;
+
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.validation.InputField;
+import org.slf4j.Logger;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+@RequestScoped
+public class FormValidationFieldProducer
+{
+ @Inject
+ Logger log;
+
+ @Inject
+ FacesContext context;
+
+ UIForm form = null;
+ UIValidateForm validator = null;
+ private Map<String, UIInput> components = null;
+
+ public void interceptComponentTree(@Observes @Before final UIValidateForm event)
+ {
+ validator = event;
+ form = locateForm(event);
+ components = locateAliasedComponents(event);
+ }
+
+ public void cleanupComponentTree(@Observes @After final UIValidateForm event)
+ {
+ components = new HashMap<String, UIInput>();
+ }
+
+ @Produces
+ @Dependent
+ @InputField
+ public Object getInputFieldValue(final InjectionPoint ip)
+ {
+ Object result = null;
+
+ if (isInitialized())
+ {
+ String id = getFieldId(ip);
+ UIInput component = findComponent(id, id);
+ components.put(id, component);
+
+ if (component.isLocalValueSet())
+ {
+ result = component.getValue();
+ }
+ else
+ {
+ Converter converter = component.getConverter();
+ if (converter != null)
+ {
+ result = converter.getAsObject(context, component, (String) component.getSubmittedValue());
+ }
+ else
+ {
+ result = component.getSubmittedValue();
+ }
+ }
+
+ }
+
+ return result;
+ }
+
+ private boolean isInitialized()
+ {
+ return form != null;
+ }
+
+ private String getFieldId(final InjectionPoint ip)
+ {
+ String parameterName = ip.getAnnotated().getAnnotation(InputField.class).value();
+ if ("".equals(parameterName))
+ {
+ parameterName = ip.getMember().getName();
+ }
+ return parameterName;
+ }
+
+ private UIForm locateForm(final UIComponent component)
+ {
+ UIComponent parent = component.getParent();
+ while (!(parent instanceof UIForm))
+ {
+ parent = parent.getParent();
+ if ((parent == null) || (parent instanceof UIViewRoot))
+ {
+ throw new IllegalStateException("The form validator must be placed within a UIForm");
+ }
+ }
+ return (UIForm) parent;
+ }
+
+ public HashMap<String, UIInput> locateAliasedComponents(final UIValidateForm validator)
+ {
+ HashMap<String, UIInput> result = new HashMap<String, UIInput>();
+ String fields = validator.getFields();
+ if ((fields != null) && !"".equals(fields.trim()))
+ {
+ List<String> clientFieldIds = Arrays.asList(fields.split("\\s+"));
+ for (String field : clientFieldIds)
+ {
+ List<String> mapping = Arrays.asList(field.split("\\s*=\\s*"));
+ String aliasFieldName = mapping.get(0);
+
+ String clientInputId = aliasFieldName;
+
+ if (mapping.size() > 1)
+ {
+ clientInputId = mapping.get(1);
+ }
+
+ UIInput component = findComponent(aliasFieldName, clientInputId);
+ components.put(aliasFieldName, component);
+ }
+ }
+ return result;
+ }
+
+ private UIInput findComponent(final String alias, final String clientId)
+ {
+ UIComponent comp = null;
+ if (!components.containsKey(clientId))
+ {
+ comp = form.findComponent(clientId);
+ if (!(comp instanceof UIInput))
+ {
+ throw new IllegalArgumentException("Component [" + form.getClientId() + ":" + alias + "] must be a UIInput component.");
+ }
+ else if (comp == null)
+ {
+ throw new IllegalArgumentException("Could not locate component [" + form.getClientId() + ":" + alias + "]");
+ }
+ }
+ else
+ {
+ comp = components.get(clientId);
+ }
+ return (UIInput) comp;
+ }
+
+}
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationTypeOverrideExtension.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationTypeOverrideExtension.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/FormValidationTypeOverrideExtension.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -0,0 +1,82 @@
+/*
+ * 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.jboss.seam.faces.component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+import org.jboss.seam.faces.validation.InputField;
+import org.jboss.weld.extensions.annotated.AnnotatedTypeBuilder;
+
+/**
+ * Ensure that any field annotated with {@link InputField} is produced by the
+ * same producer method with output type {@link Object}.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+@ApplicationScoped
+public class FormValidationTypeOverrideExtension implements Extension
+{
+ private final Map<Class<?>, AnnotatedType<?>> typeOverrides = new HashMap<Class<?>, AnnotatedType<?>>();
+
+ public <T> void processAnnotatedType(@Observes final ProcessAnnotatedType<T> event)
+ {
+ AnnotatedTypeBuilder<T> builder = AnnotatedTypeBuilder.newInstance(event.getAnnotatedType());
+ builder.readAnnotationsFromUnderlyingType();
+ boolean modifiedType = false;
+
+ for (AnnotatedField<?> f : event.getAnnotatedType().getFields())
+ {
+ if (f.isAnnotationPresent(InputField.class))
+ {
+ builder.overrideFieldType(f.getJavaMember(), Object.class);
+ modifiedType = true;
+ }
+ }
+
+ if (modifiedType)
+ {
+ AnnotatedType<T> replacement = builder.create();
+ typeOverrides.put(replacement.getJavaClass(), replacement);
+ event.setAnnotatedType(replacement);
+ }
+ }
+
+ public boolean hasOverriddenType(final Class<?> clazz)
+ {
+ return typeOverrides.containsKey(clazz);
+ }
+
+ public AnnotatedType<?> getOverriddenType(final Class<?> clazz)
+ {
+ return typeOverrides.get(clazz);
+ }
+}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -23,23 +23,23 @@
package org.jboss.seam.faces.component;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import javax.enterprise.util.AnnotationLiteral;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
+import javax.faces.event.PostValidateEvent;
+import javax.faces.event.PreValidateEvent;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.util.BeanManagerAccessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,6 +50,15 @@
@FacesComponent(UIValidateForm.COMPONENT_TYPE)
public class UIValidateForm extends UIInput
{
+ private static final AnnotationLiteral<Before> BEFORE = new AnnotationLiteral<Before>()
+ {
+ private static final long serialVersionUID = 7631699535063526392L;
+ };
+ private static final AnnotationLiteral<After> AFTER = new AnnotationLiteral<After>()
+ {
+ private static final long serialVersionUID = -929128236303355107L;
+ };
+
public static final String COMPONENT_TYPE = "org.jboss.seam.faces.ValidateForm";
public static final String COMPONENT_FAMILY = "org.jboss.seam.faces.ValidateForm";
@@ -69,15 +78,8 @@
@Override
public void validate(final FacesContext context)
{
- UIComponent parent = this.getParent();
- while (!(parent instanceof UIForm))
- {
- parent = parent.getParent();
- if ((parent == null) || (parent instanceof UIViewRoot))
- {
- throw new IllegalStateException("The form validator must be placed within a UIForm");
- }
- }
+ context.getApplication().publishEvent(context, PreValidateEvent.class, UIValidateForm.class, this);
+ BeanManagerAccessor.getManager().fireEvent(this, BEFORE);
Validator validator = context.getApplication().createValidator(validatorId);
if (validator == null)
@@ -87,110 +89,21 @@
try
{
- locateComponents(validator, parent, fields);
- injectFieldValues(validator, context);
+ UIComponent parent = this.getParent();
validator.validate(context, parent, components);
}
catch (ValidatorException e)
{
+ // TODO fire components invalid event
setComponentsInvalid();
setValid(false);
context.addMessage(null, e.getFacesMessage());
}
- }
- public void locateComponents(final Validator validator, final UIComponent component, final String fields)
- {
- UIForm form = (UIForm) component;
-
- List<String> validatorFieldIds = getValidatorFieldNames(validator);
-
- if ((fields != null) && !"".equals(fields.trim()))
- {
- List<String> clientFieldIds = Arrays.asList(fields.split("\\s+"));
- for (String field : clientFieldIds)
- {
- List<String> mapping = Arrays.asList(field.split("\\s*=\\s*"));
- String clientValidatorFieldId = mapping.get(0);
- if (validatorFieldIds.contains(clientValidatorFieldId))
- {
- validatorFieldIds.remove(clientValidatorFieldId);
- }
- else
- {
- throw new IllegalArgumentException("Unknown field: [" + field + "] for Validator of type: " + validator.getClass().getName() + ", expected fields: " + getValidatorFieldNames(validator));
- }
-
- String clientFieldId = clientValidatorFieldId;
-
- if (mapping.size() > 1)
- {
- clientFieldId = mapping.get(1);
- }
-
- UIComponent comp = form.findComponent(clientFieldId);
- if ((comp != null) && (comp instanceof UIInput))
- {
- components.put(clientValidatorFieldId, (UIInput) comp);
- }
- else
- {
- log.warn("Could not locate component in form [" + form.getClientId() + ":" + clientValidatorFieldId + "]");
- }
- }
- }
-
- for (String field : validatorFieldIds)
- {
- UIComponent comp = form.findComponent(field);
- if ((comp != null) && (comp instanceof UIInput))
- {
- components.put(field, (UIInput) comp);
- }
- else
- {
- log.warn("Could not locate component in form [" + form.getClientId() + ":" + field + "] while processing Validator:" + validator.getClass().getName());
- }
- }
+ BeanManagerAccessor.getManager().fireEvent(this, AFTER);
+ context.getApplication().publishEvent(context, PostValidateEvent.class, UIValidateForm.class, this);
}
- private void injectFieldValues(final Validator validator, final FacesContext context)
- {
- Field[] declaredFields = validator.getClass().getDeclaredFields();
- for (Field f : declaredFields)
- {
- String name = getFieldName(f);
-
- boolean restricted = false;
- if (!f.isAccessible())
- {
- restricted = true;
- f.setAccessible(true);
- }
-
- try
- {
- UIInput input = components.get(name);
- if (input != null)
- {
- Object value = input.getValue();
- f.set(validator, value);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not inject value into validator: " + validator.getClass().getName(), e);
- }
-
- if (restricted)
- {
- f.setAccessible(false);
- }
- }
-
- return;
- }
-
private void setComponentsInvalid()
{
for (UIComponent comp : components.values())
@@ -203,34 +116,6 @@
}
}
- private List<String> getValidatorFieldNames(final Validator validator)
- {
- List<String> result = new ArrayList<String>();
- Field[] declaredFields = validator.getClass().getDeclaredFields();
- for (Field f : declaredFields)
- {
- if (f.isAnnotationPresent(org.jboss.seam.faces.validation.InputField.class))
- {
- result.add(getFieldName(f));
- }
- }
- return result;
- }
-
- private String getFieldName(final Field f)
- {
- String name = "";
- if (f.isAnnotationPresent(org.jboss.seam.faces.validation.InputField.class))
- {
- name = f.getAnnotation(org.jboss.seam.faces.validation.InputField.class).value();
- }
- if ("".equals(name))
- {
- name = f.getName();
- }
- return name;
- }
-
/*
* Prevent any rendered output.
*/
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerAccessor.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerAccessor.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerAccessor.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -0,0 +1,43 @@
+/*
+ * 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.jboss.seam.faces.util;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
+
+/**
+ * <b>***DO NOT USE THIS CLASS***</b>
+ * <p>
+ * See {@link BeanManagerAware}
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+public class BeanManagerAccessor extends BeanManagerAware
+{
+ public static BeanManager getManager()
+ {
+ return new BeanManagerAccessor().getBeanManager();
+ }
+}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java 2010-05-05 23:05:46 UTC (rev 12683)
@@ -27,11 +27,14 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;
+import org.jboss.seam.faces.component.FormValidationTypeOverrideExtension;
+
/**
* A utility providing common functions to simply use of {@link BeanManager}
*
@@ -43,6 +46,9 @@
@Inject
private BeanManager manager;
+ @Inject
+ FormValidationTypeOverrideExtension classExtension;
+
/**
* Perform @{@link Inject} on an object as if it were a bean managed by CDI.
*
@@ -54,11 +60,25 @@
if (instance != null)
{
CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
- InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager.createInjectionTarget(manager.createAnnotatedType(instance.getClass()));
+ InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager.createInjectionTarget(getAnnotatedType(instance));
injectionTarget.inject(instance, creationalContext);
}
}
+ private AnnotatedType<? extends Object> getAnnotatedType(final Object instance)
+ {
+ AnnotatedType<?> result = null;
+ if (classExtension.hasOverriddenType(instance.getClass()))
+ {
+ result = classExtension.getOverriddenType(instance.getClass());
+ }
+ else
+ {
+ result = manager.createAnnotatedType(instance.getClass());
+ }
+ return result;
+ }
+
@SuppressWarnings("unchecked")
public <T> boolean isDependentScoped(final Class<T> type)
{
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-05-05 23:05:46 UTC (rev 12683)
@@ -46,6 +46,10 @@
<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
<system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
</system-event-listener>
+ <system-event-listener>
+ <system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
+ <system-event-class>javax.faces.event.PreValidateEvent</system-event-class>
+ </system-event-listener>
</application>
</faces-config>
\ No newline at end of file
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-05-04 20:47:47 UTC (rev 12682)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-05-05 23:05:46 UTC (rev 12683)
@@ -1,3 +1,4 @@
+org.jboss.seam.faces.component.FormValidationTypeOverrideExtension
org.jboss.seam.faces.context.ViewScopedExtension
org.jboss.seam.faces.context.FlashScopedExtension
org.jboss.seam.faces.context.FacesAnnotationsAdapterExtension
13 years, 11 months
Seam SVN: r12682 - in modules/faces/trunk: api/src/main/java/org/jboss/seam/faces/display and 14 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-04 16:47:47 -0400 (Tue, 04 May 2010)
New Revision: 12682
Added:
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java
modules/faces/trunk/api/src/test/java/org/
modules/faces/trunk/api/src/test/java/org/jboss/
modules/faces/trunk/api/src/test/java/org/jboss/seam/
modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/
modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/
modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/LevelTest.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/component/
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/component/UIValidateFormTest.java
Modified:
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java
modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml
modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider
modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml
Log:
* Committing cross-field-validation v1 - still writing tests.
Modified: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -21,6 +21,23 @@
this.severity = severity;
}
+ public static Level valueOf(final Severity severity)
+ {
+ Level result = null;
+
+ if (severity != null)
+ {
+ for (Level l : Level.values())
+ {
+ if (l.severity.equals(severity))
+ {
+ result = l;
+ }
+ }
+ }
+ return result;
+ }
+
public Severity getSeverity()
{
return severity;
Added: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java (rev 0)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/validation/InputField.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -0,0 +1,106 @@
+/*
+ * 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.jboss.seam.faces.validation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.Validator;
+import javax.inject.Qualifier;
+
+/**
+ * To be used in conjunction with <code><s:validateForm /></code> in
+ * Validators that should have their values fetched from a JSF form field.
+ * <p>
+ * Example:
+ * <p>
+ * <code>
+ *
+ * public @{@link FacesValidator}("locationValidator") class
+ * LocationValidator implements {@link Validator} {<p>
+ *
+ * public @Field String city;<br/>
+ * public @Field String state;<br/> public
+ *
+ * @Field("zip") String zipcode;<br/> <p> public void
+ * validate(FacesContext context, UIComponent comp, Object
+ * componentMap <br/> {<br/>
+ *
+ * //validate like usual. <br/> } <p> }</code>
+ * <p>
+ * <b>Note:</b> The annotation value @Field("id") Specifies the
+ * default clientId alias for which values will be bound to the
+ * field annotated by this annotation.
+ *
+ * <h:form id="form"><br/>
+ * <h:inputText id="cityId"
+ * value="#{bean.city}" /><br/>
+ * <h:inputText id="state"
+ * value="#{bean.state}" /><br/>
+ * <h:inputText id="zip"
+ * value="#{bean.zip}" /><br/>
+ * <h:commandButton id="submit"
+ * value="Submit" action="#{bean.submit}"
+ * />
+ * <p>
+ * <s:validateForm
+ * fields="city=cityId"
+ * validatorId="<b>locationValidator</b>" /><br/>
+ * </h:form> </code>
+ * <p>
+ * Notice in the above example, that not all fields must be
+ * specified in the validator tag. If the Facelet field IDs match
+ * the validator fields, the values will automatically be mapped
+ * to the validator.
+ * <p>
+ * Fields can also be mapped to the validator through a simple
+ * alias: "validatorFieldId=componentClientId", where
+ * validatorFieldId is the name of the annotated @Field in the
+ * Validator, and componentClientId is the ID of the input
+ * component relative to the form in which it resides.
+ * <p>
+ * When writing your <b>public void validate(FacesContext context,
+ * UIComponent comp, Object componentMap)</b> method, keep in mind
+ * the following differences from a normal validator:
+ * <ul>
+ * <li>"comp" is the parent UIForm that contains this
+ * <s:validateForm /> tag.</li>
+ * <li>"componentMap" is a map of the requested input field names,
+ * and their corresponding UIInput component objects. This allows
+ * programmatic access to each of the components being validated.</li>
+ * </ul>
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ */
+@Qualifier
+@Retention(RUNTIME)
+@Target( { FIELD })
+public @interface InputField
+{
+ @Nonbinding
+ public String value() default "";
+}
\ No newline at end of file
Added: modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/LevelTest.java
===================================================================
--- modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/LevelTest.java (rev 0)
+++ modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/LevelTest.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -0,0 +1,60 @@
+/*
+ * 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.jboss.seam.faces.display;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.faces.application.FacesMessage;
+
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+public class LevelTest
+{
+ @Test
+ public void testValueOfInfo() throws Exception
+ {
+ assertEquals(Level.INFO, Level.valueOf(FacesMessage.SEVERITY_INFO));
+ }
+
+ @Test
+ public void testValueOfWarn() throws Exception
+ {
+ assertEquals(Level.WARN, Level.valueOf(FacesMessage.SEVERITY_WARN));
+ }
+
+ @Test
+ public void testValueOfError() throws Exception
+ {
+ assertEquals(Level.ERROR, Level.valueOf(FacesMessage.SEVERITY_ERROR));
+ }
+
+ @Test
+ public void testValueOfFatal() throws Exception
+ {
+ assertEquals(Level.FATAL, Level.valueOf(FacesMessage.SEVERITY_FATAL));
+ }
+}
Modified: modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml
===================================================================
--- modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/docs/reference/src/main/docbook/en-US/components.xml 2010-05-04 20:47:47 UTC (rev 12682)
@@ -3,9 +3,97 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
<chapter id="components">
<title>Seam Faces Components</title>
+ <para>While Seam Faces does not provide layout components or other UI-design related features, it does provide
+ functional components designed to make developing JSF applications easier, more functional, more scalable, and
+ more practical.</para>
<para>
- Mission statement for Faces Module components. Explain that they are functional, not UI-oriented.
+ For layout and design components, take a look at <ulink url="http://jboss.org/richfaces">RichFaces</ulink>, a
+ UI component library specifically tailored for easy, rich web-interfaces.
</para>
+ <section id="basicUsage">
+ <title>Introduction</title>
+ <para>
+ In order to use the Seam Faces components, you must first add the namespace to your view file,
+ just like the standard JSF component libraries.
+
+ <programlisting><![CDATA[<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/faces"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <h1>This is a page using Seam Faces</h1>
+ <h:outputText value="#{bean.sayHello()}" />
+
+</html>]]></programlisting>
+ <tip>
+ <para>
+ All Seam Faces components use the same namespace:
+ <literal>http://jboss.com/products/seam/faces</literal>
+ </para>
+ </tip>
+ </para>
+ </section>
+ <section id="validateForm">
+ <title><s:validateForm></title>
+ <para>
+ Performing cross-field form validation is simple using the Form Validation component.
+ <programlisting><![CDATA[<h:form id="locationForm">
+ <h:inputText id="city" value="#{bean.author}" />
+ <h:inputText id="state" value="#{bean.title}" />
+ <h:inputText id="zip" value="#{bean.text}" />
+ <h:commandButton id="submit" value="Submit" action="#{bean.submitPost}" />
+
+ <s:validateForm validatorId="locationValidator" />
+</h:form>]]></programlisting>
+
+
+
+ The corresponding Validator for the example above would look something like this:
+ <programlisting>@FacesValidator("locationValidator")
+public class LocationValidator implements Validator
+{
+ @Inject
+ Directory directory;
+
+ @InputField
+ private String city;
+
+ @InputField
+ private String state;
+
+ @InputField
+ private String zip;
+
+ @Override
+ public void validate(final FacesContext context, final UIComponent comp, final Object values) throws ValidatorException
+ {
+ if(!directory.exists(city, state, zip))
+ {
+ throw new ValidatorException(new FacesMessage("Multiple fields-- failed validation baby!"));
+ }
+ }
+}</programlisting>
+
+
+
+ Notice that the IDs of the inputText components match the IDs of your Validator
+ @InputFields. The name of the @InputField will automatically
+ be matched to the ID of the input component, unless overridden by using a field
+ ID alias (see below.) Notice that "zip" will still be referenced normally; you need only
+ specify aliases for fields that differ in name from the Validator @InputFields.
+ <programlisting><![CDATA[<h:form id="locationForm">
+ <h:inputText id="cityId" value="#{bean.author}" />
+ <h:inputText id="stateId" value="#{bean.title}" />
+ <h:inputText id="zip" value="#{bean.text}" />
+ <h:commandButton id="submit" value="Submit" action="#{bean.submitPost}" />
+
+ <s:validateForm fields="city=cityId state=stateId" validatorId="locationValidator" />
+</h:form>]]></programlisting>
+
+
+ </para>
+ </section>
<section id="viewaction">
<title><s:viewAction></title>
<para>
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/component/UIValidateForm.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -0,0 +1,281 @@
+/*
+ * 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.jboss.seam.faces.component;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+(a)FacesComponent(UIValidateForm.COMPONENT_TYPE)
+public class UIValidateForm extends UIInput
+{
+ public static final String COMPONENT_TYPE = "org.jboss.seam.faces.ValidateForm";
+ public static final String COMPONENT_FAMILY = "org.jboss.seam.faces.ValidateForm";
+
+ private String validatorId = "";
+ private String fields = "";
+
+ private final Logger log = LoggerFactory.getLogger(UIValidateForm.class);
+
+ private final Map<String, UIInput> components = Collections.synchronizedMap(new HashMap<String, UIInput>());
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public void validate(final FacesContext context)
+ {
+ UIComponent parent = this.getParent();
+ while (!(parent instanceof UIForm))
+ {
+ parent = parent.getParent();
+ if ((parent == null) || (parent instanceof UIViewRoot))
+ {
+ throw new IllegalStateException("The form validator must be placed within a UIForm");
+ }
+ }
+
+ Validator validator = context.getApplication().createValidator(validatorId);
+ if (validator == null)
+ {
+ throw new IllegalArgumentException("Could not create Validator with id: [" + validatorId + "]");
+ }
+
+ try
+ {
+ locateComponents(validator, parent, fields);
+ injectFieldValues(validator, context);
+ validator.validate(context, parent, components);
+ }
+ catch (ValidatorException e)
+ {
+ setComponentsInvalid();
+ setValid(false);
+ context.addMessage(null, e.getFacesMessage());
+ }
+ }
+
+ public void locateComponents(final Validator validator, final UIComponent component, final String fields)
+ {
+ UIForm form = (UIForm) component;
+
+ List<String> validatorFieldIds = getValidatorFieldNames(validator);
+
+ if ((fields != null) && !"".equals(fields.trim()))
+ {
+ List<String> clientFieldIds = Arrays.asList(fields.split("\\s+"));
+ for (String field : clientFieldIds)
+ {
+ List<String> mapping = Arrays.asList(field.split("\\s*=\\s*"));
+ String clientValidatorFieldId = mapping.get(0);
+ if (validatorFieldIds.contains(clientValidatorFieldId))
+ {
+ validatorFieldIds.remove(clientValidatorFieldId);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown field: [" + field + "] for Validator of type: " + validator.getClass().getName() + ", expected fields: " + getValidatorFieldNames(validator));
+ }
+
+ String clientFieldId = clientValidatorFieldId;
+
+ if (mapping.size() > 1)
+ {
+ clientFieldId = mapping.get(1);
+ }
+
+ UIComponent comp = form.findComponent(clientFieldId);
+ if ((comp != null) && (comp instanceof UIInput))
+ {
+ components.put(clientValidatorFieldId, (UIInput) comp);
+ }
+ else
+ {
+ log.warn("Could not locate component in form [" + form.getClientId() + ":" + clientValidatorFieldId + "]");
+ }
+ }
+ }
+
+ for (String field : validatorFieldIds)
+ {
+ UIComponent comp = form.findComponent(field);
+ if ((comp != null) && (comp instanceof UIInput))
+ {
+ components.put(field, (UIInput) comp);
+ }
+ else
+ {
+ log.warn("Could not locate component in form [" + form.getClientId() + ":" + field + "] while processing Validator:" + validator.getClass().getName());
+ }
+ }
+ }
+
+ private void injectFieldValues(final Validator validator, final FacesContext context)
+ {
+ Field[] declaredFields = validator.getClass().getDeclaredFields();
+ for (Field f : declaredFields)
+ {
+ String name = getFieldName(f);
+
+ boolean restricted = false;
+ if (!f.isAccessible())
+ {
+ restricted = true;
+ f.setAccessible(true);
+ }
+
+ try
+ {
+ UIInput input = components.get(name);
+ if (input != null)
+ {
+ Object value = input.getValue();
+ f.set(validator, value);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Could not inject value into validator: " + validator.getClass().getName(), e);
+ }
+
+ if (restricted)
+ {
+ f.setAccessible(false);
+ }
+ }
+
+ return;
+ }
+
+ private void setComponentsInvalid()
+ {
+ for (UIComponent comp : components.values())
+ {
+ if ((comp != null) && (comp instanceof UIInput))
+ {
+ UIInput input = (UIInput) comp;
+ input.setValid(false);
+ }
+ }
+ }
+
+ private List<String> getValidatorFieldNames(final Validator validator)
+ {
+ List<String> result = new ArrayList<String>();
+ Field[] declaredFields = validator.getClass().getDeclaredFields();
+ for (Field f : declaredFields)
+ {
+ if (f.isAnnotationPresent(org.jboss.seam.faces.validation.InputField.class))
+ {
+ result.add(getFieldName(f));
+ }
+ }
+ return result;
+ }
+
+ private String getFieldName(final Field f)
+ {
+ String name = "";
+ if (f.isAnnotationPresent(org.jboss.seam.faces.validation.InputField.class))
+ {
+ name = f.getAnnotation(org.jboss.seam.faces.validation.InputField.class).value();
+ }
+ if ("".equals(name))
+ {
+ name = f.getName();
+ }
+ return name;
+ }
+
+ /*
+ * Prevent any rendered output.
+ */
+
+ @Override
+ public void encodeAll(final FacesContext context) throws IOException
+ {
+ }
+
+ @Override
+ public void encodeBegin(final FacesContext context) throws IOException
+ {
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext context) throws IOException
+ {
+ }
+
+ @Override
+ public void encodeChildren(final FacesContext context) throws IOException
+ {
+ }
+
+ /*
+ * Getters & Setters
+ */
+
+ public String getFields()
+ {
+ return fields;
+ }
+
+ public void setFields(final String fields)
+ {
+ this.fields = fields;
+ }
+
+ public String getValidatorId()
+ {
+ return validatorId;
+ }
+
+ public void setValidatorId(final String validatorId)
+ {
+ this.validatorId = validatorId;
+ }
+}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -40,6 +40,12 @@
this.level = level;
}
+ @Override
+ public String toString()
+ {
+ return "SeamMessage [clientId=" + clientId + ", details=" + details + ", level=" + level + ", message=" + message + "]";
+ }
+
public Message component(final String clientId)
{
this.clientId = clientId;
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-05-04 20:47:47 UTC (rev 12682)
@@ -48,9 +48,4 @@
</system-event-listener>
</application>
- <component>
- <component-type>org.jboss.seam.faces.ViewAction</component-type>
- <component-class>org.jboss.seam.faces.component.UIViewAction</component-class>
- </component>
-
-</faces-config>
+</faces-config>
\ No newline at end of file
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/seam-faces.taglib.xml 2010-05-04 20:47:47 UTC (rev 12682)
@@ -31,5 +31,11 @@
<component-type>org.jboss.seam.faces.ViewAction</component-type>
</component>
</tag>
+ <tag>
+ <tag-name>validateForm</tag-name>
+ <component>
+ <component-type>org.jboss.seam.faces.ValidateForm</component-type>
+ </component>
+ </tag>
</facelet-taglib>
\ No newline at end of file
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider 2010-05-04 20:47:47 UTC (rev 12682)
@@ -1 +1,3 @@
org.jboss.seam.faces.beanManager.FacesServletContextBeanManagerProvider
+org.jboss.weld.extensions.beanManager.DefaultJndiBeanManagerProvider
+org.jboss.weld.extensions.beanManager.JBossJndiBeanManagerProvider
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-05-04 13:12:18 UTC (rev 12681)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-05-04 20:47:47 UTC (rev 12682)
@@ -3,7 +3,7 @@
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-fragment_3_0.xsd">
<name>seamfaces</name>
-
+
<listener>
<listener-class>org.jboss.seam.faces.beanManager.BeanManagerServletContextListener</listener-class>
</listener>
Added: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/component/UIValidateFormTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/component/UIValidateFormTest.java (rev 0)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/component/UIValidateFormTest.java 2010-05-04 20:47:47 UTC (rev 12682)
@@ -0,0 +1,52 @@
+/*
+ * 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.jboss.seam.faces.component;
+
+import javax.faces.component.UIViewRoot;
+
+import org.jboss.test.faces.mock.application.MockApplication;
+import org.jboss.test.faces.mock.context.MockFacesContext;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+public class UIValidateFormTest
+{
+
+ private final MockFacesContext facesContext = new MockFacesContext();
+ private final MockApplication application = new MockApplication();
+ private static final UIViewRoot uiViewRoot = new UIViewRoot();
+
+ static
+ {
+ uiViewRoot.setViewId("foo.xhtml");
+ }
+
+ @Test
+ public void testCanLocateChildComponents() throws Exception
+ {
+ UIValidateForm vf = new UIValidateForm();
+ }
+}
13 years, 11 months
Seam SVN: r12681 - in modules/faces/trunk: impl and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-05-04 09:12:18 -0400 (Tue, 04 May 2010)
New Revision: 12681
Modified:
modules/faces/trunk/impl/pom.xml
modules/faces/trunk/pom.xml
Log:
JBQA-3325, code coverage profile added
Modified: modules/faces/trunk/impl/pom.xml
===================================================================
--- modules/faces/trunk/impl/pom.xml 2010-05-04 12:19:12 UTC (rev 12680)
+++ modules/faces/trunk/impl/pom.xml 2010-05-04 13:12:18 UTC (rev 12681)
@@ -42,5 +42,23 @@
<scope>compile</scope>
</dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml 2010-05-04 12:19:12 UTC (rev 12680)
+++ modules/faces/trunk/pom.xml 2010-05-04 13:12:18 UTC (rev 12681)
@@ -37,6 +37,8 @@
<weld.api.version>1.0-SP1</weld.api.version>
<junit.version>4.8.1</junit.version>
<slf4j.version>1.5.9.RC1</slf4j.version>
+ <emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
+ <emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
</properties>
<dependencyManagement>
@@ -145,6 +147,70 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>${emma.maven.plugin.version}</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>instrumentation</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ <configuration>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <id>cleaning</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <forkMode>once</forkMode>
+ <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ <version>${emma4it.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <sourceSets>
+ <sourceSet>
+ <directory>${project.build.sourceDirectory}</directory>
+ </sourceSet>
+ </sourceSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<developers>
@@ -198,6 +264,5 @@
</plugin>
</plugins>
</build>
-
</project>
13 years, 11 months
Seam SVN: r12680 - in modules/international/trunk: impl and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-05-04 08:19:12 -0400 (Tue, 04 May 2010)
New Revision: 12680
Modified:
modules/international/trunk/impl/pom.xml
modules/international/trunk/pom.xml
Log:
JBQA-3325, code coverage profile added
Modified: modules/international/trunk/impl/pom.xml
===================================================================
--- modules/international/trunk/impl/pom.xml 2010-05-04 05:38:18 UTC (rev 12679)
+++ modules/international/trunk/impl/pom.xml 2010-05-04 12:19:12 UTC (rev 12680)
@@ -39,5 +39,23 @@
<scope>compile</scope>
</dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: modules/international/trunk/pom.xml
===================================================================
--- modules/international/trunk/pom.xml 2010-05-04 05:38:18 UTC (rev 12679)
+++ modules/international/trunk/pom.xml 2010-05-04 12:19:12 UTC (rev 12680)
@@ -32,6 +32,8 @@
<weld.api.version>1.0-SP1</weld.api.version>
<joda-time.version>1.6</joda-time.version>
<pretty-time.version>1.0.6</pretty-time.version>
+ <emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
+ <emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
</properties>
<dependencyManagement>
@@ -142,4 +144,71 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>${emma.maven.plugin.version}</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>instrumentation</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ <configuration>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <id>cleaning</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <forkMode>once</forkMode>
+ <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ <version>${emma4it.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <sourceSets>
+ <sourceSet>
+ <directory>${project.build.sourceDirectory}</directory>
+ </sourceSet>
+ </sourceSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
13 years, 11 months
Seam SVN: r12679 - modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/http.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2010-05-04 01:38:18 -0400 (Tue, 04 May 2010)
New Revision: 12679
Modified:
modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/http/HttpParam.java
Log:
Default to empty string
Modified: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/http/HttpParam.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/http/HttpParam.java 2010-05-01 20:31:26 UTC (rev 12678)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/http/HttpParam.java 2010-05-04 05:38:18 UTC (rev 12679)
@@ -44,5 +44,5 @@
public @interface HttpParam
{
@Nonbinding
- public String value();
+ public String value() default "";
}
\ No newline at end of file
13 years, 11 months
Seam SVN: r12678 - in modules/international/trunk/impl/src: test/java/org/jboss/seam/international and 8 other directories.
by seam-commits@lists.jboss.org
Author: kenfinni
Date: 2010-05-01 16:31:26 -0400 (Sat, 01 May 2010)
New Revision: 12678
Added:
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneOverrideTest.java
modules/international/trunk/impl/src/test/resources/org/
modules/international/trunk/impl/src/test/resources/org/jboss/
modules/international/trunk/impl/src/test/resources/org/jboss/seam/
modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/
modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/
modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/timezone/
modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/timezone/seam-beans.xml
Removed:
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/
Modified:
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
Log:
SEAMINTL-1 - Tests for overriding default timezone
Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-05-01 18:42:57 UTC (rev 12677)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-05-01 20:31:26 UTC (rev 12678)
@@ -35,7 +35,7 @@
/**
* Default TimeZone of the application. If configuration of the default TimeZone
* is found that will be used, otherwise the JVM default TimeZone otherwise.
- *
+ *
* @author Ken Finnigan
*/
@@ -44,7 +44,7 @@
{
private static final long serialVersionUID = 6181892144731122500L;
- String defaultTimeZoneId;
+ private String defaultTimeZoneId;
@Inject
Logger log;
Added: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneOverrideTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneOverrideTest.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneOverrideTest.java 2010-05-01 20:31:26 UTC (rev 12678)
@@ -0,0 +1,59 @@
+/*
+ * 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.jboss.seam.international.test.timezone;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.test.MockLogger;
+import org.jboss.seam.international.timezone.DefaultTimeZoneProducer;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class DefaultTimeZoneOverrideTest
+{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ JavaArchive arc = Archives.create("test.jar", JavaArchive.class).addClasses(MockLogger.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml")).addManifestResource("org/jboss/seam/international/test/timezone/seam-beans.xml", ArchivePaths.create("seam-beans.xml"));
+ System.out.println(arc.toString(true));
+ return arc;
+ }
+
+ @Inject
+ DateTimeZone timeZone;
+
+ @Test
+ public void testDefaultTimeZoneProducerDirect()
+ {
+ Assert.assertNotNull(timeZone);
+// Assert.assertEquals("America/Tijuana", timeZone.getID());
+ }
+}
Added: modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/timezone/seam-beans.xml
===================================================================
--- modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/timezone/seam-beans.xml (rev 0)
+++ modules/international/trunk/impl/src/test/resources/org/jboss/seam/international/test/timezone/seam-beans.xml 2010-05-01 20:31:26 UTC (rev 12678)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:s="urn:java:seam:core"
+ xmlns:tz="urn:java:org.jboss.seam.international.timezone"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+ <tz:DefaultTimeZoneProducer>
+ <s:specializes/>
+ <tz:defaultTimeZoneId>America/Tijuana</tz:defaultTimeZoneId>
+ </tz:DefaultTimeZoneProducer>
+</beans>
\ No newline at end of file
13 years, 12 months
Seam SVN: r12677 - modules/servlet/trunk/impl/src/main/resources/META-INF.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-01 14:42:57 -0400 (Sat, 01 May 2010)
New Revision: 12677
Modified:
modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml
Log:
Fixed erroneous class in web-fragment.xml
Modified: modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-05-01 16:40:08 UTC (rev 12676)
+++ modules/servlet/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-05-01 18:42:57 UTC (rev 12677)
@@ -5,7 +5,7 @@
<name>seamservlet</name>
<listener>
- <listener-class>org.jboss.seam.servlet.event.ServletEventListener</listener-class>
+ <listener-class>org.jboss.seam.servlet.event.ServletEventBridge</listener-class>
</listener>
</web-fragment>
13 years, 12 months
Seam SVN: r12676 - in modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet: event and 1 other directory.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-01 12:40:08 -0400 (Sat, 01 May 2010)
New Revision: 12676
Modified:
modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/beanManager/ServletContextBeanManagerProvider.java
modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java
Log:
Fixed potential NullPointer if not operating in proper servlet environment.
Modified: modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/beanManager/ServletContextBeanManagerProvider.java
===================================================================
--- modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/beanManager/ServletContextBeanManagerProvider.java 2010-05-01 02:33:09 UTC (rev 12675)
+++ modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/beanManager/ServletContextBeanManagerProvider.java 2010-05-01 16:40:08 UTC (rev 12676)
@@ -37,20 +37,25 @@
{
private static ThreadLocal<ServletContext> servletContext = new ThreadLocal<ServletContext>()
{
+ @Override
protected ServletContext initialValue()
{
return null;
}
};
- public static void setServletContext(ServletContext sc)
+ public static void setServletContext(final ServletContext sc)
{
servletContext.set(sc);
}
public BeanManager getBeanManager()
{
- return (BeanManager) servletContext.get().getAttribute(BeanManager.class.getName());
+ if (servletContext.get() != null)
+ {
+ return (BeanManager) servletContext.get().getAttribute(BeanManager.class.getName());
+ }
+ return null;
}
public int getPrecedence()
Modified: modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java
===================================================================
--- modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java 2010-05-01 02:33:09 UTC (rev 12675)
+++ modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java 2010-05-01 16:40:08 UTC (rev 12676)
@@ -316,7 +316,7 @@
return value;
}
- public AttributeLiteral(String value)
+ public AttributeLiteral(final String value)
{
this.value = value;
}
@@ -331,7 +331,7 @@
return value;
}
- public ValueLiteral(String value)
+ public ValueLiteral(final String value)
{
this.value = value;
}
13 years, 12 months