Author: jpapouse
Date: 2011-07-22 10:52:32 -0400 (Fri, 22 Jul 2011)
New Revision: 22562
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/NotifyBean.java
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/list.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/simple.xhtml
Modified:
modules/tests/metamer/branches/sandbox-components/application/pom.xml
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java
Log:
RFPL-1504: created simple page with notify component
Modified: modules/tests/metamer/branches/sandbox-components/application/pom.xml
===================================================================
--- modules/tests/metamer/branches/sandbox-components/application/pom.xml 2011-07-20
13:20:48 UTC (rev 22561)
+++ modules/tests/metamer/branches/sandbox-components/application/pom.xml 2011-07-22
14:52:32 UTC (rev 22562)
@@ -62,11 +62,17 @@
<artifactId>annotations</artifactId>
</dependency>
- <dependency>
- <groupId>org.richfaces.sandbox.ui.watermark</groupId>
- <artifactId>watermark-ui</artifactId>
- <version>4.1.0-SNAPSHOT</version>
- </dependency>
+ <!-- Sandbox Components -->
+ <dependency>
+ <groupId>org.richfaces.sandbox.ui.watermark</groupId>
+ <artifactId>watermark-ui</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.sandbox.ui.notify</groupId>
+ <artifactId>notify-ui</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>javax.validation</groupId>
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2011-07-20
13:20:48 UTC (rev 22561)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2011-07-22
14:52:32 UTC (rev 22562)
@@ -169,6 +169,18 @@
}
/**
+ * Factory method for creating instances of class Attributes. Attributes are loaded
from class.
+ *
+ * @param clazz
+ * general class object whose attributes will be stored
+ * @param beanClass
+ * class object of a managed bean
+ */
+ public static Attributes getAttributesFromClass(Class<?> interfaze,
Class<?> beanClass) {
+ return new Attributes(interfaze, beanClass, true);
+ }
+
+ /**
* Factory method for creating instances of class Attributes. Attributes are loaded
from faces-config.xml.
*
* @param clazz
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/NotifyBean.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/NotifyBean.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/NotifyBean.java 2011-07-22
14:52:32 UTC (rev 22562)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.AbstractNotify;
+import org.richfaces.component.AbstractNotifyMessages;
+import org.richfaces.component.AbstractNotifyStack;
+import org.richfaces.component.NotifyAttributes;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for notify:notify
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+@ManagedBean(name = "notifyBean")
+@ViewScoped
+public class NotifyBean implements Serializable {
+
+ private static final long serialVersionUID = 8408544368608166106L;
+ private static Logger logger;
+ private Attributes attributesNotify;
+ private Attributes attributesNotifyMessages;
+ private Attributes attributesNotifyStack;
+ private Attributes attributesBean;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+ attributesNotify =
Attributes.getComponentAttributesFromClass(AbstractNotify.class, getClass());
+ attributesNotifyMessages =
Attributes.getComponentAttributesFromClass(AbstractNotifyMessages.class, getClass());
+ attributesNotifyStack =
Attributes.getComponentAttributesFromClass(AbstractNotifyStack.class, getClass());
+ attributesBean = Attributes.getEmptyAttributes(getClass());
+
+ attributesNotify.putAll(getGeneralAttributes());
+ attributesNotify.setAttribute("text", "Message text");
+ attributesNotify.setAttribute("title", "Message title");
+ attributesNotify.remove("rendered");
+
+ attributesNotifyMessages.putAll(getGeneralAttributes());
+ attributesNotifyMessages.setAttribute("interval", 800);
+ attributesNotifyMessages.setAttribute("showSummary", true);
+ attributesNotifyMessages.remove("rendered");
+
+ attributesNotifyStack.setAttribute("push", "bottom");
+ attributesNotifyStack.setAttribute("stackDir1", "down");
+ attributesNotifyStack.setAttribute("stackDir2", "left");
+ attributesNotifyStack.remove("rendered");
+
+ attributesBean.setAttribute("messageCount", "1");
+ attributesBean.setAttribute("messageDetail", "Detail: <Message
text>");
+ attributesBean.setAttribute("messageText", "Message text");
+ }
+
+ public void produceError() {
+ produceMessage(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void produceFatal() {
+ produceMessage(FacesMessage.SEVERITY_FATAL);
+ }
+
+ public void produceInfo() {
+ produceMessage(FacesMessage.SEVERITY_INFO);
+ }
+
+ public void produceWarn() {
+ produceMessage(FacesMessage.SEVERITY_WARN);
+ }
+
+ public Attributes getAttributesBean() {
+ return attributesBean;
+ }
+
+ public Attributes getAttributesNotify() {
+ return attributesNotify;
+ }
+
+
+ public Attributes getAttributesNotifyMessages() {
+ return attributesNotifyMessages;
+ }
+
+
+ public Attributes getAttributesNotifyStack() {
+ return attributesNotifyStack;
+ }
+
+ public void setAttributesBean(Attributes attributesBean) {
+ this.attributesBean = attributesBean;
+ }
+
+ public void setAttributesNotify(Attributes attributesNotify) {
+ this.attributesNotify = attributesNotify;
+ }
+
+ public void setAttributesNotifyMessages(Attributes attributesNotifyMessages) {
+ this.attributesNotifyMessages = attributesNotifyMessages;
+ }
+
+
+ public void setAttributesNotifyStack(Attributes attributesNotifyStack) {
+ this.attributesNotifyStack = attributesNotifyStack;
+ }
+
+ private void produceMessage(FacesMessage.Severity severity) {
+ int messageCount =
Integer.valueOf((String)attributesBean.get("messageCount").getValue());
+ String text = (String) attributesBean.get("messageText").getValue();
+ String detail = (String)
attributesBean.get("messageDetail").getValue();
+ logger.info("starting message production (" + messageCount +
")[" + severity + "][" + text + "].");
+ for(int i=0; i<messageCount; i++) {
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity,
text, detail));
+ }
+ logger.info("finishing message production (" + messageCount +
")[" + severity + "][" + text + "].");
+ }
+
+ private Attributes getGeneralAttributes() {
+ Attributes attributes = Attributes.getAttributesFromClass(NotifyAttributes.class,
getClass());
+ attributes.setAttribute("animationSpeed", 100);
+ attributes.setAttribute("appearAnimation", "fade");
+ attributes.setAttribute("hideAnimation", "show");
+ attributes.setAttribute("showCloseButton", true);
+ attributes.setAttribute("stack", "exampleNotifyStack");
+ attributes.setAttribute("stayTime", 3000);
+ return attributes;
+ }
+}
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-07-20
13:20:48 UTC (rev 22561)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-07-22
14:52:32 UTC (rev 22562)
@@ -120,6 +120,7 @@
otherComponents.put("expressionLanguage", "Expression
Language");
otherComponents.put("commandButton", "JSF Command Button");
otherComponents.put("hDataTable", "JSF Data Table");
+ otherComponents.put("notify", "Notify");
otherComponents.put("uiRepeat", "UI Repeat");
otherComponents.put("watermark", "Watermark");
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java 2011-07-20
13:20:48 UTC (rev 22561)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java 2011-07-22
14:52:32 UTC (rev 22562)
@@ -1,3 +1,24 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.tests.metamer.bean;
import java.io.Serializable;
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/list.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/list.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/list.xhtml 2011-07-22
14:52:32 UTC (rev 22562)
@@ -0,0 +1,43 @@
+<?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: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:metamer="http://java.sun.com/jsf/composite/metamer">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, 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.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Notify</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page that contains <b>notify:notify</b> and input
boxes for all its attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/simple.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/simple.xhtml
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/notify/simple.xhtml 2011-07-22
14:52:32 UTC (rev 22562)
@@ -0,0 +1,98 @@
+<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:notify="http://richfaces.org/sandbox/notify"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, 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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="component">
+ <h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <notify:notifyStack id="exampleNotifyStack"
+
push="#{notifyBean.attributesNotifyStack['push'].value}"
+
stackDir1="#{notifyBean.attributesNotifyStack['stackDir1'].value}"
+
stackDir2="#{notifyBean.attributesNotifyStack['stackDir2'].value}"
+
styleClass="#{notifyBean.attributesNotifyStack['styleClass'].value}"
+ />
+ <notify:notify
animationSpeed="#{notifyBean.attributesNotify['animationSpeed'].value}"
+
appearAnimation="#{notifyBean.attributesNotify['appearAnimation'].value}"
+
delay="#{notifyBean.attributesNotify['delay'].value}"
+
hideAnimation="#{notifyBean.attributesNotify['hideAnimation'].value}"
+
nonblocking="#{notifyBean.attributesNotify['nonBlocking'].value}"
+
nonblockingOpacity="#{notifyBean.attributesNotify['nonBlockingOpacity'].value}"
+
showCloseButton="#{notifyBean.attributesNotify['showCloseButton'].value}"
+
showHistory="#{notifyBean.attributesNotify['showHistory'].value}"
+
showShadow="#{notifyBean.attributesNotify['showShadow'].value}"
+
stack="#{notifyBean.attributesNotify['stack'].value}"
+
stayTime="#{notifyBean.attributesNotify['stayTime'].value}"
+
sticky="#{notifyBean.attributesNotify['sticky'].value}"
+
styleClass="#{notifyBean.attributesNotify['styleClass'].value}"
+
text="#{notifyBean.attributesNotify['text'].value}"
+
title="#{notifyBean.attributesNotify['title'].value}"
+ />
+ <notify:notifyMessages
ajaxRendered="#{notifyBean.attributesNotifyMessages['ajaxRendered'].value}"
+
animationSpeed="#{notifyBean.attributesNotifyMessages['animationSpeed'].value}"
+
appearAnimation="#{notifyBean.attributesNotifyMessages['appearAnimation'].value}"
+
delay="#{notifyBean.attributesNotifyMessages['delay'].value}"
+ execute="{@form}"
+
for="#{notifyBean.attributesNotifyMessages['for'].value}"
+
globalOnly="#{notifyBean.attributesNotifyMessages['delay'].value}"
+
hideAnimation="#{notifyBean.attributesNotifyMessages['hideAnimation'].value}"
+
keepTransient="#{notifyBean.attributesNotifyMessages['keepTransient'].value}"
+
interval="#{notifyBean.attributesNotifyMessages['interval'].value}"
+
nonblocking="#{notifyBean.attributesNotifyMessages['nonBlocking'].value}"
+
nonblockingOpacity="#{notifyBean.attributesNotifyMessages['nonBlockingOpacity'].value}"
+
showCloseButton="#{notifyBean.attributesNotifyMessages['showCloseButton'].value}"
+
showDetail="#{notifyBean.attributesNotifyMessages['showDetail'].value}"
+
showHistory="#{notifyBean.attributesNotifyMessages['showHistory'].value}"
+
showShadow="#{notifyBean.attributesNotifyMessages['showShadow'].value}"
+
showSummary="#{notifyBean.attributesNotifyMessages['showSummary'].value}"
+
stack="#{notifyBean.attributesNotifyMessages['stack'].value}"
+
stayTime="#{notifyBean.attributesNotifyMessages['stayTime'].value}"
+
sticky="#{notifyBean.attributesNotifyMessages['sticky'].value}"
+
styleClass="#{notifyBean.attributesNotifyMessages['styleClass'].value}"
+ />
+ </a4j:outputPanel>
+ <a4j:commandButton id="produceError" value="Produce
Error" action="#{notifyBean.produceError}" execute="@form"/>
+ <a4j:commandButton id="produceFatal" value="Produce
Fatal" action="#{notifyBean.produceFatal}" execute="@form"/>
+ <a4j:commandButton id="produceInfo" value="Produce
Info" action="#{notifyBean.produceInfo}" execute="@form"/>
+ <a4j:commandButton id="produceWarn" value="Produce
Warn" action="#{notifyBean.produceWarn}" execute="@form"/>
+ </h:form>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <h2>Attributes - Notify</h2>
+ <metamer:attributes value="#{notifyBean.attributesNotify}"
id="attributesNotify" render="panel"/>
+ <h2>Attributes - Notify Messages</h2>
+ <metamer:attributes
value="#{notifyBean.attributesNotifyMessages}"
id="attributesNotifyMessages" render="panel"/>
+ <h2>Attributes - Notify Stack</h2>
+ <metamer:attributes value="#{notifyBean.attributesNotifyStack}"
id="attributesNotifyStack" render="panel"/>
+ <h2>Attributes - Bean</h2>
+ <metamer:attributes value="#{notifyBean.attributesBean}"
id="attributesBean" render="panel"/>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file