Author: lfryc(a)redhat.com
Date: 2010-09-27 06:39:18 -0400 (Mon, 27 Sep 2010)
New Revision: 19343
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
added ui:repeat to Metamer
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 2010-09-24
15:18:00 UTC (rev 19342)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-09-27
10:39:18 UTC (rev 19343)
@@ -110,6 +110,7 @@
components.put("a4jStatus", "A4J Status");
components.put("commandButton", "JSF Command Button");
components.put("hDataTable", "JSF Data Table");
+ components.put("uiRepeat", "UI Repeat");
components.put("richAccordion", "Rich Accordion");
components.put("richAccordionItem", "Rich Accordion Item");
components.put("richAutocomplete", "Rich Autocomplete");
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java 2010-09-27
10:39:18 UTC (rev 19343)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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.tests.metamer.bean;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:repeat.
+ *
+ * <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ *
+ * @version $Revision$
+ */
+@ManagedBean(name = "uiRepeatBean")
+@ViewScoped
+public class UiRepeatBean implements Serializable {
+
+ private static final long serialVersionUID = 4864439475400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+ private List<Data> dataList;
+ private Data selectedDataItem = null;
+
+ private Object binding;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ // initialize model for page simple.xhtml
+ dataList = new ArrayList<Data>();
+ for (int i = 0; i < 20; i++) {
+ Data data = new Data();
+ data.setText(MessageFormat.format("Item {0}", i));
+ dataList.add(data);
+ }
+
+ // initialize attributes
+ attributes =
Attributes.getUIComponentAttributes(com.sun.faces.facelets.component.UIRepeat.class,
getClass());
+ attributes.setAttribute("rendered", true);
+ attributes.setAttribute("step", 1);
+ attributes.setAttribute("end", 20);
+
+ // should be hiddens
+ attributes.remove("size");
+ attributes.remove("offset");
+ attributes.remove("value");
+ attributes.remove("var");
+ attributes.remove("varStatus");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * @return the data
+ */
+ public List<Data> getDataList() {
+ return dataList;
+ }
+
+ /**
+ * @return the selectedDataItem
+ */
+ public Data getSelectedDataItem() {
+ return selectedDataItem;
+ }
+
+ /**
+ * @param selectedDataItem
+ * the selectedDataItem to set
+ */
+ public void setSelectedDataItem(Data selectedDataItem) {
+ this.selectedDataItem = selectedDataItem;
+ }
+
+ public static final class Data implements Serializable {
+
+ private static final long serialVersionUID = -1461777632529492912L;
+ private String text;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text
+ * the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/list.xhtml 2010-09-27
10:39:18 UTC (rev 19343)
@@ -0,0 +1,41 @@
+<!--
+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.
+-->
+
+<!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">
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">UI Repeat</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page that contains <b>ui:repeat</b> and input boxes
for all its attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml 2010-09-27
10:39:18 UTC (rev 19343)
@@ -0,0 +1,82 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+
+<!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">
+
+ <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="a4jRepeat.css"
/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:outputText id="output"
value="#{uiRepeatBean.selectedDataItem.text}"/>
+
+ <ul id="list">
+ <ui:repeat id="uiRepeat"
+ value="#{uiRepeatBean.dataList}" var="item"
+ varStatus="status"
+
+ begin="#{uiRepeatBean.attributes.begin.value}"
+ end="#{uiRepeatBean.attributes.end.value}"
+ offset="#{uiRepeatBean.attributes.offset.value}"
+ rendered="#{uiRepeatBean.attributes.rendered.value}"
+
+ step="#{uiRepeatBean.attributes.step.value}"
+
+ >
+ <li>
+ <h:inputText value="#{item.text}" />
+ <h:commandLink value="Link">
+ <f:ajax render="@form" execute="@form"
/>
+ <f:setPropertyActionListener
target="#{uiRepeatBean.selectedDataItem}" value="#{item}" />
+ </h:commandLink>
+
+ <a4j:outputPanel styleClass="statuses">
+ <h:outputText id="statusIndex"
value="index=#{status.index}, "/>
+ <h:outputText id="statusCount"
value="count=#{status.count}, "/>
+ <h:outputText id="statusFirst"
value="first=#{status.first}, "/>
+ <h:outputText id="statusLast"
value="last=#{status.last}, "/>
+ <h:outputText id="statusEven"
value="even=#{status.even}, "/>
+ </a4j:outputPanel>
+ </li>
+ </ui:repeat>
+ </ul>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{uiRepeatBean.attributes}"
id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file