Author: ppitonak(a)redhat.com
Date: 2011-02-01 04:16:00 -0500 (Tue, 01 Feb 2011)
New Revision: 21349
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichHashParamBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
https://issues.jboss.org/browse/RFPL-736
* added a sample for rich:hashParam
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-02-01
09:04:56 UTC (rev 21348)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-02-01
09:16:00 UTC (rev 21349)
@@ -135,6 +135,7 @@
components.put("richExtendedDataTable", "Rich Extended Data
Table");
components.put("richFileUpload", "Rich File Upload");
components.put("richFunctions", "Rich Functions");
+ components.put("richHashParam", "Rich Hash Parameter");
components.put("richInplaceInput", "Rich Inplace Input");
components.put("richInplaceSelect", "Rich Inplace Select");
components.put("richInputNumberSlider", "Rich Input Number
Slider");
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichHashParamBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichHashParamBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichHashParamBean.java 2011-02-01
09:16:00 UTC (rev 21349)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UIHashParameter;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:hashParam.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richHashParamBean")
+@ViewScoped
+public class RichHashParamBean 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.debug("initializing bean " + getClass().getName());
+
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UIHashParameter.class, getClass());
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Property changes on:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichHashParamBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/list.xhtml 2011-02-01
09:16:00 UTC (rev 21349)
@@ -0,0 +1,42 @@
+<?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:ui="http://java.sun.com/jsf/facelets"
+
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">Rich Hash
Parameter</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page containing a popup panel, <b>rich:hashParam</b>
and inputs for all its attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/simple.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHashParam/simple.xhtml 2011-02-01
09:16:00 UTC (rev 21349)
@@ -0,0 +1,95 @@
+<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+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="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:popupPanel id="popupPanel" resizeable="true"
+ header="Popup panel shown using rich:componentControl
and rich:hashParam">
+ <f:facet name="controls">
+ <h:outputLink value="#"
+
onclick="#{rich:component('popupPanel')}.hide(); return false;">
+ X
+ </h:outputLink>
+ </f:facet>
+ <h:outputText value="Settings applied by hashParam tag:"
/>
+ <h:panelGrid columns="2">
+ <h:outputText value="Width:" />
+ <h:outputText value="543px" />
+ <h:outputText value="Height:" />
+ <h:outputText value="345px" />
+ <h:outputText value="minWidth:" />
+ <h:outputText value="300px" />
+ <h:outputText value="minHeight:" />
+ <h:outputText value="150px" />
+ </h:panelGrid>
+ <p>Also panel getting centered by using:</p>
+ <p><a4j:param noEscape="true"
name="left" value="(screen.width/2)-250"/></p>
+ <p><a4j:param noEscape="true" name="top"
value="(screen.height/2)-150"/></p>
+ <fieldset>
+ <legend><b>NOTE</b></legend>
+
+ Pay your attention that show() api method requires event
+ parameter to be first according to signature. So we passed it before
+ hashParam.
+
+ </fieldset>
+ </rich:popupPanel>
+
+ <h:commandButton value="Show popup">
+ <rich:componentControl target="popupPanel"
operation="show">
+ <a4j:param noEscape="true" value="event"
/>
+ <rich:hashParam>
+ <f:param name="width" value="543px" />
+ <f:param name="height" value="345px"
/>
+ <f:param name="minWidth" value="300px"
/>
+ <f:param name="minHeight" value="150px"
/>
+ <a4j:param noEscape="true" name="left"
value="(jQuery(window).width()/2)-250" />
+ <a4j:param noEscape="true" name="top"
value="(jQuery(window).height()/2)-150" />
+ </rich:hashParam>
+ </rich:componentControl>
+ </h:commandButton>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richHashParamBean.attributes}"
id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file