JBoss Rich Faces SVN: r17826 - in root/tests/metamer/trunk: src/main/java/org/richfaces/testapp/bean and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:31:32 -0400 (Sat, 10 Jul 2010)
New Revision: 17826
Modified:
root/tests/metamer/trunk/pom.xml
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java
root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
Log:
https://jira.jboss.org/browse/RFPL-466
* page for a4j:log fixed, now it is possible to create all types of log messages
* dependencies in pom.xml refactored
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-10 18:30:45 UTC (rev 17825)
+++ root/tests/metamer/trunk/pom.xml 2010-07-10 18:31:32 UTC (rev 17826)
@@ -20,6 +20,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
@@ -40,7 +50,7 @@
<artifactId>tables-ui</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
-
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -70,18 +80,12 @@
<scope>provided</scope>
</dependency>-->
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>2.2</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
<scope>runtime</scope>
- </dependency>
+ </dependency>
</dependencies>
@@ -137,7 +141,6 @@
</profile>
</profiles>
-
</project>
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java 2010-07-10 18:30:45 UTC (rev 17825)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java 2010-07-10 18:31:32 UTC (rev 17826)
@@ -95,28 +95,4 @@
public void setName(String name) {
this.name = name;
}
-
- // TODO implement
- public String debugAction() {
- logger.info("debug action");
- return null;
- }
-
- // TODO implement
- public String errorAction() {
- logger.info("error action");
- return null;
- }
-
- // TODO implement
- public String infoAction() {
- logger.info("info action");
- return null;
- }
-
- // TODO implement
- public String warnAction() {
- logger.info("warning action");
- return null;
- }
}
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml 2010-07-10 18:31:32 UTC (rev 17826)
@@ -19,12 +19,12 @@
<ui:define name="component">
<h:inputText id="nameInput" value="#{a4jLogBean.name}" />
- <a4j:commandButton id="submit" value="Submit" render="out" execute="@form" />
- <a4j:commandButton id="submitDebug" value="Debug Message" render="out" execute="@form" action="#{a4jLogBean.debugAction}"/>
- <a4j:commandButton id="submitInfo" value="Info Message" render="out" execute="@form" action="#{a4jLogBean.infoAction}"/>
- <a4j:commandButton id="submitWarn" value="Warning Message" render="out" execute="@form" action="#{a4jLogBean.warnAction}"/>
- <a4j:commandButton id="submitError" value="Error Message" render="out" execute="@form" action="#{a4jLogBean.errorAction}"/>
-
+ <a4j:commandButton id="submitButton" value="Submit" render="out" execute="@form" />
+ <input type="button" id="debugButton" value="Debug Message" onclick="RichFaces.log.debug('***DEBUG***')" />
+ <input type="button" id="infoButton" value="Info Message" onclick="RichFaces.log.info('***INFO***')"/>
+ <input type="button" id="warnButton" value="Warning Message" onclick="RichFaces.log.warn('***WARN***')"/>
+ <input type="button" id="errorButton" value="Error Message" onclick="RichFaces.log.error('***ERROR***')"/>
+
<br/>
<a4j:outputPanel id="out">
14 years, 6 months
JBoss Rich Faces SVN: r17825 - in root/tests/metamer/trunk/src/main/webapp: components/a4jMediaOutput and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:30:45 -0400 (Sat, 10 Jul 2010)
New Revision: 17825
Modified:
root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
Log:
https://jira.jboss.org/browse/RFPL-466
* refactoring
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
@@ -11,7 +11,6 @@
<f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
-
<h:outputStylesheet library="css" name="a4jLog.css"/>
</ui:define>
@@ -27,7 +26,7 @@
<a4j:commandButton id="submitError" value="Error Message" render="out" execute="@form" action="#{a4jLogBean.errorAction}"/>
<br/>
-
+
<a4j:outputPanel id="out">
<h:outputText value="Hello #{a4jLogBean.name}!" rendered="#{not empty a4jLogBean.name}"/>
</a4j:outputPanel>
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
@@ -11,7 +11,6 @@
<f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
-
<h:outputStylesheet library="css" name="a4jMediaOutput.css"/>
</ui:define>
@@ -19,10 +18,9 @@
</ui:define>
<ui:define name="component">
- <script src="#{facesContext.externalContext.requestContextPath}/script/swfobject.js" type="text/javascript"/>
- <p>SWF Movie:</p>
- <a4j:outputPanel id="flashPanelDynamic">
+ <h:outputScript library="script" name="swfobject.js"/>
+ <a4j:outputPanel id="flashPanelDynamic">
<a4j:mediaOutput element="a" id="swfLink" style="display: none;" cacheable="false" session="true"
createContent="#{a4jMediaOutputBean.paintFlash}" value="#{mediaData}" />
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
@@ -11,7 +11,6 @@
<f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
-
<h:outputStylesheet library="css" name="a4jMediaOutput.css"/>
</ui:define>
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
@@ -13,5 +13,7 @@
<h3><h:outputLink value="image.xhtml">Image</h:outputLink></h3>
<div>Simple page that contains media output (image) and input boxes for all its attributes.</div>
+ <h3><h:outputLink value="flash.xhtml">Flash</h:outputLink></h3>
+ <div>Simple page that contains media output (flash) and input boxes for all its attributes.</div>
</h:body>
</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
+++ root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:30:45 UTC (rev 17825)
@@ -39,11 +39,11 @@
</div>
- <h:panelGroup id="a4jLogPanel" layout="block">
+ <h:panelGroup id="a4jLogPanel" styleClass="log-panel" layout="block">
<a4j:log id="a4jLog" height="300px" rendered="#{richBean.log}" />
</h:panelGroup>
- <div id="footer"><ui:insert name="footer">
+ <div class="footer"><ui:insert name="footer">
<hr />
RichFaces #{a4j.version}
</ui:insert></div>
14 years, 6 months
JBoss Rich Faces SVN: r17824 - in root/tests/metamer/trunk: src/main/assembly and 12 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:20:31 -0400 (Sat, 10 Jul 2010)
New Revision: 17824
Added:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/SelectItemComparator.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JMediaOutputBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/MediaData.java
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JLogBean.properties
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JMediaOutputBean.properties
root/tests/metamer/trunk/src/main/webapp/components/a4jLog/
root/tests/metamer/trunk/src/main/webapp/components/a4jLog/list.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml
root/tests/metamer/trunk/src/main/webapp/resources/css/a4jLog.css
root/tests/metamer/trunk/src/main/webapp/resources/css/a4jMediaOutput.css
root/tests/metamer/trunk/src/main/webapp/resources/script/
root/tests/metamer/trunk/src/main/webapp/resources/script/swfobject.js
Removed:
root/tests/metamer/trunk/src/main/assembly/tomcat6-assembly.xml
Modified:
root/tests/metamer/trunk/pom.xml
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/RichPhaseListener.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
Log:
https://jira.jboss.org/browse/RFPL-466
* added a4j:log - actions in bean need to be finished so that it will show custom messages in log
* added a4j:mediaOutput - doesn't work because of a bug in component
* directory script moved to resources
* skinning combo box in header disabled, skin changing implemented
* added SelectItemComparator so that select items in properties component are sorted
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/pom.xml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -14,7 +14,7 @@
<groupId>org.richfaces.examples</groupId>
<artifactId>testapp</artifactId>
<packaging>war</packaging>
- <name>RichFaces Testing Application</name>
+ <name>RichFaces Examples: Testing Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -98,15 +98,15 @@
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
- <id>jee5</id>
+ <id>jee6</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
- <webappDirectory>${project.build.directory}/${project.build.finalName}-jee5
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6
</webappDirectory>
- <classifier>jee5</classifier>
+ <classifier>jee6</classifier>
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*
</packagingExcludes>
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*
@@ -122,13 +122,13 @@
</build>
</profile>
<profile>
- <id>jee5</id>
+ <id>jee6</id>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <webappDirectory>${project.build.directory}/${project.build.finalName}-jee5
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6
</webappDirectory>
</configuration>
</plugin>
Deleted: root/tests/metamer/trunk/src/main/assembly/tomcat6-assembly.xml
===================================================================
--- root/tests/metamer/trunk/src/main/assembly/tomcat6-assembly.xml 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/assembly/tomcat6-assembly.xml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -1,58 +0,0 @@
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-
- <id>tomcat6</id>
-
- <formats>
- <format>war</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>src/main/webapp</directory>
- <outputDirectory>/</outputDirectory>
- <excludes>
- <exclude>/WEB-INF/.faces-config.xml.jsfdia</exclude>
- </excludes>
- </fileSet>
- <fileSet>
- <directory>target/classes</directory>
- <outputDirectory>WEB-INF/classes</outputDirectory>
- </fileSet>
- <fileSet>
- <outputDirectory>META-INF/maven/${groupId}/${artifactId}</outputDirectory>
- <includes>
- <include>pom.xml</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/maven-archiver</directory>
- <outputDirectory>META-INF/maven/${groupId}/${artifactId}</outputDirectory>
- <includes>
- <include>pom.properties</include>
- </includes>
- </fileSet>
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <scope>runtime</scope>
- <outputDirectory>WEB-INF/lib</outputDirectory>
- <useProjectArtifact>false</useProjectArtifact>
- <excludes>
- <exclude>org.slf4j:slf4j-jcl</exclude>
- </excludes>
- </dependencySet>
- <dependencySet>
- <scope>provided</scope>
- <useProjectArtifact>false</useProjectArtifact>
- <outputDirectory>WEB-INF/lib</outputDirectory>
- <excludes>
- <exclude>javax.el:el-api</exclude>
- </excludes>
- </dependencySet>
- </dependencySets>
-
-</assembly>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -162,10 +162,14 @@
item = new SelectItem(rb.getString(key), matcher.group(3));
result.get(matcher.group(2)).add(item);
-
}
}
+ // sort all select options
+ for (String aKey : result.keySet()) {
+ Collections.sort(result.get(aKey), new SelectItemComparator());
+ }
+
return result;
}
@@ -327,7 +331,22 @@
}
/**
- * {@inheritDoc}
+ * Associates the specified value with the specified key in the map with attributes' types.
+ * If the map previously contained a mapping for the key, the old value is replaced
+ * by the specified value. (A map m is said to contain a mapping for a key k
+ * if and only if m.containsKey(k) would return true.)
+ *
+ * @param key key with which the specified value is to be associated
+ * @param value value to be associated with the specified key
+ * @return the previous value associated with key, or null if there was no
+ * mapping for key. (A null return can also indicate that the map previously
+ * associated null with key, if the implementation supports null values.)
+ * @throws UnsupportedOperationException - if the put operation is not supported by this map
+ * @throws ClassCastException - if the class of the specified key or value prevents
+ * it from being stored in this map
+ * @throws NullPointerException - if the specified key or value is null and this map does not permit null keys or values
+ * @throws IllegalArgumentException - if some property of the specified key
+ * or value prevents it from being stored in this map
*/
public Object putAttributeClass(String key, Class<?> value) {
@@ -353,7 +372,7 @@
// if select options for "action" are defined in property file
if (hasSelectOptions("action")) {
method = ExpressionFactory.newInstance().createMethodExpression(elContext, getMethodEL(outcome), String.class,
- new Class[0]);
+ new Class[0]);
return (String) method.invoke(elContext, null);
}
@@ -376,15 +395,15 @@
// if no select options for "actionListener" are defined in property file and it is an EL expression
if (!hasSelectOptions("actionListener") && isStringEL(listener)) {
method = ExpressionFactory.newInstance().createMethodExpression(elContext, listener, void.class,
- new Class[] { ActionEvent.class });
- method.invoke(elContext, new Object[] { event });
+ new Class[]{ActionEvent.class});
+ method.invoke(elContext, new Object[]{event});
}
// if select options for "actionListener" are defined in property file
if (hasSelectOptions("actionListener")) {
method = ExpressionFactory.newInstance().createMethodExpression(elContext, getMethodEL(listener), void.class,
- new Class[] { ActionEvent.class });
- method.invoke(elContext, new Object[] { event });
+ new Class[]{ActionEvent.class});
+ method.invoke(elContext, new Object[]{event});
}
}
@@ -446,5 +465,4 @@
public List<SelectItem> getSelectOptions(String attributeName) {
return attributesSelectOptions.get(attributeName);
}
-
}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/RichPhaseListener.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/RichPhaseListener.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/RichPhaseListener.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -52,7 +52,6 @@
*/
public void beforePhase(PhaseEvent event) {
logger.info("BEFORE - " + event.getPhaseId());
-
}
/**
Copied: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/SelectItemComparator.java (from rev 17823, root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/RichPhaseListener.java)
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/SelectItemComparator.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/SelectItemComparator.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.testapp;
+
+import java.util.Comparator;
+
+import javax.faces.model.SelectItem;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Comparator for javax.faces.model.SelectItem comparing item's label.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class SelectItemComparator implements Comparator<SelectItem> {
+
+ private Logger logger;
+
+ public SelectItemComparator() {
+ logger = LoggerFactory.getLogger(getClass());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int compare(SelectItem o1, SelectItem o2) {
+ if (o1 == null || o1.getLabel() == null) {
+ return -1;
+ }
+
+ return o1.getLabel().compareTo(o2.getLabel());
+ }
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -57,7 +57,7 @@
*/
@PostConstruct
public void init() {
- logger = LoggerFactory.getLogger(A4JCommandButtonBean.class);
+ logger = LoggerFactory.getLogger(getClass());
logger.info("initializing bean " + getClass().getName());
attributes = new Attributes(UICommandButton.class, getClass());
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -57,7 +57,7 @@
*/
@PostConstruct
public void init() {
- logger = LoggerFactory.getLogger(A4JCommandLinkBean.class);
+ logger = LoggerFactory.getLogger(getClass());
logger.info("initializing bean " + getClass().getName());
attributes = new Attributes(UICommandLink.class, getClass());
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JLogBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.testapp.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import org.richfaces.component.UIAjaxLog;
+
+import org.richfaces.testapp.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:log.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "a4jLogBean")
+@SessionScoped
+public class A4JLogBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+ private String name;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.info("initializing bean " + getClass().getName());
+
+ name = "John";
+ attributes = new Attributes(UIAjaxLog.class, getClass());
+ attributes.put("rendered", true);
+ attributes.put("level", "debug");
+ }
+
+ /**
+ * Getter for attributes.
+ *
+ * @return A map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Setter for attributes.
+ *
+ * @param attributes
+ * map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * Getter for name.
+ * @return content of the input field on the page
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Setter for name.
+ * @param name new content of the input field on the page
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ // TODO implement
+ public String debugAction() {
+ logger.info("debug action");
+ return null;
+ }
+
+ // TODO implement
+ public String errorAction() {
+ logger.info("error action");
+ return null;
+ }
+
+ // TODO implement
+ public String infoAction() {
+ logger.info("info action");
+ return null;
+ }
+
+ // TODO implement
+ public String warnAction() {
+ logger.info("warning action");
+ return null;
+ }
+}
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JMediaOutputBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JMediaOutputBean.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JMediaOutputBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * 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.testapp.bean;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.imageio.ImageIO;
+import org.richfaces.component.UIMediaOutput;
+
+import org.richfaces.testapp.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:mediaOutput.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "a4jMediaOutputBean")
+@SessionScoped
+public class A4JMediaOutputBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.info("initializing bean " + getClass().getName());
+
+ attributes = new Attributes(UIMediaOutput.class, getClass());
+ }
+
+ /**
+ * Getter for attributes.
+ *
+ * @return A map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Setter for attributes.
+ *
+ * @param attributes
+ * map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public void paint(OutputStream out, Object data) throws IOException {
+ if (data instanceof MediaData) {
+ MediaData paintData = (MediaData) data;
+ BufferedImage img = new BufferedImage(paintData.width, paintData.height, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = img.createGraphics();
+
+ g2d.setColor(Color.WHITE);
+ g2d.fillRect(0, 0, paintData.width, paintData.height);
+
+ int testLenght = paintData.text.length();
+ int fontSize = testLenght < 8 ? 40 : 40 - (testLenght - 8);
+
+ if (fontSize < 12) {
+ fontSize = 12;
+ }
+
+ Font font = new Font("Serif", Font.HANGING_BASELINE, fontSize);
+
+ g2d.setFont(font);
+
+ int x = 10;
+ int y = fontSize * 5 / 2;
+
+ g2d.translate(x, y);
+
+ Color color = new Color(paintData.color);
+
+ g2d.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 30));
+
+ AffineTransform origTransform = g2d.getTransform();
+
+ g2d.shear(-0.5 * paintData.scale, 0);
+ g2d.scale(1, paintData.scale);
+ g2d.drawString(paintData.text, 0, 0);
+ g2d.setTransform(origTransform);
+ g2d.setPaint(color);
+ g2d.drawString(paintData.text, 0, 0);
+ ImageIO.write(img, "jpeg", out);
+ }
+
+// if (data instanceof MediaData) {
+//
+// MediaData paintData = (MediaData) data;
+// BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
+// Graphics2D graphics2D = img.createGraphics();
+// graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
+// graphics2D.drawLine(5,5,paintData.getWidth()-5,paintData.getHeight()-5);
+// graphics2D.drawChars(new String("RichFaces").toCharArray(),0,9,40,15);
+// graphics2D.drawChars(new String("mediaOutput").toCharArray(),0,11,5,45);
+//
+// ImageIO.write(img,"jpeg",out);
+//
+// }
+
+ }
+
+ private void copy(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[2048];
+ int read;
+
+ while ((read = in.read(buffer)) != -1) {
+ out.write(buffer, 0, read);
+ }
+ }
+
+ public void paintFlash(OutputStream out, Object data) throws IOException {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ if (loader == null) {
+ loader = getClass().getClassLoader();
+ }
+
+ InputStream stream = loader.getResourceAsStream("resources/flash/text.swf");
+
+ if (stream != null) {
+ try {
+ copy(stream, out);
+ } finally {
+ stream.close();
+ }
+ }
+ }
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -57,7 +57,7 @@
*/
@PostConstruct
public void init() {
- logger = LoggerFactory.getLogger(CommandButtonBean.class);
+ logger = LoggerFactory.getLogger(getClass());
logger.info("initializing bean " + getClass().getName());
attributes = new Attributes(HtmlCommandButton.class, getClass());
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/MediaData.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/MediaData.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/MediaData.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.testapp.bean;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import java.io.Serializable;
+
+@ManagedBean(name = "mediaData")
+@SessionScoped
+public class MediaData implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ int height = 120;
+ int width = 300;
+ Integer color;
+ float scale;
+ String text;
+
+ public MediaData() {
+ setText("RichFaces 4.0");
+ setColor(1000);
+ setScale(2);
+ System.out.println("MediaData instantiated");
+ }
+
+ public Integer getColor() {
+ return color;
+ }
+
+ public void setColor(Integer color) {
+ this.color = color;
+ }
+
+ public float getScale() {
+ return scale;
+ }
+
+ public void setScale(float scale) {
+ this.scale = scale;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:20:31 UTC (rev 17824)
@@ -80,7 +80,7 @@
skinningList.add(new SelectItem(Skinning.NONE));
skinningList.add(new SelectItem(Skinning.SKINNING));
skinningList.add(new SelectItem(Skinning.SKINNING_CLASSES));
- skinning = Skinning.NONE;
+ skinning = Skinning.SKINNING;
reTests = false;
reComponent = true;
}
@@ -90,19 +90,18 @@
components.put("a4jCommandLink", "A4J Command Link");
components.put("a4jCommandButton", "A4J Command Button");
+ components.put("a4jLog", "A4J Log");
+ components.put("a4jMediaOutput", "A4J Media Output");
components.put("commandButton", "JSF Command Button");
}
private List<String> createSkinList() {
List<String> skins = new ArrayList<String>();
- skins.add("DEFAULT");
- skins.add("NULL");
skins.add("blueSky");
skins.add("classic");
skins.add("deepMarine");
skins.add("emeraldTown");
skins.add("japanCherry");
- skins.add("plain");
skins.add("ruby");
skins.add("wine");
return skins;
Added: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JLogBean.properties
===================================================================
--- root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JLogBean.properties (rev 0)
+++ root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JLogBean.properties 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,4 @@
+attr.level.error=error
+attr.level.debug=debug
+attr.level.info=info
+attr.level.warn=warn
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JMediaOutputBean.properties
===================================================================
Modified: root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -12,6 +12,10 @@
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>#{richBean.skin}</param-value>
+ </context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -1,18 +1,17 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
-<h:head>
- <title>A4J Command Link</title>
- <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
- <h:outputStylesheet library="css" name="list.css" />
-</h:head>
+ <h:head>
+ <title>A4J Command Link</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+ </h:head>
-<h:body>
+ <h:body>
- <h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
- <div>Simple page that contains ajax command link and input boxes for all its attributes.</div>
+ <h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
+ <div>Simple page that contains ajax command link and input boxes for all its attributes.</div>
-</h:body>
+ </h:body>
</html>
\ No newline at end of file
Copied: root/tests/metamer/trunk/src/main/webapp/components/a4jLog/list.xhtml (from rev 17823, root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml)
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jLog/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jLog/list.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,17 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+<h:head>
+ <title>A4J Log</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+</h:head>
+
+<h:body>
+
+ <h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
+ <div>Simple page that contains log and input boxes for all its attributes.</div>
+
+</h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jLog/simple.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,47 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:ta="http://java.sun.com/jsf/composite/testapp">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="a4jLog.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:inputText id="nameInput" value="#{a4jLogBean.name}" />
+ <a4j:commandButton id="submit" value="Submit" render="out" execute="@form" />
+ <a4j:commandButton id="submitDebug" value="Debug Message" render="out" execute="@form" action="#{a4jLogBean.debugAction}"/>
+ <a4j:commandButton id="submitInfo" value="Info Message" render="out" execute="@form" action="#{a4jLogBean.infoAction}"/>
+ <a4j:commandButton id="submitWarn" value="Warning Message" render="out" execute="@form" action="#{a4jLogBean.warnAction}"/>
+ <a4j:commandButton id="submitError" value="Error Message" render="out" execute="@form" action="#{a4jLogBean.errorAction}"/>
+
+ <br/>
+
+ <a4j:outputPanel id="out">
+ <h:outputText value="Hello #{a4jLogBean.name}!" rendered="#{not empty a4jLogBean.name}"/>
+ </a4j:outputPanel>
+
+ <br/><br/>
+
+ <a4j:log id="log" rendered="#{a4jLogBean.attributes['rendered']}" level="#{a4jLogBean.attributes['level']}"
+ style="#{a4jLogBean.attributes['style']}" styleClass="#{a4jLogBean.attributes['styleClass']}"/>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jLogBean.attributes}" id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/flash.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,50 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:ta="http://java.sun.com/jsf/composite/testapp">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="a4jMediaOutput.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <script src="#{facesContext.externalContext.requestContextPath}/script/swfobject.js" type="text/javascript"/>
+ <p>SWF Movie:</p>
+ <a4j:outputPanel id="flashPanelDynamic">
+
+ <a4j:mediaOutput element="a" id="swfLink" style="display: none;" cacheable="false" session="true"
+ createContent="#{a4jMediaOutputBean.paintFlash}" value="#{mediaData}" />
+
+ <a4j:outputPanel layout="block" id="myFlashContent" style="width: 200px; height: 200px">
+ <a href="http://www.adobe.com/go/getflashplayer">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
+ </a>
+ </a4j:outputPanel>
+
+ <script type="text/javascript">
+ var flashvars = {};
+ var params = {};
+ var attributes = {};
+ swfobject.embedSWF(document.getElementById('form:swfLink').href, document.getElementById('myFlashContent'), "200", "200", "9.0.0", false, flashvars, params, attributes);
+ </script>
+
+ </a4j:outputPanel>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jMediaOutputBean.attributes}" id="attributes" render="panel"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/image.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,31 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:ta="http://java.sun.com/jsf/composite/testapp">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="a4jMediaOutput.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <a4j:mediaOutput id="mediaOutput" createContent="#{a4jMediaOutputBean.paint}" value="#{mediaData}"
+ element="img" cacheable="false" session="true" mimeType="image/jpeg" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jMediaOutputBean.attributes}" id="attributes" render="panel"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Copied: root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml (from rev 17823, root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml)
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jMediaOutput/list.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,17 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+<h:head>
+ <title>A4J Media Output</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+</h:head>
+
+<h:body>
+
+ <h3><h:outputLink value="image.xhtml">Image</h:outputLink></h3>
+ <div>Simple page that contains media output (image) and input boxes for all its attributes.</div>
+
+</h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/resources/css/a4jLog.css
===================================================================
Added: root/tests/metamer/trunk/src/main/webapp/resources/css/a4jMediaOutput.css
===================================================================
Added: root/tests/metamer/trunk/src/main/webapp/resources/script/swfobject.js
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/script/swfobject.js (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/resources/script/swfobject.js 2010-07-10 18:20:31 UTC (rev 17824)
@@ -0,0 +1,733 @@
+/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
+ Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
+ This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ domLoadFnArr = [],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ script,
+ timer = null,
+ storedAltContent = null,
+ storedAltContentId = null,
+ isDomLoaded = false,
+ isExpressInstallActive = false;
+
+ /* Centralized function for browser feature detection
+ - Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
+ - User agent string detection is only used when no alternative is possible
+ - Is executed directly for optimal performance
+ */
+ var ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ var a = null, fp6Crash = false;
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
+ }
+ catch(e) {
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
+ playerVersion = [6,0,21];
+ a.AllowScriptAccess = "always"; // Introduced in fp6.0.47
+ }
+ catch(e) {
+ if (playerVersion[0] == 6) {
+ fp6Crash = true;
+ }
+ }
+ if (!fp6Crash) {
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ }
+ catch(e) {}
+ }
+ }
+ if (!fp6Crash && a) { // a will return null when ActiveX is disabled
+ try {
+ d = a.GetVariable("$version"); // Will crash fp6.0.21/23/29
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ catch(e) {}
+ }
+ }
+ var u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = false,
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u);
+ /*@cc_on
+ ie = true;
+ @if (@_win32)
+ windows = true;
+ @elif (@_mac)
+ mac = true;
+ @end
+ @*/
+ return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
+ }();
+
+ /* Cross-browser onDomLoad
+ - Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
+ - Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
+ */
+ var onDomLoad = function() {
+ if (!ua.w3cdom) {
+ return;
+ }
+ addDomLoadEvent(main);
+ if (ua.ie && ua.win) {
+ try { // Avoid a possible Operation Aborted error
+ doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors
+ script = getElementById("__ie_ondomload");
+ if (script) {
+ addListener(script, "onreadystatechange", checkReadyState);
+ }
+ }
+ catch(e) {}
+ }
+ if (ua.webkit && typeof doc.readyState != UNDEF) {
+ timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
+ }
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }();
+
+ function checkReadyState() {
+ if (script.readyState == "complete") {
+ script.parentNode.removeChild(script);
+ callDomLoadFunctions();
+ }
+ }
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) {
+ return;
+ }
+ if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
+ var s = createElement("span");
+ try { // Avoid a possible Operation Aborted error
+ var t = doc.getElementsByTagName("body")[0].appendChild(s);
+ t.parentNode.removeChild(t);
+ }
+ catch (e) {
+ return;
+ }
+ }
+ isDomLoaded = true;
+ if (timer) {
+ clearInterval(timer);
+ timer = null;
+ }
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() { // Static publishing only
+ var rl = regObjArr.length;
+ for (var i = 0; i < rl; i++) { // For each registered object element
+ var id = regObjArr[i].id;
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
+ regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
+ if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
+ if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
+ fixParams(obj);
+ }
+ setVisibility(id, true);
+ }
+ else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
+ showExpressInstall(regObjArr[i]);
+ }
+ else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
+ displayAltContent(obj);
+ }
+ }
+ }
+ else { // If no fp is installed, we let the object element do its job (show alternative content)
+ setVisibility(id, true);
+ }
+ }
+ }
+
+ /* Fix nested param elements, which are ignored by older webkit engines
+ - This includes Safari up to and including version 1.2.2 on Mac OS 10.3
+ - Fall back to the proprietary embed element
+ */
+ function fixParams(obj) {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var e = createElement("embed"), a = nestedObj.attributes;
+ if (a) {
+ var al = a.length;
+ for (var i = 0; i < al; i++) {
+ if (a[i].nodeName == "DATA") {
+ e.setAttribute("src", a[i].nodeValue);
+ }
+ else {
+ e.setAttribute(a[i].nodeName, a[i].nodeValue);
+ }
+ }
+ }
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var j = 0; j < cl; j++) {
+ if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
+ e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
+ }
+ }
+ }
+ obj.parentNode.replaceChild(e, obj);
+ }
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(regObj) {
+ isExpressInstallActive = true;
+ var obj = getElementById(regObj.id);
+ if (obj) {
+ if (regObj.altContentId) {
+ var ac = getElementById(regObj.altContentId);
+ if (ac) {
+ storedAltContent = ac;
+ storedAltContentId = regObj.altContentId;
+ }
+ }
+ else {
+ storedAltContent = abstractAltContent(obj);
+ }
+ if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
+ regObj.width = "310";
+ }
+ if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
+ regObj.height = "137";
+ }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ dt = doc.title,
+ fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
+ replaceId = regObj.id;
+ // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
+ // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceId += "SWFObjectNew";
+ newObj.setAttribute("id", replaceId);
+ obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ var fn = function() {
+ obj.parentNode.removeChild(obj);
+ };
+ addListener(win, "onload", fn);
+ }
+ createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
+ // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ var fn = function() {
+ obj.parentNode.removeChild(obj);
+ };
+ addListener(win, "onload", fn);
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
+ var e = createElement("embed");
+ e.setAttribute("type", FLASH_MIME_TYPE);
+ for (var k in attObj) {
+ if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
+ if (k.toLowerCase() == "data") {
+ e.setAttribute("src", attObj[k]);
+ }
+ else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ e.setAttribute("class", attObj[k]);
+ }
+ else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
+ e.setAttribute(k, attObj[k]);
+ }
+ }
+ }
+ for (var l in parObj) {
+ if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
+ if (l.toLowerCase() != "movie") { // Filter out IE specific param element
+ e.setAttribute(l, parObj[l]);
+ }
+ }
+ }
+ el.parentNode.replaceChild(e, el);
+ r = e;
+ }
+ else { // Well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
+ if (ua.ie && ua.win) {
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ win.attachEvent("onload", function() {
+ removeObjectInIE(id);
+ });
+ }
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl) {
+ if (ua.ie && ua.mac) {
+ return;
+ }
+ var h = doc.getElementsByTagName("head")[0], s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", "screen");
+ if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
+ s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ var ls = doc.styleSheets[doc.styleSheets.length - 1];
+ if (typeof ls.addRule == OBJECT) {
+ try {
+ ls.addRule(sel, decl);
+ } catch(e) {}
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
+ if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
+ return;
+ }
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ },
+
+ getObjectById: function(objectIdStr) {
+ var r = null;
+ if (ua.w3cdom) {
+ var o = getElementById(objectIdStr);
+ if (o) {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (!n || (n && typeof o.SetVariable != UNDEF)) {
+ r = o;
+ }
+ else if (typeof n.SetVariable != UNDEF) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
+ if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
+ return;
+ }
+ widthStr += ""; // Auto-convert to string
+ heightStr += "";
+ if (hasPlayerVersion(swfVersionStr)) {
+ setVisibility(replaceElemIdStr, false);
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
+ att[i] = attObj[i];
+ }
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
+ par[j] = parObj[j];
+ }
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) {
+ if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ }
+ addDomLoadEvent(function() {
+ createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ });
+ }
+ else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
+ isExpressInstallActive = true; // deferred execution
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ var regObj = {};
+ regObj.id = regObj.altContentId = replaceElemIdStr;
+ regObj.width = widthStr;
+ regObj.height = heightStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ showExpressInstall(regObj);
+ });
+ }
+ },
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3cdom) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3cdom) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(sel, decl) {
+ if (ua.w3cdom) {
+ createCSS(sel, decl);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ if (q) {
+ var pairs = q.substring(1).split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive && storedAltContent) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) {
+ storedAltContent.style.display = "block";
+ }
+ }
+ storedAltContent = null;
+ storedAltContentId = null;
+ isExpressInstallActive = false;
+ }
+ }
+ }
+ };
+}();
Modified: root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
+++ root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:20:31 UTC (rev 17824)
@@ -36,11 +36,11 @@
<h:panelGrid columns="1">
<h:outputLabel id="skinSelectLabel" value="Select skin: " for="skinSelect" />
- <h:selectOneMenu id="skinSelect" value="#{richBean.skin}" style="width: 130px;">
+ <h:selectOneMenu id="skinSelect" value="#{richBean.skin}" style="width: 130px;" onchange="submit();">
<f:selectItems value="#{richBean.skins}" />
</h:selectOneMenu>
- <h:selectOneMenu id="skinningSelect" value="#{richBean.skinning}" style="width: 130px;">
+ <h:selectOneMenu id="skinningSelect" value="#{richBean.skinning}" style="width: 130px;" onchange="submit();" disabled="true">
<f:selectItems value="#{richBean.skinningList}" />
</h:selectOneMenu>
</h:panelGrid>
14 years, 6 months
JBoss Rich Faces SVN: r17823 - in root/tests/metamer/trunk: src/main/java/org/richfaces/testapp and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:18:32 -0400 (Sat, 10 Jul 2010)
New Revision: 17823
Added:
root/tests/metamer/trunk/src/main/webapp/templates/blueDiv.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/redDiv.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/richDataTable1.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/richDataTable2.xhtml
Removed:
root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml
Modified:
root/tests/metamer/trunk/pom.xml
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml
root/tests/metamer/trunk/src/main/webapp/index.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java
Log:
https://jira.jboss.org/browse/RFPL-466
* pom.xml refactored to use RichFaces' module examples as parent and to use it's profiles to build binaries
* TemplateBean - removed unnecessary attributes and methods
* HtmlCommandLink and HtmlCommandButton changed to UICommandLink and UICommandButton
* templating refactored
* added two new templates - rich data table (line 1 and 2)
* added css style to main page
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/pom.xml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,145 +1,143 @@
<?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/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <!-- <parent>-->
- <!-- <artifactId>examples</artifactId>-->
- <!-- <groupId>org.richfaces</groupId>-->
- <!-- <version>4.0.0-SNAPSHOT</version>-->
- <!-- </parent>-->
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.testapps</groupId>
+
+ <parent>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>examples-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+
+ <groupId>org.richfaces.examples</groupId>
<artifactId>testapp</artifactId>
<packaging>war</packaging>
<name>RichFaces Testing Application</name>
- <version>4.0.0-SNAPSHOT</version>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository for Maven</name>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository for Maven</name>
- <url>http://snapshots.jboss.org/maven2</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>maven-repository2.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>http://download.java.net/maven/2</url>
- </repository>
- </repositories>
-
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+ <!--<dependency>
<groupId>org.richfaces.ui.components</groupId>
<artifactId>core-ui</artifactId>
<version>4.0.0-SNAPSHOT</version>
- </dependency>
+ </dependency>-->
+ <!--<dependency>
+ <groupId>org.richfaces.ui.iteration</groupId>
+ <artifactId>datascroller-ui</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>-->
<dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.9</version>
- <scope>test</scope>
+ <groupId>org.richfaces.ui-sandbox</groupId>
+ <artifactId>tables-ui</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
</dependency>
+
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>2.0.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>2.0.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.5.11</version>
- <type>jar</type>
- <scope>provided</scope>
</dependency>
+ <!--<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>1.5.11</version>
- <type>jar</type>
- <scope>provided</scope>
</dependency>
+
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jcl</artifactId>
- <version>1.5.11</version>
- <type>jar</type>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.9</version>
+ <scope>test</scope>
</dependency>
- <dependency>
+
+
+ <!--<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
<type>jar</type>
<scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ </dependency>-->
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
- <version>1.0_02.CR5</version>
- </dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
</dependencies>
<build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-5</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/tomcat6-assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
+ <finalName>testapp</finalName>
</build>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee5</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee5
+ </webappDirectory>
+ <classifier>jee5</classifier>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*
+ </packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*
+ </warSourceExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <classifier>tomcat6</classifier>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jee5</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee5
+ </webappDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
</project>
+
+
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -354,7 +354,7 @@
if (hasSelectOptions("action")) {
method = ExpressionFactory.newInstance().createMethodExpression(elContext, getMethodEL(outcome), String.class,
new Class[0]);
-
+
return (String) method.invoke(elContext, null);
}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,23 +1,25 @@
-/**
- * License Agreement.
+/*******************************************************************************
+ * 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.
*
- * JBoss RichFaces - Ajax4jsf Component Library
+ * 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.
*
- * 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,
+ * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ * 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.testapp;
/**
@@ -27,8 +29,10 @@
*/
public enum Template {
PLAIN ("plain", "", "Plain"),
- RED_DIV ("red_div", "", "Red div"),
- BLUE_DIV ("blue_div", "", "Blue div");
+ REDDIV ("redDiv", "", "Red div"),
+ BLUEDIV ("blueDiv", "", "Blue div"),
+ RICHDATATABLE1 ("richDataTable1", "", "Rich Data Table Row 1"),
+ RICHDATATABLE2 ("richDataTable2", "", "Rich Data Table Row 2");
private String name;
@@ -72,4 +76,11 @@
return desc;
}
+ /* (non-Javadoc)
+ * @see java.lang.Enum#toString()
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -91,7 +91,7 @@
@Override
public boolean contains(Object o) {
- return templates.contains((Template) o);
+ return templates.contains(o);
}
@Override
@@ -136,7 +136,7 @@
@Override
public boolean remove(Object o) {
- return templates.remove((Template) o);
+ return templates.remove(o);
}
@Override
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -28,7 +28,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
-import org.richfaces.component.html.HtmlCommandButton;
+import org.richfaces.component.UICommandButton;
import org.richfaces.testapp.Attributes;
import org.slf4j.Logger;
@@ -60,7 +60,7 @@
logger = LoggerFactory.getLogger(A4JCommandButtonBean.class);
logger.info("initializing bean " + getClass().getName());
- attributes = new Attributes(HtmlCommandButton.class, getClass());
+ attributes = new Attributes(UICommandButton.class, getClass());
attributes.put("value", "command button");
attributes.put("rendered", "true");
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -28,8 +28,8 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
+import org.richfaces.component.UICommandLink;
-import org.richfaces.component.html.HtmlCommandLink;
import org.richfaces.testapp.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +60,7 @@
logger = LoggerFactory.getLogger(A4JCommandLinkBean.class);
logger.info("initializing bean " + getClass().getName());
- attributes = new Attributes(HtmlCommandLink.class, getClass());
+ attributes = new Attributes(UICommandLink.class, getClass());
attributes.put("value", "command link");
attributes.put("rendered", "true");
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -71,7 +71,7 @@
public void init() {
logger = LoggerFactory.getLogger(RichBean.class);
skins = createSkinList();
- components = createComponentsMap();
+ createComponentsMap();
component = "none";
container = "plain";
@@ -85,14 +85,12 @@
reComponent = true;
}
- private Map<String, String> createComponentsMap() {
- Map<String, String> components = new TreeMap<String, String>();
+ private void createComponentsMap() {
+ components = new TreeMap<String, String>();
components.put("a4jCommandLink", "A4J Command Link");
components.put("a4jCommandButton", "A4J Command Button");
components.put("commandButton", "JSF Command Button");
-
- return components;
}
private List<String> createSkinList() {
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,23 +1,25 @@
-/**
- * License Agreement.
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Exadel, Inc.,
+ * 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.
*
- * JBoss RichFaces - Ajax4jsf Component Library
+ * 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.
*
- * 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,
+ * 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
+ * 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
- */
+ * 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.testapp.bean;
@@ -40,26 +42,20 @@
public class TemplateBean implements Serializable {
private static final long serialVersionUID = 5078700314562231363L;
-
- private static final Logger logger = LoggerFactory.getLogger(TemplateBean.class);
-
- static final List<String> dataTableModel = new ArrayList<String>();
- static {
- dataTableModel.add("1");
- dataTableModel.add("2");
- }
-
+ private static Logger logger = LoggerFactory.getLogger(TemplateBean.class);
+ private List<String> dataTableModel = new ArrayList<String>();
private TemplatesList templates;
-
- private Integer dataTableRowIndex = 0;
-
private int templateIndex = 0;
-
+
@PostConstruct
public void init() {
templates = new TemplatesList();
+ dataTableModel.add("row 1");
+ dataTableModel.add("row 2");
+ dataTableModel.add("row 3");
+ dataTableModel.add("row 4");
}
-
+
/**
* @return the templates
*/
@@ -81,25 +77,18 @@
}
/**
- * @return the dataTableRowIndex
- */
- public Integer getDataTableRowIndex() {
- return dataTableRowIndex;
- }
-
- /**
* @return the dataTableModel
*/
public List<String> getDataTableModel() {
return dataTableModel;
}
-
+
public String getFirstTemplate() {
templateIndex = 0;
- return templates.get(0).toString().toLowerCase();
+ return templates.get(0).toString();
}
-
+
public String getNextTemplate() {
- return templates.get(++templateIndex).toString().toLowerCase();
+ return templates.get(++templateIndex).toString();
}
-}
\ No newline at end of file
+}
Modified: root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/webapp/WEB-INF/web.xml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,30 +1,16 @@
<?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"
- version="2.5">
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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>testapp</display-name>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>#{richBean.skin}</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING</param-name>
- <param-value>#{richBean.skinning}</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
- <param-value>#{richBean.skinningClasses}</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>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
@@ -39,4 +25,4 @@
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
-</web-app>
\ No newline at end of file
+</web-app>
Modified: root/tests/metamer/trunk/src/main/webapp/index.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/index.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/webapp/index.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,23 +1,19 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core">
-<h:head>
- <title>Testing Application</title>
- <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
- <!-- <h:outputStylesheet library="css" name="common.css" />-->
-</h:head>
+ <h:head>
+ <title>Testing Application</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="common.css" />
+ </h:head>
-<h:body>
-
- <h:form id="linksForm">
- <h:panelGrid id="attributes">
- <c:forEach items="#{richBean.components}" var="entry">
- <h:commandLink action="#{richBean.getListPage(entry.key)}" value="#{entry.key}" />
- </c:forEach>
- </h:panelGrid>
- </h:form>
-
-</h:body>
+ <h:body>
+ <h:form id="linksForm">
+ <h:panelGrid id="attributes">
+ <c:forEach items="#{richBean.components}" var="entry">
+ <h:commandLink action="#{richBean.getListPage(entry.key)}" value="#{entry.key}" />
+ </c:forEach>
+ </h:panelGrid>
+ </h:form>
+ </h:body>
</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/templates/blueDiv.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/blueDiv.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/blueDiv.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -0,0 +1,10 @@
+<!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:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition>
+
+ <div style="border: 2px blue dotted; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ src="#{templateBean.nextTemplate}.xhtml" /></div>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Deleted: root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,12 +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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-<ui:composition>
-
- <div style="border: 2px blue dotted; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
- src="#{templateBean.nextTemplate}.xhtml" /></div>
-
-</ui:composition>
-</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/templates/redDiv.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/redDiv.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/redDiv.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -0,0 +1,10 @@
+<!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:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition>
+
+ <div style="border: 2px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ src="#{templateBean.nextTemplate}.xhtml" /></div>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Deleted: root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,12 +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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-<ui:composition>
-
- <div style="border: 2px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
- src="#{templateBean.nextTemplate}.xhtml" /></div>
-
-</ui:composition>
-</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/templates/richDataTable1.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/richDataTable1.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/richDataTable1.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -0,0 +1,20 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition>
+
+ <rich:dataTable value="#{templateBean.dataTableModel}" var="item" id="containerDataTable1" rowKeyVar="row">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data Table" />
+ </f:facet>
+ <h:panelGroup columns="1" rendered="#{row ==0}">
+ <ui:include src="#{templateBean.nextTemplate}.xhtml" />
+ </h:panelGroup>
+ <h:outputText value="#{item}" rendered="#{row != 0}" />
+ </rich:column>
+ </rich:dataTable>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/templates/richDataTable2.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/richDataTable2.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/richDataTable2.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -0,0 +1,20 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition>
+
+ <rich:dataTable value="#{templateBean.dataTableModel}" var="item" id="containerDataTable2" rowKeyVar="row">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data Table" />
+ </f:facet>
+ <h:panelGroup columns="1" rendered="#{row == 1}">
+ <ui:include src="#{templateBean.nextTemplate}.xhtml" />
+ </h:panelGroup>
+ <h:outputText value="#{item}" rendered="#{row != 1}" />
+ </rich:column>
+ </rich:dataTable>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:18:32 UTC (rev 17823)
@@ -7,6 +7,19 @@
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<h:outputStylesheet library="css" name="common.css" />
<ui:insert name="head"/>
+ <script type="text/javascript">A4J.AJAX.onExpired = function(loc, expiredMsg){
+
+ if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location: "+loc)){
+
+ return loc;
+
+ } else {
+
+ return false;
+
+ }
+
+}</script>
</h:head>
<h:body>
Modified: root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java
===================================================================
--- root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java 2010-07-10 18:17:29 UTC (rev 17822)
+++ root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java 2010-07-10 18:18:32 UTC (rev 17823)
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * 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.testapp;
import org.testng.annotations.BeforeMethod;
@@ -6,7 +28,8 @@
/**
*
- * @author Pavol Pitonak
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
*/
public class TemplatesListTest {
@@ -25,21 +48,21 @@
@Test
public void testSetIntTemplate() {
- templates.set(0, Template.RED_DIV);
+ templates.set(0, Template.REDDIV);
assertEquals(templates.size(), 2, "Size after red_div was inserted on position 0");
- assertEquals(templates.get(0), Template.RED_DIV, "position 0");
+ assertEquals(templates.get(0), Template.REDDIV, "position 0");
assertEquals(templates.get(1), Template.PLAIN, "position 1");
- templates.set(1, Template.BLUE_DIV);
+ templates.set(1, Template.BLUEDIV);
assertEquals(templates.size(), 3, "Size after blue_div was inserted on position 1");
- assertEquals(templates.get(0), Template.RED_DIV, "position 0");
- assertEquals(templates.get(1), Template.BLUE_DIV, "position 1");
+ assertEquals(templates.get(0), Template.REDDIV, "position 0");
+ assertEquals(templates.get(1), Template.BLUEDIV, "position 1");
assertEquals(templates.get(2), Template.PLAIN, "position 2");
- templates.set(0, Template.BLUE_DIV);
+ templates.set(0, Template.BLUEDIV);
assertEquals(templates.size(), 3, "Size after blue_div was inserted on position 0");
- assertEquals(templates.get(0), Template.BLUE_DIV, "position 0");
- assertEquals(templates.get(1), Template.BLUE_DIV, "position 1");
+ assertEquals(templates.get(0), Template.BLUEDIV, "position 0");
+ assertEquals(templates.get(1), Template.BLUEDIV, "position 1");
assertEquals(templates.get(2), Template.PLAIN, "position 2");
}
}
14 years, 6 months
JBoss Rich Faces SVN: r17822 - in root/tests/metamer/trunk/src/main/webapp: resources/testapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:17:29 -0400 (Sat, 10 Jul 2010)
New Revision: 17822
Removed:
root/tests/metamer/trunk/src/main/webapp/blank.xhtml
root/tests/metamer/trunk/src/main/webapp/none.xhtml
Modified:
root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
Log:
https://jira.jboss.org/browse/RFPL-466
* unnecessary files removed
* attributes change to perform full request on blur
Deleted: root/tests/metamer/trunk/src/main/webapp/blank.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/blank.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
+++ root/tests/metamer/trunk/src/main/webapp/blank.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
@@ -1,5 +0,0 @@
-<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-</ui:composition>
\ No newline at end of file
Deleted: root/tests/metamer/trunk/src/main/webapp/none.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/none.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
+++ root/tests/metamer/trunk/src/main/webapp/none.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
@@ -1,7 +0,0 @@
-<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-Welcome to RichFaces 4 testing application
-
-</ui:composition>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
+++ root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml 2010-07-10 18:17:29 UTC (rev 17822)
@@ -29,23 +29,18 @@
<c:choose>
<c:when test="#{cc.attrs.value.isBoolean(entry.key)}">
- <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}">
- <a4j:ajax event="change" render="#{cc.attrs.render}" />
- </h:selectBooleanCheckbox>
+ <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" onchange="submit()" />
</c:when>
<c:when test="#{cc.attrs.value.hasSelectOptions(entry.key)}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}"
+ <h:selectOneRadio id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" onchange="submit()"
layout="pageDirection">
<f:selectItems value="#{cc.attrs.value.getSelectOptions(entry.key)}" />
- <a4j:ajax event="change" render="#{cc.attrs.render}" />
</h:selectOneRadio>
</c:when>
<c:otherwise>
- <h:inputText id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" style="width: 200px;">
- <a4j:ajax event="blur" render="#{cc.attrs.render}" />
- </h:inputText>
+ <h:inputText id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" style="width: 200px;" onblur="submit()" />
</c:otherwise>
</c:choose>
@@ -53,4 +48,4 @@
</h:panelGrid>
</composite:implementation>
</h:body>
-</html>
\ No newline at end of file
+</html>
14 years, 6 months
JBoss Rich Faces SVN: r17821 - in root/tests/metamer/trunk/src: main/java/org/richfaces/testapp and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:16:51 -0400 (Sat, 10 Jul 2010)
New Revision: 17821
Added:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesListConverter.java
root/tests/metamer/trunk/src/test/
root/tests/metamer/trunk/src/test/java/
root/tests/metamer/trunk/src/test/java/org/
root/tests/metamer/trunk/src/test/java/org/richfaces/
root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/
root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java
Modified:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplateNameConverter.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-466
* nested templating fixed
* view parameters handling fixed
* added two tests for class TemplatesList
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -40,6 +40,7 @@
import java.util.regex.Pattern;
import javax.el.ELContext;
+import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.faces.bean.ManagedBean;
import javax.faces.component.UIComponentBase;
@@ -47,7 +48,6 @@
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
-import org.jboss.el.ExpressionFactoryImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -346,14 +346,15 @@
// if no select options for "action" are defined in property file and it is an EL expression
if (!hasSelectOptions("action") && isStringEL(outcome)) {
- method = new ExpressionFactoryImpl().createMethodExpression(elContext, outcome, String.class, new Class[0]);
+ method = ExpressionFactory.newInstance().createMethodExpression(elContext, outcome, String.class, new Class[0]);
return (String) method.invoke(elContext, null);
}
// if select options for "action" are defined in property file
if (hasSelectOptions("action")) {
- method = new ExpressionFactoryImpl().createMethodExpression(elContext, getMethodEL(outcome), String.class,
+ method = ExpressionFactory.newInstance().createMethodExpression(elContext, getMethodEL(outcome), String.class,
new Class[0]);
+
return (String) method.invoke(elContext, null);
}
@@ -374,14 +375,14 @@
// if no select options for "actionListener" are defined in property file and it is an EL expression
if (!hasSelectOptions("actionListener") && isStringEL(listener)) {
- method = new ExpressionFactoryImpl().createMethodExpression(elContext, listener, void.class,
+ method = ExpressionFactory.newInstance().createMethodExpression(elContext, listener, void.class,
new Class[] { ActionEvent.class });
method.invoke(elContext, new Object[] { event });
}
// if select options for "actionListener" are defined in property file
if (hasSelectOptions("actionListener")) {
- method = new ExpressionFactoryImpl().createMethodExpression(elContext, getMethodEL(listener), void.class,
+ method = ExpressionFactory.newInstance().createMethodExpression(elContext, getMethodEL(listener), void.class,
new Class[] { ActionEvent.class });
method.invoke(elContext, new Object[] { event });
}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplateNameConverter.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplateNameConverter.java 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplateNameConverter.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -40,6 +40,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
try {
return Template.valueOf(value.toUpperCase());
@@ -51,6 +52,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value instanceof String) {
return (String) value;
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -19,7 +19,6 @@
* 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.testapp;
import java.util.ArrayList;
@@ -39,130 +38,167 @@
*/
public class TemplatesList implements List<Template> {
- private List<Template> templates = new ArrayList<Template>();
- private Logger logger = LoggerFactory.getLogger(TemplatesList.class);
+ private List<Template> templates;
+ private Logger logger;
+ public TemplatesList() {
+ logger = LoggerFactory.getLogger(TemplatesList.class);
+ templates = new ArrayList<Template>();
+ templates.add(Template.PLAIN);
+ }
+
+ @Override
public boolean add(Template e) {
- // if list is empty, add template
- if (templates.isEmpty()) {
- return templates.add(e);
+ if (e == Template.PLAIN) {
+ return false;
}
- // if last item in list is plain template, don't do anything
- if (templates.get(size() - 1) == Template.PLAIN) {
- return false;
+ templates.add(templates.size() - 1, e);
+
+ for (Template t : templates) {
+ logger.info(t.toString());
}
- return templates.add(e);
+ return true;
}
+ @Override
public void add(int index, Template element) {
templates.add(index, element);
- // add new item to the list
- // if the last item is being changed, nothing happens, otherwise it will be again removed
- templates.add(Template.PLAIN);
-
+
// remove the rest of list if plain is set
if (element == Template.PLAIN) {
while (templates.size() > index + 1) {
templates.remove(index + 1);
}
- }
+ }
}
+ @Override
public boolean addAll(Collection<? extends Template> c) {
return templates.addAll(c);
}
+ @Override
public boolean addAll(int index, Collection<? extends Template> c) {
return templates.addAll(index, c);
}
+ @Override
public void clear() {
templates.clear();
}
+ @Override
public boolean contains(Object o) {
- return templates.contains(o);
+ return templates.contains((Template) o);
}
+ @Override
public boolean containsAll(Collection<?> c) {
return templates.containsAll(c);
}
+ @Override
public Template get(int index) {
return templates.get(index);
}
+ @Override
public int indexOf(Object o) {
return templates.indexOf(o);
}
+ @Override
public boolean isEmpty() {
return templates.isEmpty();
}
+ @Override
public Iterator<Template> iterator() {
return templates.iterator();
}
+ @Override
public int lastIndexOf(Object o) {
return templates.lastIndexOf(o);
}
+ @Override
public ListIterator<Template> listIterator() {
return templates.listIterator();
}
+ @Override
public ListIterator<Template> listIterator(int index) {
return templates.listIterator(index);
}
+ @Override
public boolean remove(Object o) {
- return templates.remove(o);
+ return templates.remove((Template) o);
}
+ @Override
public Template remove(int index) {
return templates.remove(index);
}
+ @Override
public boolean removeAll(Collection<?> c) {
return templates.removeAll(c);
}
+ @Override
public boolean retainAll(Collection<?> c) {
return templates.retainAll(c);
}
+ @Override
public Template set(int index, Template element) {
Template old = templates.set(index, element);
-
+
// remove the rest of list if plain is set
if (element == Template.PLAIN) {
while (templates.size() > index + 1) {
templates.remove(index + 1);
}
} else {
- add(Template.PLAIN);
+ if (index == templates.size() - 1) {
+ templates.add(Template.PLAIN);
+ }
}
-
+
return old;
}
+ @Override
public int size() {
return templates.size();
}
+ @Override
public List<Template> subList(int fromIndex, int toIndex) {
return templates.subList(fromIndex, toIndex);
}
+ @Override
public Object[] toArray() {
return templates.toArray();
}
+ @Override
public <T> T[] toArray(T[] a) {
return templates.toArray(a);
}
-}
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (Template t : templates) {
+ sb.append(t.toString());
+ sb.append(",");
+ }
+ return sb.toString();
+ }
+}
\ No newline at end of file
Copied: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesListConverter.java (from rev 17820, root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplateNameConverter.java)
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesListConverter.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesListConverter.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.testapp;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+
+/**
+ * Converter used for view parameter "template".
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@FacesConverter(value = "templatesListConverter")
+public class TemplatesListConverter implements Converter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ try {
+ TemplatesList list = new TemplatesList();
+
+ for (String template : value.split(",")) {
+ list.add(Template.valueOf(template.toUpperCase()));
+ }
+
+ return list;
+ } catch (IllegalArgumentException iae) {
+ throw new FacesException("Cannot convert parameter \"" + value + "\" to the list of templates.", iae);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value instanceof String) {
+ return (String) value;
+ }
+
+ if (value instanceof TemplatesList) {
+ return value.toString();
+ }
+
+ throw new FacesException("Cannot convert parameter \"" + value + "\" to the list of templates.");
+ }
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -49,16 +49,8 @@
dataTableModel.add("2");
}
- public static final String PARAM_NAME = "t";
-
- private Template template = Template.PLAIN;
-
private TemplatesList templates;
- private Template templatePath = Template.PLAIN;
-
- private String methodName;
-
private Integer dataTableRowIndex = 0;
private int templateIndex = 0;
@@ -66,67 +58,19 @@
@PostConstruct
public void init() {
templates = new TemplatesList();
- templates.add(Template.PLAIN);
}
/**
* @return the templates
*/
- public List<Template> getTemplates() {
+ public TemplatesList getTemplates() {
return templates;
}
- public String getTemplateId() {
- return template.toString();
+ public void setTemplates(TemplatesList templates) {
+ this.templates = templates;
}
-
- public void setTemplateId(String template) {
- this.template = Template.valueOf(template);
-// if (this.template.equals(Template.DATA_TABLE)) {
-// dataTableRowIndex = 0;
-// } else if (this.template.equals(Template.DATA_TABLE2)) {
-// dataTableRowIndex = 1;
-// }
- }
-
- public String getParentId() {
- return template.getPrefix();
- }
-
- /**
- * @return the template
- */
- public String getTemplate() {
- return "/templates/" + template.getName() + ".xhtml";
- }
-
- /**
- * @return the template
- */
- public String getAutoTestTemplate() {
- return "/templates/autotest/" + template.getName() + ".xhtml";
- }
-
- /**
- * @return the template
- */
- public String getTemplatePath() {
- return template.getName() + ".xhtml";
- }
-
- /**
- * @param template
- * the template to set
- */
- public void setTemplate(Template template) {
- this.template = template;
- }
-
- public void setTemplatePath(Template templatePath) {
- this.templatePath = templatePath;
- }
-
public List<SelectItem> getAvailableTemplates() {
List<SelectItem> retVal = new ArrayList<SelectItem>();
for (Template template : Template.values()) {
@@ -137,21 +81,6 @@
}
/**
- * @return the methodName
- */
- public String getMethodName() {
- return methodName;
- }
-
- /**
- * @param methodName
- * the methodName to set
- */
- public void setMethodName(String methodName) {
- this.methodName = methodName;
- }
-
- /**
* @return the dataTableRowIndex
*/
public Integer getDataTableRowIndex() {
@@ -165,22 +94,6 @@
return dataTableModel;
}
-// public boolean isRendered(int index) {
-// if (index < 0) {
-// throw new IllegalArgumentException("Template nr. " + index + " does not exist.");
-// }
-//
-// if (index == 0) {
-// return true;
-// }
-//
-// for (int i = 1; i <= index; i++) {
-// if (templates.get(index-1) == Template.PLAIN) {
-// return false;
-// }
-// }
-// }
-
public String getFirstTemplate() {
templateIndex = 0;
return templates.get(0).toString().toLowerCase();
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
@@ -7,8 +7,8 @@
<ui:define name="head">
<f:metadata>
- <f:viewParam name="template" value="#{templateBean.templateId}">
- <f:converter converterId="templateNameConverter" />
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
@@ -7,8 +7,8 @@
<ui:define name="head">
<f:metadata>
- <f:viewParam name="template" value="#{templateBean.templateId}">
- <f:converter converterId="templateNameConverter" />
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
Modified: root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
+++ root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml 2010-07-10 18:16:51 UTC (rev 17821)
@@ -7,8 +7,8 @@
<ui:define name="head">
<f:metadata>
- <f:viewParam name="template" value="#{templateBean.templateId}">
- <f:converter converterId="templateNameConverter" />
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
Added: root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java
===================================================================
--- root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java (rev 0)
+++ root/tests/metamer/trunk/src/test/java/org/richfaces/testapp/TemplatesListTest.java 2010-07-10 18:16:51 UTC (rev 17821)
@@ -0,0 +1,45 @@
+package org.richfaces.testapp;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ *
+ * @author Pavol Pitonak
+ */
+public class TemplatesListTest {
+
+ private TemplatesList templates;
+
+ @BeforeMethod
+ public void setUpTest() {
+ templates = new TemplatesList();
+ }
+
+ @Test
+ public void testNewList() {
+ assertEquals(templates.size(), 1, "New list should contain one element");
+ assertEquals(templates.get(0), Template.PLAIN, "New list should contain plain template");
+ }
+
+ @Test
+ public void testSetIntTemplate() {
+ templates.set(0, Template.RED_DIV);
+ assertEquals(templates.size(), 2, "Size after red_div was inserted on position 0");
+ assertEquals(templates.get(0), Template.RED_DIV, "position 0");
+ assertEquals(templates.get(1), Template.PLAIN, "position 1");
+
+ templates.set(1, Template.BLUE_DIV);
+ assertEquals(templates.size(), 3, "Size after blue_div was inserted on position 1");
+ assertEquals(templates.get(0), Template.RED_DIV, "position 0");
+ assertEquals(templates.get(1), Template.BLUE_DIV, "position 1");
+ assertEquals(templates.get(2), Template.PLAIN, "position 2");
+
+ templates.set(0, Template.BLUE_DIV);
+ assertEquals(templates.size(), 3, "Size after blue_div was inserted on position 0");
+ assertEquals(templates.get(0), Template.BLUE_DIV, "position 0");
+ assertEquals(templates.get(1), Template.BLUE_DIV, "position 1");
+ assertEquals(templates.get(2), Template.PLAIN, "position 2");
+ }
+}
14 years, 6 months
JBoss Rich Faces SVN: r17820 - in root/tests/metamer/trunk/src/main: resources/org/richfaces/testapp/bean and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:15:26 -0400 (Sat, 10 Jul 2010)
New Revision: 17820
Added:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandButtonBean.properties
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/CommandButtonBean.properties
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/list.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/components/commandButton/
root/tests/metamer/trunk/src/main/webapp/components/commandButton/list.xhtml
root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandButton.css
root/tests/metamer/trunk/src/main/webapp/resources/css/commandButton.css
root/tests/metamer/trunk/src/main/webapp/resources/css/list.css
root/tests/metamer/trunk/src/main/webapp/resources/testapp/css/
root/tests/metamer/trunk/src/main/webapp/resources/testapp/css/attributes.css
Modified:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandLink.css
root/tests/metamer/trunk/src/main/webapp/resources/css/common.css
root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-466
* added a4j:commandButton and h:commandButton
* added css to all xhtml files
* templates refactored
* fixed bug in template selector
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandButtonBean.java 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * 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.testapp.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.event.ActionEvent;
+import org.richfaces.component.html.HtmlCommandButton;
+
+import org.richfaces.testapp.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:commandButton.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "a4jButtonBean")
+@SessionScoped
+public class A4JCommandButtonBean implements Serializable {
+
+ private static final long serialVersionUID = -2556026843426776944L;
+ private static final int ACTION_STRING_LENGTH = 6;
+ private static Logger logger;
+ private Attributes attributes;
+ private String input;
+ private String input2;
+ private String input3;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(A4JCommandButtonBean.class);
+ logger.info("initializing bean " + getClass().getName());
+
+ attributes = new Attributes(HtmlCommandButton.class, getClass());
+
+ attributes.put("value", "command button");
+ attributes.put("rendered", "true");
+ attributes.put("disabled", "false");
+ attributes.putAttributeClass("disabled", Boolean.class);
+ attributes.put("render", "output1 output2 output3");
+
+ }
+
+ /**
+ * Getter for attributes.
+ *
+ * @return A map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Setter for attributes.
+ *
+ * @param attributes
+ * map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * Getter for input.
+ *
+ * @return value entered by a user
+ */
+ public String getInput() {
+ return input;
+ }
+
+ /**
+ * Getter for input2.
+ *
+ * @return value entered by a user modified by selected action
+ */
+ public String getInput2() {
+ return input2;
+ }
+
+ /**
+ * Getter for input3.
+ *
+ * @return value entered by a user modified by selected action listener
+ */
+ public String getInput3() {
+ return input3;
+ }
+
+ /**
+ * Setter for input.
+ *
+ * @param input
+ * value which user entered into text input on the page
+ */
+ public void setInput(String input) {
+ this.input = input;
+ }
+
+ /**
+ * An action that takes the first six characters from input and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String first6CharsAction() {
+ logger.info("action invoked");
+ if (input == null) {
+ return "";
+ } else {
+ int endIndex = input.length() > ACTION_STRING_LENGTH ? ACTION_STRING_LENGTH : input.length();
+ input2 = (String) input.subSequence(0, endIndex);
+ return null;
+ }
+ }
+
+ /**
+ * An action that takes user's input, doubles it and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String doubleStringAction() {
+ if (input == null) {
+ input2 = "";
+ } else {
+ input2 = input.concat(input);
+ }
+
+ return null;
+ }
+
+ /**
+ * An action that takes user's input, converts it to upper case and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String toUpperCaseAction() {
+ if (input == null) {
+ return "";
+ } else {
+ input2 = input.toUpperCase();
+ return null;
+ }
+ }
+
+ /**
+ * An action listener that takes the first six characters from input and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void first6CharsActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ int endIndex = input.length() > ACTION_STRING_LENGTH ? ACTION_STRING_LENGTH : input.length();
+ input3 = (String) input.subSequence(0, endIndex);
+ }
+ }
+
+ /**
+ * An action listener that takes user's input, doubles it and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void doubleStringActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ input3 = input.concat(input);
+ }
+ }
+
+ /**
+ * An action listener that takes user's input, converts it to upper case and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void toUpperCaseActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ input3 = input.toUpperCase();
+ }
+ }
+
+}
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/CommandButtonBean.java 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * 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.testapp.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.event.ActionEvent;
+
+import org.richfaces.testapp.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for h:commandButton.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "buttonBean")
+@SessionScoped
+public class CommandButtonBean implements Serializable {
+
+ private static final long serialVersionUID = -2576526843426776944L;
+ private static final int ACTION_STRING_LENGTH = 6;
+ private static Logger logger;
+ private Attributes attributes;
+ private String input;
+ private String input2;
+ private String input3;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(CommandButtonBean.class);
+ logger.info("initializing bean " + getClass().getName());
+
+ attributes = new Attributes(HtmlCommandButton.class, getClass());
+
+ attributes.put("value", "command button");
+ attributes.put("rendered", "true");
+ attributes.put("render", "output1 output2 output3");
+ attributes.put("action", "first6CharsAction");
+ attributes.put("actionListener", "toUpperCaseActionListener");
+ }
+
+ /**
+ * Getter for attributes.
+ *
+ * @return A map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Setter for attributes.
+ *
+ * @param attributes
+ * map containing all attributes of tested component. Name of the component is key in the map.
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * Getter for input.
+ *
+ * @return value entered by a user
+ */
+ public String getInput() {
+ return input;
+ }
+
+ /**
+ * Getter for input2.
+ *
+ * @return value entered by a user modified by selected action
+ */
+ public String getInput2() {
+ return input2;
+ }
+
+ /**
+ * Getter for input3.
+ *
+ * @return value entered by a user modified by selected action listener
+ */
+ public String getInput3() {
+ return input3;
+ }
+
+ /**
+ * Setter for input.
+ *
+ * @param input
+ * value which user entered into text input on the page
+ */
+ public void setInput(String input) {
+ this.input = input;
+ }
+
+ /**
+ * An action that takes the first six characters from input and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String first6CharsAction() {
+ if (input == null) {
+ return "";
+ } else {
+ int endIndex = input.length() > ACTION_STRING_LENGTH ? ACTION_STRING_LENGTH : input.length();
+ input2 = (String) input.subSequence(0, endIndex);
+ return null;
+ }
+ }
+
+ /**
+ * An action that takes user's input, doubles it and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String doubleStringAction() {
+ if (input == null) {
+ input2 = "";
+ } else {
+ input2 = input.concat(input);
+ }
+
+ return null;
+ }
+
+ /**
+ * An action that takes user's input, converts it to upper case and stores it to input2.
+ *
+ * @return null since no navigation should be performed
+ */
+ public String toUpperCaseAction() {
+ if (input == null) {
+ return "";
+ } else {
+ input2 = input.toUpperCase();
+ return null;
+ }
+ }
+
+ /**
+ * An action listener that takes the first six characters from input and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void first6CharsActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ int endIndex = input.length() > ACTION_STRING_LENGTH ? ACTION_STRING_LENGTH : input.length();
+ input3 = (String) input.subSequence(0, endIndex);
+ }
+ }
+
+ /**
+ * An action listener that takes user's input, doubles it and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void doubleStringActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ input3 = input.concat(input);
+ }
+ }
+
+ /**
+ * An action listener that takes user's input, converts it to upper case and stores it to input3.
+ *
+ * @param event
+ * an event representing the activation of a user interface component (not used)
+ */
+ public void toUpperCaseActionListener(ActionEvent event) {
+ if (input == null) {
+ input3 = "";
+ } else {
+ input3 = input.toUpperCase();
+ }
+ }
+
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/RichBean.java 2010-07-10 18:15:26 UTC (rev 17820)
@@ -90,9 +90,7 @@
components.put("a4jCommandLink", "A4J Command Link");
components.put("a4jCommandButton", "A4J Command Button");
- components.put("hCommandLink", "Command Link");
- components.put("progressBar", "Progress Bar");
- components.put("richDataTable", "Rich Data Table");
+ components.put("commandButton", "JSF Command Button");
return components;
}
Added: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandButtonBean.properties
===================================================================
Modified: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties
===================================================================
--- root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties 2010-07-10 18:15:26 UTC (rev 17820)
@@ -7,4 +7,4 @@
attr.actionListener.first6CharsActionListener=first6CharsActionListener
attr.actionListener.doubleStringActionListener=doubleStringActionListener
-attr.actionListener.toUpperCaseActionListener=toUpperCaseActionListener
\ No newline at end of file
+attr.actionListener.toUpperCaseActionListener=toUpperCaseActionListener
Copied: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/CommandButtonBean.properties (from rev 17819, root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties)
===================================================================
--- root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/CommandButtonBean.properties (rev 0)
+++ root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/CommandButtonBean.properties 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,13 @@
+attr.action.first6CharsAction=first6CharsAction
+attr.action.doubleStringAction=doubleStringAction
+attr.action.toUpperCaseAction=toUpperCaseAction
+
+attr.actionListener.first6CharsActionListener=first6CharsActionListener
+attr.actionListener.doubleStringActionListener=doubleStringActionListener
+attr.actionListener.toUpperCaseActionListener=toUpperCaseActionListener
+
+attr.styleClass.red=red
+attr.styleClass.blue=blue
+attr.styleClass.big=big
+attr.styleClass.wide=wide
+attr.styleClass.none=
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/list.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/list.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,18 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+ <h:head>
+ <title>A4J Command Button</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+ </h:head>
+
+ <h:body>
+
+ <h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
+ <div>Simple page that contains ajax command button and input boxes for all its attributes.</div>
+
+ </h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandButton/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,61 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:ta="http://java.sun.com/jsf/composite/testapp">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="template" value="#{templateBean.templateId}">
+ <f:converter converterId="templateNameConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="a4jCommandButton.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <h:panelGrid id="panel" columns="2">
+ <h:inputText id="input" value="#{a4jButtonBean.input}" />
+
+ <a4j:commandButton id="a4jCommandButton"
+ action="#{a4jButtonBean.attributes.action}"
+ actionListener="#{a4jButtonBean.attributes.actionListener}"
+ disabled="#{a4jButtonBean.attributes['disabled']}"
+ immediate="#{a4jButtonBean.attributes['immediate']}"
+ onclick="#{a4jButtonBean.attributes['onclick']}"
+ ondblclick="#{a4jButtonBean.attributes['ondblclick']}"
+ onkeydown="#{a4jButtonBean.attributes['onkeydown']}"
+ onkeypress="#{a4jButtonBean.attributes['onkeypress']}"
+ onkeyup="#{a4jButtonBean.attributes['onkeyup']}"
+ onmousedown="#{a4jButtonBean.attributes['onmousedown']}"
+ onmousemove="#{a4jButtonBean.attributes['onmousemove']}"
+ onmouseout="#{a4jButtonBean.attributes['onmouseout']}"
+ onmouseover="#{a4jButtonBean.attributes['onmouseover']}"
+ onmouseup="#{a4jButtonBean.attributes['onmouseup']}"
+ render="#{a4jButtonBean.attributes['render']}"
+ rendered="#{a4jButtonBean.attributes['rendered']}"
+ style="#{a4jButtonBean.attributes['style']}"
+ styleClass="#{a4jButtonBean.attributes['styleClass']}"
+ value="#{a4jButtonBean.attributes['value']}"
+ execute="@form" />
+ </h:panelGrid>
+
+ <h:panelGrid id="outputs" columns="2">
+ output: <h:outputText value="#{a4jButtonBean.input}" id="output1" />
+ action: <h:outputText value="#{a4jButtonBean.input2}" id="output2" />
+ action listener:<h:outputText value="#{a4jButtonBean.input3}" id="output3" />
+ </h:panelGrid>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jButtonBean.attributes}" id="attributes" render="panel"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/list.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -6,13 +6,13 @@
<h:head>
<title>A4J Command Link</title>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
- <!-- <h:outputStylesheet library="css" name="common.css" />-->
+ <h:outputStylesheet library="css" name="list.css" />
</h:head>
<h:body>
<h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
- <div>Simple page that contain command link and input boxes for all its attributes.</div>
+ <div>Simple page that contains ajax command link and input boxes for all its attributes.</div>
</h:body>
</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -1,124 +1,62 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:ta="http://java.sun.com/jsf/composite/testapp">
-<ui:composition template="/templates/template.xhtml">
+ <ui:composition template="/templates/template.xhtml">
- <ui:define name="head">
- <style>
-table.attributes {
- border-width: 0px;
- border-collapse: collapse;
-}
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="template" value="#{templateBean.templateId}">
+ <f:converter converterId="templateNameConverter" />
+ </f:viewParam>
+ </f:metadata>
-.attributes-first-column {
- border-width: 1px;
- padding: 10px;
- border-style: dotted;
- border-color: blue;
- border-right: none;
-}
+ <h:outputStylesheet library="css" name="a4jCommandLink.css"/>
+ </ui:define>
-.attributes-second-column {
- border-width: 1px;
- padding: 10px;
- padding-left: 0px;
- border-style: dotted;
- border-color: blue;
- border-left: none;
-}
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
-.attributes-second-column table input {
- margin-left: 0px;
-}
-</style>
- </ui:define>
+ <ui:define name="component">
- <ui:define name="viewParams">
- <f:metadata>
- <f:viewParam name="template" value="#{templateBean.templateId}">
- <f:converter converterId="templateNameConverter" />
- </f:viewParam>
- </f:metadata>
- </ui:define>
+ <h:panelGrid id="panel" columns="2">
+ <h:inputText id="input" value="#{a4jLinkBean.input}" />
- <ui:define name="outOfTemplateBefore">
- </ui:define>
+ <a4j:commandLink id="a4jCommandLink"
+ action="#{a4jLinkBean.attributes.action}"
+ actionListener="#{a4jLinkBean.attributes.actionListener}"
+ disabled="#{a4jLinkBean.attributes['disabled']}"
+ immediate="#{a4jLinkBean.attributes['immediate']}"
+ onclick="#{a4jLinkBean.attributes['onclick']}"
+ ondblclick="#{a4jLinkBean.attributes['ondblclick']}"
+ onkeydown="#{a4jLinkBean.attributes['onkeydown']}"
+ onkeypress="#{a4jLinkBean.attributes['onkeypress']}"
+ onkeyup="#{a4jLinkBean.attributes['onkeyup']}"
+ onmousedown="#{a4jLinkBean.attributes['onmousedown']}"
+ onmousemove="#{a4jLinkBean.attributes['onmousemove']}"
+ onmouseout="#{a4jLinkBean.attributes['onmouseout']}"
+ onmouseover="#{a4jLinkBean.attributes['onmouseover']}"
+ onmouseup="#{a4jLinkBean.attributes['onmouseup']}"
+ render="#{a4jLinkBean.attributes['render']}"
+ rendered="#{a4jLinkBean.attributes['rendered']}"
+ style="#{a4jLinkBean.attributes['style']}"
+ styleClass="#{a4jLinkBean.attributes['styleClass']}"
+ value="#{a4jLinkBean.attributes['value']}"
+ execute="@form" />
- <ui:define name="component">
- <!-- <h:outputStylesheet library="css" name="a4jCommandLink.css" target="head"/> -->
+ </h:panelGrid>
- <h:panelGrid id="panel" columns="2">
- <h:inputText id="input" value="#{a4jLinkBean.input}" />
+ <h:panelGrid id="outputs" columns="2">
+ output: <h:outputText value="#{a4jLinkBean.input}" id="output1" />
+ action: <h:outputText value="#{a4jLinkBean.input2}" id="output2" />
+ action listener:<h:outputText value="#{a4jLinkBean.input3}" id="output3" />
+ </h:panelGrid>
+ </ui:define>
- <a4j:commandLink id="a4jCommandLink" accesskey="#{a4jLinkBean.attributes['accesskey']}"
- action="#{a4jLinkBean.attributes.action}" actionListener="#{a4jLinkBean.attributes.actionListener}"
- charset="#{a4jLinkBean.attributes['charset']}" coords="#{a4jLinkBean.attributes['coords']}"
- dir="#{a4jLinkBean.attributes['dir']}" disabled="#{a4jLinkBean.attributes['disabled']}"
- hreflang="#{a4jLinkBean.attributes['hreflang']}" immediate="#{a4jLinkBean.attributes['immediate']}"
- lang="#{a4jLinkBean.attributes['lang']}" onblur="#{a4jLinkBean.attributes['onblur']}"
- onclick="#{a4jLinkBean.attributes['onclick']}" ondblclick="#{a4jLinkBean.attributes['ondblclick']}"
- onfocus="#{a4jLinkBean.attributes['onfocus']}" onkeydown="#{a4jLinkBean.attributes['onkeydown']}"
- onkeypress="#{a4jLinkBean.attributes['onkeypress']}" onkeyup="#{a4jLinkBean.attributes['onkeyup']}"
- onmousedown="#{a4jLinkBean.attributes['onmousedown']}"
- onmousemove="#{a4jLinkBean.attributes['onmousemove']}"
- onmouseout="#{a4jLinkBean.attributes['onmouseout']}"
- onmouseover="#{a4jLinkBean.attributes['onmouseover']}"
- onmouseup="#{a4jLinkBean.attributes['onmouseup']}" rel="#{a4jLinkBean.attributes['rel']}"
- render="#{a4jLinkBean.attributes['render']}" rendered="#{a4jLinkBean.attributes['rendered']}"
- rev="#{a4jLinkBean.attributes['rev']}" shape="#{a4jLinkBean.attributes['shape']}"
- style="#{a4jLinkBean.attributes['style']}" styleClass="#{a4jLinkBean.attributes['styleClass']}"
- tabindex="#{a4jLinkBean.attributes['tabindex']}" target="#{a4jLinkBean.attributes['target']}"
- title="#{a4jLinkBean.attributes['title']}" type="#{a4jLinkBean.attributes['type']}"
- value="#{a4jLinkBean.attributes['value']}" execute="@form" />
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jLinkBean.attributes}" id="attributes" render="panel"/>
+ </ui:define>
- </h:panelGrid>
-
- <h:panelGrid id="outputs" columns="2">
- output: <h:outputText value="#{a4jLinkBean.input}" id="output1" />
- action: <h:outputText value="#{a4jLinkBean.input2}" id="output2" />
- action listener:<h:outputText value="#{a4jLinkBean.input3}" id="output3" />
- </h:panelGrid>
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- <h:panelGrid id="attributes" columns="4" styleClass="attributes" columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
- <c:forEach items="#{a4jLinkBean.attributes}" var="entry">
-
- <h:panelGroup layout="block">
- <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" />
- <h:graphicImage value="/resources/images/help.png"
- title="#{a4jLinkBean.attributes.getHelp(entry.key)}"
- rendered="#{a4jLinkBean.attributes.getHelp(entry.key) != null}" height="28px;"
- style="vertical-align: middle;" />
- </h:panelGroup>
-
- <c:choose>
- <c:when test="#{a4jLinkBean.attributes.isBoolean(entry.key)}">
- <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}">
- <a4j:ajax event="change" render="panel" />
- </h:selectBooleanCheckbox>
- </c:when>
-
- <c:when test="#{a4jLinkBean.attributes.hasSelectOptions(entry.key)}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}"
- layout="pageDirection">
- <f:selectItems value="#{a4jLinkBean.attributes.getSelectOptions(entry.key)}" />
- <a4j:ajax event="change" render="panel" />
- </h:selectOneRadio>
- </c:when>
-
- <c:otherwise>
- <h:inputText id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}" style="width: 200px;">
- <a4j:ajax event="blur" render="panel" />
- </h:inputText>
- </c:otherwise>
- </c:choose>
-
- </c:forEach>
- </h:panelGrid>
- </ui:define>
-
-</ui:composition>
+ </ui:composition>
</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/commandButton/list.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/commandButton/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/commandButton/list.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,18 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+ <h:head>
+ <title>JSF Command Button</title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+ </h:head>
+
+ <h:body>
+
+ <h3><h:outputLink value="simple.xhtml">Simple</h:outputLink></h3>
+ <div>Simple page that contains standard JSF command button and input boxes for all its attributes.</div>
+
+ </h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/components/commandButton/simple.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,61 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:ta="http://java.sun.com/jsf/composite/testapp">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="template" value="#{templateBean.templateId}">
+ <f:converter converterId="templateNameConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="commandButton.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <h:panelGrid id="panel" columns="2">
+ <h:inputText id="input" value="#{buttonBean.input}" />
+
+ <h:commandButton id="commandButton"
+ action="#{buttonBean.attributes.action}"
+ actionListener="#{buttonBean.attributes.actionListener}"
+ disabled="#{buttonBean.attributes['disabled']}"
+ immediate="#{buttonBean.attributes['immediate']}"
+ onclick="#{buttonBean.attributes['onclick']}"
+ ondblclick="#{buttonBean.attributes['ondblclick']}"
+ onkeydown="#{buttonBean.attributes['onkeydown']}"
+ onkeypress="#{buttonBean.attributes['onkeypress']}"
+ onkeyup="#{buttonBean.attributes['onkeyup']}"
+ onmousedown="#{buttonBean.attributes['onmousedown']}"
+ onmousemove="#{buttonBean.attributes['onmousemove']}"
+ onmouseout="#{buttonBean.attributes['onmouseout']}"
+ onmouseover="#{buttonBean.attributes['onmouseover']}"
+ onmouseup="#{buttonBean.attributes['onmouseup']}"
+ render="#{buttonBean.attributes['render']}"
+ rendered="#{buttonBean.attributes['rendered']}"
+ style="#{buttonBean.attributes['style']}"
+ styleClass="#{buttonBean.attributes['styleClass']}"
+ value="#{buttonBean.attributes['value']}"
+ execute="@form" />
+ </h:panelGrid>
+
+ <h:panelGrid id="outputs" columns="2">
+ output: <h:outputText value="#{buttonBean.input}" id="output1" />
+ action: <h:outputText value="#{buttonBean.input2}" id="output2" />
+ action listener:<h:outputText value="#{buttonBean.input3}" id="output3" />
+ </h:panelGrid>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{buttonBean.attributes}" id="attributes" render="panel"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandButton.css
===================================================================
Modified: root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandLink.css
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandLink.css 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/resources/css/a4jCommandLink.css 2010-07-10 18:15:26 UTC (rev 17820)
@@ -1,7 +0,0 @@
-.red {
- color: red;
-}
-
-.big {
- font-size: xx-large;
-}
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/resources/css/commandButton.css
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/css/commandButton.css (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/resources/css/commandButton.css 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,16 @@
+.red {
+ color: red;
+}
+
+.blue {
+ color: blue;
+}
+
+.big {
+ height: 40px;
+ width: 200px;
+}
+
+.wide {
+ width: 200px;
+}
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/resources/css/common.css
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/css/common.css 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/resources/css/common.css 2010-07-10 18:15:26 UTC (rev 17820)
@@ -2,3 +2,17 @@
width: 100px;
height: 21px;
}
+
+.header .external-table {
+ border-width: 0px;
+ border-collapse: collapse;
+ padding-bottom: 30px;
+}
+
+.header-column {
+ border-width: 1px;
+ padding: 5px;
+ border-style: dotted;
+ border-color: grey;
+}
+
Added: root/tests/metamer/trunk/src/main/webapp/resources/css/list.css
===================================================================
Modified: root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -1,54 +1,56 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core"
- xmlns:composite="http://java.sun.com/jsf/composite">
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:composite="http://java.sun.com/jsf/composite">
-<h:body>
- <composite:interface>
- <composite:attribute name="id" type="java.util.String" />
- <composite:attribute name="value" type="org.richfaces.testapp.Attributes" required="true"
- shortDescription="Representation of attributes of a component." />
- <composite:attribute name="render" />
- <composite:attribute name="columns" default="2" type="int" shortDescription="some description for columns" />
- </composite:interface>
+ <h:body>
+ <composite:interface>
+ <composite:attribute name="id" type="java.util.String" />
+ <composite:attribute name="value" type="org.richfaces.testapp.Attributes" required="true"
+ shortDescription="Representation of attributes of a component." />
+ <composite:attribute name="render" />
+ <composite:attribute name="columns" default="2" type="int" shortDescription="some description for columns" />
+ </composite:interface>
- <composite:implementation>
- <h:panelGrid id="#{cc.attrs.id}" columns="#{cc.attrs.columns * 2}" styleClass="attributes"
- columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
- <c:forEach items="#{cc.attrs.value}" var="entry">
+ <composite:implementation>
- <h:panelGroup layout="block">
- <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" />
- <h:graphicImage value="/resources/images/help.png" title="#{cc.attrs.value.getHelp(entry.key)}"
- rendered="#{cc.attrs.value.getHelp(entry.key) != null}" height="28px;"
- style="vertical-align: middle;" styleClass="attribute-help" />
- </h:panelGroup>
+ <h:outputStylesheet library="testapp/css" name="attributes.css" />
- <c:choose>
- <c:when test="#{cc.attrs.value.isBoolean(entry.key)}">
- <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}">
- <a4j:ajax event="change" render="#{cc.attrs.render}" />
- </h:selectBooleanCheckbox>
- </c:when>
+ <h:panelGrid id="#{cc.attrs.id}" columns="#{cc.attrs.columns * 2}" styleClass="attributes"
+ columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
+ <c:forEach items="#{cc.attrs.value}" var="entry">
- <c:when test="#{cc.attrs.value.hasSelectOptions(entry.key)}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}"
- layout="pageDirection">
- <f:selectItems value="#{cc.attrs.value.getSelectOptions(entry.key)}" />
- <a4j:ajax event="change" render="#{cc.attrs.render}" />
- </h:selectOneRadio>
- </c:when>
+ <h:panelGroup layout="block">
+ <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" />
+ <h:graphicImage value="/resources/images/help.png" title="#{cc.attrs.value.getHelp(entry.key)}"
+ rendered="#{cc.attrs.value.getHelp(entry.key) != null}" height="28px;"
+ style="vertical-align: middle;" styleClass="attribute-help" />
+ </h:panelGroup>
- <c:otherwise>
- <h:inputText id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" style="width: 200px;">
- <a4j:ajax event="blur" render="#{cc.attrs.render}" />
- </h:inputText>
- </c:otherwise>
- </c:choose>
+ <c:choose>
+ <c:when test="#{cc.attrs.value.isBoolean(entry.key)}">
+ <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}">
+ <a4j:ajax event="change" render="#{cc.attrs.render}" />
+ </h:selectBooleanCheckbox>
+ </c:when>
- </c:forEach>
- </h:panelGrid>
- </composite:implementation>
-</h:body>
+ <c:when test="#{cc.attrs.value.hasSelectOptions(entry.key)}">
+ <h:selectOneRadio id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}"
+ layout="pageDirection">
+ <f:selectItems value="#{cc.attrs.value.getSelectOptions(entry.key)}" />
+ <a4j:ajax event="change" render="#{cc.attrs.render}" />
+ </h:selectOneRadio>
+ </c:when>
+
+ <c:otherwise>
+ <h:inputText id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" style="width: 200px;">
+ <a4j:ajax event="blur" render="#{cc.attrs.render}" />
+ </h:inputText>
+ </c:otherwise>
+ </c:choose>
+
+ </c:forEach>
+ </h:panelGrid>
+ </composite:implementation>
+ </h:body>
</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/src/main/webapp/resources/testapp/css/attributes.css
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/testapp/css/attributes.css (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/resources/testapp/css/attributes.css 2010-07-10 18:15:26 UTC (rev 17820)
@@ -0,0 +1,26 @@
+.attributes {
+ border-width: 0px;
+ border-collapse: collapse;
+}
+
+.attributes-first-column {
+ border-width: 1px;
+ padding: 10px;
+ border-style: dotted;
+ border-color: grey;
+ border-right: none;
+}
+
+.attributes-second-column {
+ border-width: 1px;
+ padding: 10px;
+ padding-left: 0px;
+ border-style: dotted;
+ border-color: grey;
+ border-left: none;
+}
+
+.attributes-second-column table input {
+ margin-left: 0px;
+}
+
Modified: root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -5,7 +5,7 @@
<ui:composition>
- <div style="border: 3px blue dotted; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ <div style="border: 2px blue dotted; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
src="#{templateBean.nextTemplate}.xhtml" /></div>
</ui:composition>
Modified: root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -1,70 +1,70 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich"
- xmlns:c="http://java.sun.com/jsp/jstl/core">
+ xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
- <h:form id="headerForm" style="padding-bottom: 30px;" prependId="false">
- <h:panelGrid columns="6" border="1">
+ <h:panelGrid id="headerTable" columns="6" border="1" styleClass="external-table" columnClasses="header-column, header-column, header-column, header-column, header-column, header-column">
- <h:panelGrid columns="1">
- <h:commandLink id="goHomeLink" action="/index?faces-redirect=true" value="Home" />
- <a4j:commandLink render="commonGrid" value="Rerender all" id="reRenderAllLink" />
- </h:panelGrid>
+ <h:panelGrid columns="1">
+ <h:commandLink id="goHomeLink" action="/index?faces-redirect=true" value="Home" />
+ <a4j:commandLink render="commonGrid" value="Rerender all" id="reRenderAllLink" />
+ </h:panelGrid>
- <h:panelGrid columns="2" style="width: 180px;">
- <h:outputLabel id="a4jLogLabel" for="a4jLogCheckbox" value="a4j:log" />
- <h:selectBooleanCheckbox id="a4jLogCheckbox" value="#{richBean.log}">
- <a4j:ajax event="change" execute="@this" render="a4jLogPanel" />
- </h:selectBooleanCheckbox>
- <h:outputLabel id="a4jStatusLabel" for="a4jStatus" value="a4j:status" />
- <a4j:status id="a4jStatus">
- <f:facet name="start">
- <h:outputText value="WORKING" style="color: red;" />
- </f:facet>
- </a4j:status>
- </h:panelGrid>
+ <h:panelGrid columns="2" width="180px">
+ <h:outputLabel id="a4jLogLabel" for="a4jLogCheckbox" value="Display log" />
+ <h:selectBooleanCheckbox id="a4jLogCheckbox" value="#{richBean.log}">
+ <a4j:ajax event="change" execute="@this" render="a4jLogPanel" />
+ </h:selectBooleanCheckbox>
- <h:panelGrid columns="2">
- <h:outputLabel id="reTestsCheckboxLabel" value="Display tests" for="reTestsCheckbox" />
- <h:selectBooleanCheckbox id="reTestsCheckbox" value="#{richBean.reTests}" onchange="submit();"
- disabled="true" />
+ <h:outputLabel id="a4jStatusLabel" for="a4jStatus" value="Status" />
+ <a4j:status id="a4jStatus">
+ <f:facet name="start">
+ <h:outputText value="WORKING" style="color: red;" />
+ </f:facet>
+ </a4j:status>
+ </h:panelGrid>
- <h:outputLabel id="reComponentCheckboxLabel" value="Display component" for="reComponentCheckbox" />
- <h:selectBooleanCheckbox id="reComponentCheckbox" value="#{richBean.reComponent}" onchange="submit();" />
- </h:panelGrid>
+ <h:panelGrid columns="2">
+ <h:outputLabel id="reTestsCheckboxLabel" value="Display tests" for="reTestsCheckbox" />
+ <h:selectBooleanCheckbox id="reTestsCheckbox" value="#{richBean.reTests}" onchange="submit();"
+ disabled="true" />
- <h:panelGrid columns="1">
- <h:outputLabel id="skinSelectLabel" value="Select skin: " for="skinSelect" />
+ <h:outputLabel id="reComponentCheckboxLabel" value="Display component" for="reComponentCheckbox" />
+ <h:selectBooleanCheckbox id="reComponentCheckbox" value="#{richBean.reComponent}" onchange="submit();" />
+ </h:panelGrid>
- <h:selectOneMenu id="skinSelect" value="#{richBean.skin}" style="width: 130px;">
- <f:selectItems value="#{richBean.skins}" />
- </h:selectOneMenu>
+ <h:panelGrid columns="1">
+ <h:outputLabel id="skinSelectLabel" value="Select skin: " for="skinSelect" />
- <h:selectOneMenu id="skinningSelect" value="#{richBean.skinning}" style="width: 130px;">
- <f:selectItems value="#{richBean.skinningList}" />
- </h:selectOneMenu>
- </h:panelGrid>
+ <h:selectOneMenu id="skinSelect" value="#{richBean.skin}" style="width: 130px;">
+ <f:selectItems value="#{richBean.skins}" />
+ </h:selectOneMenu>
- <h:panelGrid id="templatesSelector" columns="1">
- <h:outputText id="templateSelectMenuLabel" value="Template:" />
+ <h:selectOneMenu id="skinningSelect" value="#{richBean.skinning}" style="width: 130px;">
+ <f:selectItems value="#{richBean.skinningList}" />
+ </h:selectOneMenu>
+ </h:panelGrid>
- <ui:repeat var="var" value="#{templateBean.templates}" varStatus="status">
- <h:selectOneMenu value="#{templateBean.templates[status.index]}" id="templateSelect"
- style="width: 150px;">
- <f:selectItems value="#{templateBean.availableTemplates}" />
- <f:converter converterId="templateNameConverter" />
- <a4j:ajax event="change" render="headerForm" />
- </h:selectOneMenu>
- <br />
- </ui:repeat>
+ <h:panelGrid id="templatesSelector" columns="1">
+ <h:outputText id="templateSelectMenuLabel" value="Template:" />
- <h:commandLink id="loadTemplate" value="Load" render="commonGrid" />
+ <ui:repeat var="var" value="#{templateBean.templates}" varStatus="status">
+ <h:selectOneMenu value="#{templateBean.templates[status.index]}" id="templateSelect"
+ style="width: 150px;">
+ <f:selectItems value="#{templateBean.availableTemplates}" />
+ <f:converter converterId="templateNameConverter" />
+ <a4j:ajax event="change" render="headerTable" />
+ </h:selectOneMenu>
+ <br />
+ </ui:repeat>
- </h:panelGrid>
+ <h:commandLink id="loadTemplate" value="Load" render="commonGrid" />
- <h:panelGrid columns="1">
- <h:commandButton action="#{richBean.invalidateSession}" value="Invalidate Session" />
- </h:panelGrid>
</h:panelGrid>
- </h:form>
+
+ <h:panelGrid columns="1">
+ <h:commandButton action="#{richBean.invalidateSession}" value="Invalidate Session" />
+ </h:panelGrid>
+ </h:panelGrid>
+
</ui:composition>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -5,7 +5,7 @@
<ui:composition>
- <div style="border: 3px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ <div style="border: 2px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
src="#{templateBean.nextTemplate}.xhtml" /></div>
</ui:composition>
Modified: root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
+++ root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:15:26 UTC (rev 17820)
@@ -1,44 +1,40 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://java.sun.com/jsf/composite/rich">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
-<h:head>
- <title><ui:insert name="pageTitle">Testing Application</ui:insert></title>
- <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
-<!-- <h:outputStylesheet library="css" name="common.css" />-->
- <ui:insert name="viewParams"/>
- <ui:insert name="head"/>
-</h:head>
+ <h:head>
+ <title><ui:insert name="pageTitle">Testing Application</ui:insert></title>
+ <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
+ <h:outputStylesheet library="css" name="common.css" />
+ <ui:insert name="head"/>
+ </h:head>
-<h:body>
+ <h:body>
+ <h:form id="form">
+ <div class="header"><ui:include src="/templates/header.xhtml" /></div>
- <div class="header"><ui:include src="/templates/header.xhtml" /></div>
+ <div class="content">
+ <div class="messages"><h:messages /></div>
- <div class="content">
- <div class="messages"><rich:messages /></div>
+ <h:panelGroup id="commonGrid" layout="block" rendered="#{richBean.reComponent}">
+ <div>
+ <div style="margin-bottom: 20px;"><ui:insert name="outOfTemplateBefore" /></div>
+ <ui:include src="/templates/#{templateBean.firstTemplate}.xhtml" />
+ <div style="margin-top: 20px;"><ui:insert name="outOfTemplateAfter" /></div>
+ </div>
+ </h:panelGroup> <br />
- <h:panelGroup id="commonGrid" layout="block" rendered="#{richBean.reComponent}">
- <div><b>Status: </b> <input style="border: 0px; color: black; width: 700px" readonly="true"
- id="statusMessage" /></div>
- <br />
- <div><h:form id="componentForm">
- <div style="margin-bottom: 20px;"><ui:insert name="outOfTemplateBefore" /></div>
- <ui:include src="/templates/#{templateBean.firstTemplate}.xhtml" />
- <div style="margin-top: 20px;"><ui:insert name="outOfTemplateAfter" /></div>
- </h:form></div>
- </h:panelGroup> <br />
+ </div>
- </div>
+ <h:panelGroup id="a4jLogPanel" layout="block">
+ <a4j:log id="a4jLog" height="300px" rendered="#{richBean.log}" />
+ </h:panelGroup>
- <h:panelGroup id="a4jLogPanel" layout="block">
- <a4j:log id="a4jLog" height="300px" rendered="#{richBean.log}" />
- </h:panelGroup>
+ <div id="footer"><ui:insert name="footer">
+ <hr />
+ RichFaces #{a4j.version}
+ </ui:insert></div>
- <div id="footer"><ui:insert name="footer">
- <hr />
- RichFaces #{a4j.version}
- </ui:insert></div>
-</h:body>
-
+ </h:form>
+ </h:body>
</html>
14 years, 6 months
JBoss Rich Faces SVN: r17819 - in root/tests/metamer/trunk/src/main/webapp/resources: testapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:13:32 -0400 (Sat, 10 Jul 2010)
New Revision: 17819
Added:
root/tests/metamer/trunk/src/main/webapp/resources/testapp/
root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-466
* created composite component for attributes, cannot be used for now because of a bug in JBoss
Added: root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/resources/testapp/attributes.xhtml 2010-07-10 18:13:32 UTC (rev 17819)
@@ -0,0 +1,54 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:composite="http://java.sun.com/jsf/composite">
+
+<h:body>
+ <composite:interface>
+ <composite:attribute name="id" type="java.util.String" />
+ <composite:attribute name="value" type="org.richfaces.testapp.Attributes" required="true"
+ shortDescription="Representation of attributes of a component." />
+ <composite:attribute name="render" />
+ <composite:attribute name="columns" default="2" type="int" shortDescription="some description for columns" />
+ </composite:interface>
+
+ <composite:implementation>
+ <h:panelGrid id="#{cc.attrs.id}" columns="#{cc.attrs.columns * 2}" styleClass="attributes"
+ columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
+ <c:forEach items="#{cc.attrs.value}" var="entry">
+
+ <h:panelGroup layout="block">
+ <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" />
+ <h:graphicImage value="/resources/images/help.png" title="#{cc.attrs.value.getHelp(entry.key)}"
+ rendered="#{cc.attrs.value.getHelp(entry.key) != null}" height="28px;"
+ style="vertical-align: middle;" styleClass="attribute-help" />
+ </h:panelGroup>
+
+ <c:choose>
+ <c:when test="#{cc.attrs.value.isBoolean(entry.key)}">
+ <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}">
+ <a4j:ajax event="change" render="#{cc.attrs.render}" />
+ </h:selectBooleanCheckbox>
+ </c:when>
+
+ <c:when test="#{cc.attrs.value.hasSelectOptions(entry.key)}">
+ <h:selectOneRadio id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}"
+ layout="pageDirection">
+ <f:selectItems value="#{cc.attrs.value.getSelectOptions(entry.key)}" />
+ <a4j:ajax event="change" render="#{cc.attrs.render}" />
+ </h:selectOneRadio>
+ </c:when>
+
+ <c:otherwise>
+ <h:inputText id="#{entry.key}Input" value="#{cc.attrs.value[entry.key]}" style="width: 200px;">
+ <a4j:ajax event="blur" render="#{cc.attrs.render}" />
+ </h:inputText>
+ </c:otherwise>
+ </c:choose>
+
+ </c:forEach>
+ </h:panelGrid>
+ </composite:implementation>
+</h:body>
+</html>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17818 - in root/tests/metamer/trunk/src/main: java/org/richfaces/testapp/bean and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:12:55 -0400 (Sat, 10 Jul 2010)
New Revision: 17818
Modified:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-466
* list of attributes refactored - shows checkboxes, radio buttons and input boxes
* table with attributes styled
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:11:56 UTC (rev 17817)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Attributes.java 2010-07-10 18:12:55 UTC (rev 17818)
@@ -25,21 +25,27 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.el.ELContext;
import javax.el.MethodExpression;
+import javax.faces.bean.ManagedBean;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
import org.jboss.el.ExpressionFactoryImpl;
import org.slf4j.Logger;
@@ -54,9 +60,16 @@
public class Attributes implements Map<String, Object> {
private Logger logger;
+ // K - name of a component attribute, V - value of the component attribute
private Map<String, Object> attributes;
+ // K - name of a component attribute, V - type of the component attribute
+ private Map<String, Class<?>> attributesTypes;
+ // K - name of a component attribute, V - help for the component attribute
private Map<String, String> helpMap;
- private Set<String> excludeSet;
+ // K - name of a component attribute, V - select items used on page to select value for the attribute
+ private Map<String, List<SelectItem>> attributesSelectOptions;
+ // class object of managed bean
+ private Class<?> beanClass;
/**
* Constructor for class Attributes.
@@ -70,6 +83,8 @@
logger = LoggerFactory.getLogger(Attributes.class);
logger.info("creating attributes map for " + componentClass);
+ this.beanClass = beanClass;
+
PropertyDescriptor[] descriptors = null;
try {
descriptors = Introspector.getBeanInfo(componentClass).getPropertyDescriptors();
@@ -80,28 +95,30 @@
}
attributes = new TreeMap<String, Object>();
+ attributesTypes = new TreeMap<String, Class<?>>();
// not all attributes of given class are needed
- excludeSet = getExcludeSet();
+ Set<String> excludeSet = getExcludeSet();
+ // create list of all attributes and their types
for (PropertyDescriptor descriptor : descriptors) {
if (!excludeSet.contains(descriptor.getName())) {
attributes.put(descriptor.getName(), null);
+ attributesTypes.put(descriptor.getName(), descriptor.getPropertyType());
}
}
logger.info(attributes.keySet().toString());
- helpMap = loadHelp(beanClass);
+ helpMap = loadHelp();
+ attributesSelectOptions = loadSelectOptions();
}
/**
- * Loads help for given managed bean.
+ * Loads help.
*
- * @param beanClass
- * class object of a managed bean
* @return map where key is attribute's name and value is help for this attribute
*/
- private Map<String, String> loadHelp(Class<?> beanClass) {
+ private Map<String, String> loadHelp() {
ResourceBundle rb = ResourceBundle.getBundle(beanClass.getName());
Enumeration<String> keys = rb.getKeys();
String key = null;
@@ -109,8 +126,8 @@
while (keys.hasMoreElements()) {
key = keys.nextElement();
- if (key.startsWith("help.")) {
- result.put(key.replaceFirst("help.", ""), rb.getString(key));
+ if (key.startsWith("testapp.help.")) {
+ result.put(key.replaceFirst("testapp.help.", ""), rb.getString(key));
}
}
@@ -118,6 +135,41 @@
}
/**
+ * Loads select options used on the page for selecting attribute value.
+ *
+ * @return map where key is attribute's name and value is list of select items usable to select attribute value
+ */
+ private Map<String, List<SelectItem>> loadSelectOptions() {
+ ResourceBundle rb = ResourceBundle.getBundle(beanClass.getName());
+ Enumeration<String> keys = rb.getKeys();
+ String key = null;
+ Map<String, List<SelectItem>> result = new HashMap<String, List<SelectItem>>();
+
+ // e.g. attr.action.toUpperCaseAction
+ Pattern pattern = Pattern.compile("(.*)\\.(.*)\\.(.*)");
+ Matcher matcher = null;
+ SelectItem item = null;
+
+ while (keys.hasMoreElements()) {
+ key = keys.nextElement();
+ if (key.startsWith("attr.")) {
+ matcher = pattern.matcher(key);
+ matcher.find();
+
+ if (result.get(matcher.group(2)) == null) {
+ result.put(matcher.group(2), new ArrayList<SelectItem>());
+ }
+
+ item = new SelectItem(rb.getString(key), matcher.group(3));
+ result.get(matcher.group(2)).add(item);
+
+ }
+ }
+
+ return result;
+ }
+
+ /**
* {@inheritDoc}
*/
public void clear() {
@@ -208,10 +260,6 @@
* @return set containing all attributes of a JSF component that cannot/shouldn't be set on page.
*/
private Set<String> getExcludeSet() {
- if (excludeSet != null) {
- return excludeSet;
- }
-
Set<String> set = new HashSet<String>();
set.add("attributes");
@@ -259,7 +307,7 @@
* @return description of an attribute
*/
public String getHelp(String attribute) {
- String help = helpMap.get(attribute);
+ String help = helpMap.get(attribute);
return help;
}
@@ -279,6 +327,14 @@
}
/**
+ * {@inheritDoc}
+ */
+ public Object putAttributeClass(String key, Class<?> value) {
+
+ return attributesTypes.put(key, value);
+ }
+
+ /**
* An action for tested JSF component. Can be modified dynamically.
*
* @return outcome of an action or null if no navigation should be performed
@@ -288,12 +344,21 @@
MethodExpression method = null;
String outcome = (String) attributes.get("action");
- if (isStringEL(outcome)) {
+ // if no select options for "action" are defined in property file and it is an EL expression
+ if (!hasSelectOptions("action") && isStringEL(outcome)) {
method = new ExpressionFactoryImpl().createMethodExpression(elContext, outcome, String.class, new Class[0]);
return (String) method.invoke(elContext, null);
- } else {
- return outcome;
}
+
+ // if select options for "action" are defined in property file
+ if (hasSelectOptions("action")) {
+ method = new ExpressionFactoryImpl().createMethodExpression(elContext, getMethodEL(outcome), String.class,
+ new Class[0]);
+ return (String) method.invoke(elContext, null);
+ }
+
+ return outcome;
+
}
/**
@@ -307,10 +372,78 @@
MethodExpression method = null;
String listener = (String) attributes.get("actionListener");
- if (isStringEL(listener)) {
+ // if no select options for "actionListener" are defined in property file and it is an EL expression
+ if (!hasSelectOptions("actionListener") && isStringEL(listener)) {
method = new ExpressionFactoryImpl().createMethodExpression(elContext, listener, void.class,
new Class[] { ActionEvent.class });
method.invoke(elContext, new Object[] { event });
}
+
+ // if select options for "actionListener" are defined in property file
+ if (hasSelectOptions("actionListener")) {
+ method = new ExpressionFactoryImpl().createMethodExpression(elContext, getMethodEL(listener), void.class,
+ new Class[] { ActionEvent.class });
+ method.invoke(elContext, new Object[] { event });
+ }
}
+
+ /**
+ * Method used for creating EL expressions for methods.
+ *
+ * @param methodName
+ * name of the action or action listener, e.g. toUpperCaseAction
+ * @return string containing an expression for an action or action listener, e.g. #{bean.toUpperCaseAction}
+ */
+ private String getMethodEL(String methodName) {
+ // get name of the managed bean
+ String el = beanClass.getAnnotation(ManagedBean.class).name();
+
+ if ("".equals(el)) {
+ // create name of a managed bean according to standard, i.e. MyBean -> myBean
+ el = beanClass.getSimpleName().substring(0, 1).toLowerCase() + beanClass.getSimpleName().substring(1);
+ }
+
+ StringBuilder methodEL = new StringBuilder("#{");
+ methodEL.append(el);
+ methodEL.append(".");
+ methodEL.append(methodName);
+ methodEL.append("}");
+
+ return methodEL.toString();
+ }
+
+ /**
+ * Decides whether given attribute is a boolean. If true, an checkbox should be rendered on a page.
+ *
+ * @param attributeName
+ * name of a component attribute
+ * @return true if attribute is of type boolean, otherwise false
+ */
+ public boolean isBoolean(String attributeName) {
+ Class<?> clazz = attributesTypes.get(attributeName);
+ return (clazz == boolean.class || clazz == Boolean.class);
+ }
+
+ /**
+ * Decides if there are any select options for given attribute. If true, radio buttons should be rendered on a page.
+ *
+ * @param attributeName
+ * name of a component attribute
+ * @return true if select options were defined, false otherwise
+ */
+ public boolean hasSelectOptions(String attributeName) {
+ return attributesSelectOptions.containsKey(attributeName);
+ }
+
+ /**
+ * Getter for select options of given attribute.
+ *
+ * @param attributeName
+ * name of a component attribute
+ * @return list of select items for given attribute
+ */
+ public List<SelectItem> getSelectOptions(String attributeName) {
+ return attributesSelectOptions.get(attributeName);
+ }
+
}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:11:56 UTC (rev 17817)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/A4JCommandLinkBean.java 2010-07-10 18:12:55 UTC (rev 17818)
@@ -65,8 +65,9 @@
attributes.put("value", "command link");
attributes.put("rendered", "true");
attributes.put("disabled", "false");
- attributes.put("action", "#{a4jLinkBean.first6CharsAction}");
- attributes.put("actionListener", "#{a4jLinkBean.toUpperCaseActionListener}");
+ attributes.putAttributeClass("disabled", Boolean.class);
+ attributes.put("action", "first6CharsAction");
+ attributes.put("actionListener", "toUpperCaseActionListener");
attributes.put("render", "output1 output2 output3");
}
Modified: root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties
===================================================================
--- root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties 2010-07-10 18:11:56 UTC (rev 17817)
+++ root/tests/metamer/trunk/src/main/resources/org/richfaces/testapp/bean/A4JCommandLinkBean.properties 2010-07-10 18:12:55 UTC (rev 17818)
@@ -1,4 +1,10 @@
-help.rendered=true or false
-help.disabled=true or false
-help.action=#{a4jLinkBean.first6CharsAction} #{a4jLinkBean.doubleStringAction} #{a4jLinkBean.toUpperCaseAction}
-help.actionListener=#{a4jLinkBean.first6CharsActionListener} #{a4jLinkBean.doubleStringActionListener} #{a4jLinkBean.toUpperCaseActionListener}
+#testapp.help.action=#{a4jLinkBean.first6CharsAction} #{a4jLinkBean.doubleStringAction} #{a4jLinkBean.toUpperCaseAction}
+#testapp.help.actionListener=#{a4jLinkBean.first6CharsActionListener} #{a4jLinkBean.doubleStringActionListener} #{a4jLinkBean.toUpperCaseActionListener}
+
+attr.action.first6CharsAction=first6CharsAction
+attr.action.doubleStringAction=doubleStringAction
+attr.action.toUpperCaseAction=toUpperCaseAction
+
+attr.actionListener.first6CharsActionListener=first6CharsActionListener
+attr.actionListener.doubleStringActionListener=doubleStringActionListener
+attr.actionListener.toUpperCaseActionListener=toUpperCaseActionListener
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:12:55 UTC (rev 17818)
@@ -5,6 +5,36 @@
<ui:composition template="/templates/template.xhtml">
+ <ui:define name="head">
+ <style>
+table.attributes {
+ border-width: 0px;
+ border-collapse: collapse;
+}
+
+.attributes-first-column {
+ border-width: 1px;
+ padding: 10px;
+ border-style: dotted;
+ border-color: blue;
+ border-right: none;
+}
+
+.attributes-second-column {
+ border-width: 1px;
+ padding: 10px;
+ padding-left: 0px;
+ border-style: dotted;
+ border-color: blue;
+ border-left: none;
+}
+
+.attributes-second-column table input {
+ margin-left: 0px;
+}
+</style>
+ </ui:define>
+
<ui:define name="viewParams">
<f:metadata>
<f:viewParam name="template" value="#{templateBean.templateId}">
@@ -53,19 +83,39 @@
</ui:define>
<ui:define name="outOfTemplateAfter">
- <h:panelGrid id="attributes" columns="4" style="">
+ <h:panelGrid id="attributes" columns="4" styleClass="attributes" columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
<c:forEach items="#{a4jLinkBean.attributes}" var="entry">
- <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" />
<h:panelGroup layout="block">
- <h:inputText id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}">
- <a4j:ajax event="blur" render="panel" />
- </h:inputText>
+ <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" />
<h:graphicImage value="/resources/images/help.png"
title="#{a4jLinkBean.attributes.getHelp(entry.key)}"
rendered="#{a4jLinkBean.attributes.getHelp(entry.key) != null}" height="28px;"
style="vertical-align: middle;" />
</h:panelGroup>
+
+ <c:choose>
+ <c:when test="#{a4jLinkBean.attributes.isBoolean(entry.key)}">
+ <h:selectBooleanCheckbox id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}">
+ <a4j:ajax event="change" render="panel" />
+ </h:selectBooleanCheckbox>
+ </c:when>
+
+ <c:when test="#{a4jLinkBean.attributes.hasSelectOptions(entry.key)}">
+ <h:selectOneRadio id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}"
+ layout="pageDirection">
+ <f:selectItems value="#{a4jLinkBean.attributes.getSelectOptions(entry.key)}" />
+ <a4j:ajax event="change" render="panel" />
+ </h:selectOneRadio>
+ </c:when>
+
+ <c:otherwise>
+ <h:inputText id="#{entry.key}Input" value="#{a4jLinkBean.attributes[entry.key]}" style="width: 200px;">
+ <a4j:ajax event="blur" render="panel" />
+ </h:inputText>
+ </c:otherwise>
+ </c:choose>
+
</c:forEach>
</h:panelGrid>
</ui:define>
Modified: root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
+++ root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:12:55 UTC (rev 17818)
@@ -6,10 +6,9 @@
<h:head>
<title><ui:insert name="pageTitle">Testing Application</ui:insert></title>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
- <!-- <h:outputStylesheet library="css" name="common.css" />-->
- <ui:insert name="viewParams">
-
- </ui:insert>
+<!-- <h:outputStylesheet library="css" name="common.css" />-->
+ <ui:insert name="viewParams"/>
+ <ui:insert name="head"/>
</h:head>
<h:body>
14 years, 6 months
JBoss Rich Faces SVN: r17817 - in root/tests/metamer/trunk/src/main: java/org/richfaces/testapp/bean and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 14:11:56 -0400 (Sat, 10 Jul 2010)
New Revision: 17817
Added:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml
Removed:
root/tests/metamer/trunk/src/main/webapp/templates/reddiv.xhtml
Modified:
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java
root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/plain.xhtml
root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
Log:
https://jira.jboss.org/jira/browse/RFPL-466
* added nested templating
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/Template.java 2010-07-10 18:11:56 UTC (rev 17817)
@@ -27,7 +27,8 @@
*/
public enum Template {
PLAIN ("plain", "", "Plain"),
- RED_DIV ("reddiv", "", "Red div");
+ RED_DIV ("red_div", "", "Red div"),
+ BLUE_DIV ("blue_div", "", "Blue div");
private String name;
Added: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java (rev 0)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/TemplatesList.java 2010-07-10 18:11:56 UTC (rev 17817)
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * 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.testapp;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TemplatesList implements List<Template> {
+
+ private List<Template> templates = new ArrayList<Template>();
+ private Logger logger = LoggerFactory.getLogger(TemplatesList.class);
+
+ public boolean add(Template e) {
+ // if list is empty, add template
+ if (templates.isEmpty()) {
+ return templates.add(e);
+ }
+
+ // if last item in list is plain template, don't do anything
+ if (templates.get(size() - 1) == Template.PLAIN) {
+ return false;
+ }
+
+ return templates.add(e);
+ }
+
+ public void add(int index, Template element) {
+ templates.add(index, element);
+ // add new item to the list
+ // if the last item is being changed, nothing happens, otherwise it will be again removed
+ templates.add(Template.PLAIN);
+
+ // remove the rest of list if plain is set
+ if (element == Template.PLAIN) {
+ while (templates.size() > index + 1) {
+ templates.remove(index + 1);
+ }
+ }
+ }
+
+ public boolean addAll(Collection<? extends Template> c) {
+ return templates.addAll(c);
+ }
+
+ public boolean addAll(int index, Collection<? extends Template> c) {
+ return templates.addAll(index, c);
+ }
+
+ public void clear() {
+ templates.clear();
+ }
+
+ public boolean contains(Object o) {
+ return templates.contains(o);
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ return templates.containsAll(c);
+ }
+
+ public Template get(int index) {
+ return templates.get(index);
+ }
+
+ public int indexOf(Object o) {
+ return templates.indexOf(o);
+ }
+
+ public boolean isEmpty() {
+ return templates.isEmpty();
+ }
+
+ public Iterator<Template> iterator() {
+ return templates.iterator();
+ }
+
+ public int lastIndexOf(Object o) {
+ return templates.lastIndexOf(o);
+ }
+
+ public ListIterator<Template> listIterator() {
+ return templates.listIterator();
+ }
+
+ public ListIterator<Template> listIterator(int index) {
+ return templates.listIterator(index);
+ }
+
+ public boolean remove(Object o) {
+ return templates.remove(o);
+ }
+
+ public Template remove(int index) {
+ return templates.remove(index);
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ return templates.removeAll(c);
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ return templates.retainAll(c);
+ }
+
+ public Template set(int index, Template element) {
+ Template old = templates.set(index, element);
+
+ // remove the rest of list if plain is set
+ if (element == Template.PLAIN) {
+ while (templates.size() > index + 1) {
+ templates.remove(index + 1);
+ }
+ } else {
+ add(Template.PLAIN);
+ }
+
+ return old;
+ }
+
+ public int size() {
+ return templates.size();
+ }
+
+ public List<Template> subList(int fromIndex, int toIndex) {
+ return templates.subList(fromIndex, toIndex);
+ }
+
+ public Object[] toArray() {
+ return templates.toArray();
+ }
+
+ public <T> T[] toArray(T[] a) {
+ return templates.toArray(a);
+ }
+
+}
Modified: root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java
===================================================================
--- root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/java/org/richfaces/testapp/bean/TemplateBean.java 2010-07-10 18:11:56 UTC (rev 17817)
@@ -25,16 +25,13 @@
import java.util.ArrayList;
import java.util.List;
-import javax.el.ELException;
-import javax.el.ExpressionFactory;
-import javax.el.MethodExpression;
+import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import org.richfaces.testapp.Template;
+import org.richfaces.testapp.TemplatesList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,6 +52,8 @@
public static final String PARAM_NAME = "t";
private Template template = Template.PLAIN;
+
+ private TemplatesList templates;
private Template templatePath = Template.PLAIN;
@@ -62,10 +61,25 @@
private Integer dataTableRowIndex = 0;
+ private int templateIndex = 0;
+
+ @PostConstruct
+ public void init() {
+ templates = new TemplatesList();
+ templates.add(Template.PLAIN);
+ }
+
+ /**
+ * @return the templates
+ */
+ public List<Template> getTemplates() {
+ return templates;
+ }
+
public String getTemplateId() {
return template.toString();
}
-
+
public void setTemplateId(String template) {
this.template = Template.valueOf(template);
// if (this.template.equals(Template.DATA_TABLE)) {
@@ -150,5 +164,29 @@
public List<String> getDataTableModel() {
return dataTableModel;
}
-
+
+// public boolean isRendered(int index) {
+// if (index < 0) {
+// throw new IllegalArgumentException("Template nr. " + index + " does not exist.");
+// }
+//
+// if (index == 0) {
+// return true;
+// }
+//
+// for (int i = 1; i <= index; i++) {
+// if (templates.get(index-1) == Template.PLAIN) {
+// return false;
+// }
+// }
+// }
+
+ public String getFirstTemplate() {
+ templateIndex = 0;
+ return templates.get(0).toString().toLowerCase();
+ }
+
+ public String getNextTemplate() {
+ return templates.get(++templateIndex).toString().toLowerCase();
+ }
}
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/webapp/components/a4jCommandLink/simple.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -3,7 +3,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://java.sun.com/jsf/composite/rich"
xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core">
-<ui:composition template="#{templateBean.template}">
+<ui:composition template="/templates/template.xhtml">
<ui:define name="viewParams">
<f:metadata>
Copied: root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml (from rev 17816, root/tests/metamer/trunk/src/main/webapp/templates/plain.xhtml)
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/blue_div.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -0,0 +1,12 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+
+ <div style="border: 3px blue dotted; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ src="#{templateBean.nextTemplate}.xhtml" /></div>
+
+</ui:composition>
+</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/webapp/templates/header.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -1,10 +1,16 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich">
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://java.sun.com/jsf/composite/rich"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:form id="headerForm" style="padding-bottom: 30px;" prependId="false">
<h:panelGrid columns="6" border="1">
+ <h:panelGrid columns="1">
+ <h:commandLink id="goHomeLink" action="/index?faces-redirect=true" value="Home" />
+ <a4j:commandLink render="commonGrid" value="Rerender all" id="reRenderAllLink" />
+ </h:panelGrid>
+
<h:panelGrid columns="2" style="width: 180px;">
<h:outputLabel id="a4jLogLabel" for="a4jLogCheckbox" value="a4j:log" />
<h:selectBooleanCheckbox id="a4jLogCheckbox" value="#{richBean.log}">
@@ -20,7 +26,8 @@
<h:panelGrid columns="2">
<h:outputLabel id="reTestsCheckboxLabel" value="Display tests" for="reTestsCheckbox" />
- <h:selectBooleanCheckbox id="reTestsCheckbox" value="#{richBean.reTests}" onchange="submit();" disabled="true"/>
+ <h:selectBooleanCheckbox id="reTestsCheckbox" value="#{richBean.reTests}" onchange="submit();"
+ disabled="true" />
<h:outputLabel id="reComponentCheckboxLabel" value="Display component" for="reComponentCheckbox" />
<h:selectBooleanCheckbox id="reComponentCheckbox" value="#{richBean.reComponent}" onchange="submit();" />
@@ -38,20 +45,21 @@
</h:selectOneMenu>
</h:panelGrid>
- <h:panelGrid columns="1">
+ <h:panelGrid id="templatesSelector" columns="1">
+ <h:outputText id="templateSelectMenuLabel" value="Template:" />
- <h:panelGroup layout="block">
- <h:outputLabel id="templateSelectMenuLabel" for="templateSelectMenu" value="Template:" />
- <h:selectOneMenu value="#{templateBean.templateId}" id="templateSelectMenu" style="width: 150px;">
+ <ui:repeat var="var" value="#{templateBean.templates}" varStatus="status">
+ <h:selectOneMenu value="#{templateBean.templates[status.index]}" id="templateSelect"
+ style="width: 150px;">
<f:selectItems value="#{templateBean.availableTemplates}" />
- <a4j:ajax event="change" action="/index" />
+ <f:converter converterId="templateNameConverter" />
+ <a4j:ajax event="change" render="headerForm" />
</h:selectOneMenu>
- <h:commandLink id="loadTemplate" value="Load" render="commonGrid" />
- </h:panelGroup>
-
- <h:commandLink id="goHomeLink" action="/index?faces-redirect=true" value="Home" />
-
- <a4j:commandLink render="commonGrid" value="Rerender all" id="reRenderAllLink" />
+ <br />
+ </ui:repeat>
+
+ <h:commandLink id="loadTemplate" value="Load" render="commonGrid" />
+
</h:panelGrid>
<h:panelGrid columns="1">
Modified: root/tests/metamer/trunk/src/main/webapp/templates/plain.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/plain.xhtml 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/webapp/templates/plain.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -3,15 +3,9 @@
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://java.sun.com/jsf/composite/rich">
-<ui:composition template="template.xhtml">
+<ui:composition>
- <ui:define name="template">
- <div style="margin-bottom: 20px;"><ui:insert name="outOfTemplateBefore" /></div>
-
- <ui:insert name="component" />
-
- <div style="margin-top: 20px;"><ui:insert name="outOfTemplateAfter" /></div>
- </ui:define>
+ <ui:insert name="component" >content of plain.xhtml</ui:insert>
</ui:composition>
</html>
\ No newline at end of file
Copied: root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml (from rev 17816, root/tests/metamer/trunk/src/main/webapp/templates/reddiv.xhtml)
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml (rev 0)
+++ root/tests/metamer/trunk/src/main/webapp/templates/red_div.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -0,0 +1,12 @@
+<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+
+ <div style="border: 3px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:include
+ src="#{templateBean.nextTemplate}.xhtml" /></div>
+
+</ui:composition>
+</html>
\ No newline at end of file
Deleted: root/tests/metamer/trunk/src/main/webapp/templates/reddiv.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/reddiv.xhtml 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/webapp/templates/reddiv.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -1,17 +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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-<ui:composition template="template.xhtml">
-
- <ui:define name="template">
- <div style="margin-bottom: 20px;"><ui:insert name="outOfTemplateBefore" /></div>
-
- <div style="border: 3px red solid; padding: 10px; margin-top: 10px; margin-bottom: 10px;"><ui:insert name="component" /></div>
-
- <div style="margin-top: 20px;"><ui:insert name="outOfTemplateAfter" /></div>
- </ui:define>
-
-</ui:composition>
-</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:10:54 UTC (rev 17816)
+++ root/tests/metamer/trunk/src/main/webapp/templates/template.xhtml 2010-07-10 18:11:56 UTC (rev 17817)
@@ -24,7 +24,9 @@
id="statusMessage" /></div>
<br />
<div><h:form id="componentForm">
- <ui:insert name="template" />
+ <div style="margin-bottom: 20px;"><ui:insert name="outOfTemplateBefore" /></div>
+ <ui:include src="/templates/#{templateBean.firstTemplate}.xhtml" />
+ <div style="margin-top: 20px;"><ui:insert name="outOfTemplateAfter" /></div>
</h:form></div>
</h:panelGroup> <br />
14 years, 6 months