Author: nbelaevski
Date: 2009-08-18 05:41:53 -0400 (Tue, 18 Aug 2009)
New Revision: 15192
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/DynamicExecuteBean.java
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/MediaOutputBean.java
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/PushBean.java
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/RequestBean.java
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/TimeBean.java
root/examples/trunk/components/core-demo/src/main/resources/org/
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces-twitter.jpg
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces.jpg
root/examples/trunk/components/core-demo/src/main/webapp/dynamicExecute.xhtml
root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml
root/examples/trunk/components/core-demo/src/main/webapp/mediaOutput.xhtml
root/examples/trunk/components/core-demo/src/main/webapp/outputPanel.xhtml
root/examples/trunk/components/core-demo/src/main/webapp/push.xhtml
Modified:
root/examples/trunk/components/core-demo/pom.xml
root/examples/trunk/components/core-demo/src/main/webapp/index.xhtml
Log:
Big A1 components check-in - examples
Modified: root/examples/trunk/components/core-demo/pom.xml
===================================================================
--- root/examples/trunk/components/core-demo/pom.xml 2009-08-18 09:40:41 UTC (rev 15191)
+++ root/examples/trunk/components/core-demo/pom.xml 2009-08-18 09:41:53 UTC (rev 15192)
@@ -17,10 +17,10 @@
<name>RichFaces core demo</name>
<dependencies>
- <!-- dependency>
+ <dependency>
<groupId>org.richfaces.ui.components</groupId>
<artifactId>${example.componentName}-ui</artifactId>
- </dependency -->
+ </dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/DynamicExecuteBean.java
===================================================================
---
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/DynamicExecuteBean.java
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/DynamicExecuteBean.java 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,86 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.model.SelectItem;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean(name = "dynamicExecuteBean")
+@SessionScoped
+public class DynamicExecuteBean {
+
+ private static final SelectItem[] POSSIBLE_EXECUTE_OPTIONS = new SelectItem[] {
+ new SelectItem(null, "default"),
+ new SelectItem("@none"),
+ new SelectItem("@this"),
+ new SelectItem("@form"),
+ new SelectItem("formId"),
+ new SelectItem("anotherFormId"),
+ new SelectItem("@all")
+ };
+
+ private int actionsCounter = 0;
+
+ private Object execute = null;
+
+ private String inputValue;
+
+ private String value;
+
+ public SelectItem[] getExecuteOptions() {
+ return POSSIBLE_EXECUTE_OPTIONS;
+ }
+
+ public Object getExecute() {
+ return execute;
+ }
+
+ public void setExecute(Object execute) {
+ this.execute = execute;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getInputValue() {
+ return inputValue;
+ }
+
+ public void setInputValue(String inputValue) {
+ this.inputValue = inputValue;
+ }
+
+ public int getActionsCounter() {
+ return actionsCounter;
+ }
+
+ public void applyValue() {
+ this.actionsCounter++;
+ this.value = this.inputValue;
+ }
+}
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/MediaOutputBean.java
===================================================================
---
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/MediaOutputBean.java
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/MediaOutputBean.java 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+
+import org.richfaces.util.Util;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@RequestScoped
+@ManagedBean(name = "mediaOutputBean")
+public class MediaOutputBean {
+
+ public void createContent(OutputStream os, Object data) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ InputStream stream = classLoader.getResourceAsStream("org/richfaces/demo/" +
data);
+ try {
+ Util.copyStreamContent(stream, os);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+}
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/PushBean.java
===================================================================
---
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/PushBean.java
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/PushBean.java 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo;
+
+import java.util.EventListener;
+import java.util.EventObject;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import org.ajax4jsf.event.PushEventListener;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean(name = "pushBean")
+@SessionScoped
+public class PushBean {
+
+ private volatile PushEventListener listener;
+
+ public void setListener(EventListener listener) {
+ this.listener = (PushEventListener) listener;
+ }
+
+ public void generateEvent() {
+ listener.onEvent(new EventObject(this));
+ }
+}
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/RequestBean.java
===================================================================
---
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/RequestBean.java
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/RequestBean.java 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,59 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean(name = "requestBean")
+@RequestScoped
+public class RequestBean {
+
+ private String idsToRender;
+
+ public String getIdsToRender() {
+ return idsToRender;
+ }
+
+ public void setIdsToRender(String idsToRender) {
+ this.idsToRender = idsToRender;
+ }
+
+ public void setupIdsToRender() {
+ this.idsToRender = FacesContext.getCurrentInstance().getExternalContext().
+ getRequestParameterMap().get("idsToRender");
+ }
+
+ public Object getItems() {
+ SelectItem[] item = new SelectItem[1000];
+ for (int i = 0; i < item.length; i++) {
+ item[i] = new SelectItem(i);
+ }
+ return item;
+ }
+}
Added:
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/TimeBean.java
===================================================================
---
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/TimeBean.java
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/java/org/richfaces/demo/TimeBean.java 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,47 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean(name = "timeBean")
+@RequestScoped()
+public class TimeBean {
+
+ private String formattedDate = null;
+
+ public String getDateString() {
+ if (formattedDate == null) {
+ formattedDate = new SimpleDateFormat("HH:mm:ss SSSS").format(new Date());
+ }
+
+ return formattedDate;
+ }
+}
Added:
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces-twitter.jpg
===================================================================
(Binary files differ)
Property changes on:
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces-twitter.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces.jpg
===================================================================
(Binary files differ)
Property changes on:
root/examples/trunk/components/core-demo/src/main/resources/org/richfaces/demo/richfaces.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/examples/trunk/components/core-demo/src/main/webapp/dynamicExecute.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/dynamicExecute.xhtml
(rev 0)
+++
root/examples/trunk/components/core-demo/src/main/webapp/dynamicExecute.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ </h:head>
+ <h:body>
+ <h:form>
+ <h:selectOneMenu value="#{dynamicExecuteBean.execute}"
onchange="submit()">
+ <f:selectItems value="#{dynamicExecuteBean.executeOptions}" />
+ </h:selectOneMenu>
+ <br />
+ <h:commandLink value="Apply" />
+ </h:form>
+
+ <h:form id="formId">
+ <a4j:outputPanel ajaxRendered="true">
+ Actions counter: #{dynamicExecuteBean.actionsCounter}<br />
+ Input value: #{dynamicExecuteBean.inputValue}<br />
+ Applied value: #{dynamicExecuteBean.value}<br />
+ </a4j:outputPanel>
+
+ <h:inputText value="#{dynamicExecuteBean.inputValue}" />
+
+ <a4j:jsFunction action="#{dynamicExecuteBean.applyValue}"
name="testFunction" execute="#{dynamicExecuteBean.execute}" />
+ <a href="javascript:testFunction()">Call test function</a>
+ </h:form>
+
+ <h:form id="anotherFormId">
+ <a4j:jsFunction action="#{dynamicExecuteBean.applyValue}"
name="anotherTestFunction" execute="#{dynamicExecuteBean.execute}"
/>
+ <a href="javascript:anotherTestFunction()">Call test function from
another form</a>
+ </h:form>
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file
Added: root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml
(rev 0)
+++ root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ </h:head>
+ <h:body>
+ <h:panelGrid columns="2">
+ Time1: <h:panelGroup
id="time1">#{timeBean.dateString}</h:panelGroup>
+ Time2: <h:panelGroup
id="time2">#{timeBean.dateString}</h:panelGroup>
+ Ajax time: <a4j:outputPanel
ajaxRendered="true">#{timeBean.dateString}</a4j:outputPanel>
+ </h:panelGrid>
+
+ <h:form id="form">
+ <a4j:jsFunction action="#{requestBean.setupIdsToRender}"
name="testFunction1" execute="@all"
render="#{requestBean.idsToRender}">
+ <f:param name="idsToRender" value="time1" />
+ </a4j:jsFunction>
+ <a4j:jsFunction action="#{requestBean.setupIdsToRender}"
name="testFunction1Limited" execute="form"
limitToList="true" render="#{requestBean.idsToRender}">
+ <f:param name="idsToRender" value="time1" />
+ </a4j:jsFunction>
+ <a4j:jsFunction action="#{requestBean.setupIdsToRender}"
name="testFunction2" execute="form"
render="#{requestBean.idsToRender}">
+ <f:param name="idsToRender" value="time2" />
+ </a4j:jsFunction>
+ <a4j:jsFunction action="#{requestBean.setupIdsToRender}"
name="testFunction2Limited" execute="form"
limitToList="true" render="#{requestBean.idsToRender}">
+ <f:param name="idsToRender" value="time2" />
+ </a4j:jsFunction>
+
+ <h:commandLink value="test">
+ <f:ajax />
+ <f:param name="a" value="b" />
+ </h:commandLink>
+ </h:form>
+
+ <a href="javascript:testFunction1()">Call test function1</a>
+ <a href="javascript:testFunction1Limited()">Call test function1 with
limitToList=true</a>
+ <a href="javascript:testFunction2()">Call test function2</a>
+ <a href="javascript:testFunction2Limited()">Call test function2 with
limitToList=true</a>
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file
Modified: root/examples/trunk/components/core-demo/src/main/webapp/index.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/index.xhtml 2009-08-18
09:40:41 UTC (rev 15191)
+++ root/examples/trunk/components/core-demo/src/main/webapp/index.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -27,6 +27,8 @@
<img src="#{resource['org.richfaces.resource.TestResource2']}"
/>
+ <img
src="#{resource['org.richfaces.resource.AnimatedTestResource']}" />
+
<img src="#{testResource.requestPath}" />
</h:form>
Added: root/examples/trunk/components/core-demo/src/main/webapp/mediaOutput.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/mediaOutput.xhtml
(rev 0)
+++ root/examples/trunk/components/core-demo/src/main/webapp/mediaOutput.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ </h:head>
+ <h:body>
+ <a4j:mediaOutput createContent="#{mediaOutputBean.createContent}"
value="richfaces.jpg"
+ element="img" /><br />
+ <a4j:mediaOutput createContent="#{mediaOutputBean.createContent}"
value="richfaces-twitter.jpg"
+ element="img" /><br />
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file
Added: root/examples/trunk/components/core-demo/src/main/webapp/outputPanel.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/outputPanel.xhtml
(rev 0)
+++ root/examples/trunk/components/core-demo/src/main/webapp/outputPanel.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ </h:head>
+ <h:body>
+ <a4j:outputPanel layout="block">
+ Output panel
+ </a4j:outputPanel>
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file
Added: root/examples/trunk/components/core-demo/src/main/webapp/push.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/push.xhtml
(rev 0)
+++ root/examples/trunk/components/core-demo/src/main/webapp/push.xhtml 2009-08-18
09:41:53 UTC (rev 15192)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ </h:head>
+ <h:body>
+ <h:panelGrid columns="2">
+ Time: <h:panelGroup
id="time">#{timeBean.dateString}</h:panelGroup>
+ </h:panelGrid>
+
+ <h:form id="form">
+ <a4j:push eventProducer="#{pushBean.setListener}"
interval="5000">
+ <f:ajax render="#{':time'}" />
+ </a4j:push>
+
+ <h:commandLink value="Generate push event"
action="#{pushBean.generateEvent}">
+ <f:ajax render="#{'@this'}" />
+ </h:commandLink>
+ </h:form>
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file