Author: jpapouse
Date: 2011-08-05 08:07:57 -0400 (Fri, 05 Aug 2011)
New Revision: 22595
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichOrderingListBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
RFPL-1547: added page with rich:orderingList 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 2011-08-04
15:43:59 UTC (rev 22594)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-08-05
12:07:57 UTC (rev 22595)
@@ -156,6 +156,7 @@
richComponents.put("richMenuSeparator", "Rich Menu
Separator");
richComponents.put("richMessage", "Rich Message");
richComponents.put("richMessages", "Rich Messages");
+ richComponents.put("richOrderingList", "Rich Ordering
List");
richComponents.put("richPanel", "Rich Panel");
richComponents.put("richPanelMenu", "Rich Panel Menu");
richComponents.put("richPanelMenuGroup", "Rich Panel Menu
Group");
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichOrderingListBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichOrderingListBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichOrderingListBean.java 2011-08-05
12:07:57 UTC (rev 22595)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.rich;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.ViewScoped;
+import javax.faces.convert.Converter;
+
+import org.richfaces.component.UIOrderingList;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.model.Capital;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple bean for rich:orderingList component example.
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+@ManagedBean(name = "richOrderingListBean")
+@ViewScoped
+public class RichOrderingListBean implements Serializable {
+
+ private static final long serialVersionUID = 5868941019675985273L;
+ private static Logger logger;
+ //FIXME: @ManagedProperty(value="#{model.capitals}")
+ private List<Capital> capitals;
+ private Attributes attributes;
+ @ManagedProperty(value="#{capitalConverter}")
+ private Converter converter;
+
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.info("initializing bean " + getClass().getName());
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UIOrderingList.class, getClass());
+
+ attributes.setAttribute("columnVar", "capital");
+ attributes.setAttribute("converter", getConverter());
+ attributes.setAttribute("downText", "Down");
+ attributes.setAttribute("downBottomText", "Last");
+ attributes.setAttribute("listWidth", 300);
+ attributes.setAttribute("listHeight", 500);
+ attributes.setAttribute("rendered", true);
+ attributes.setAttribute("showButton", true);
+ attributes.setAttribute("var", "capital");
+ attributes.setAttribute("upText", "Up");
+ attributes.setAttribute("upTopText", "First");
+
+ // FIXME
+ capitals = Model.unmarshallCapitals();
+ }
+
+ public List<Capital> getCapitals() {
+ logger.info("size of returned capitals is <" + capitals.size() +
">");
+ return capitals;
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setCapitals(List<Capital> capitals) {
+ logger.info("size of set capitals is <" + capitals.size() +
">");
+ this.capitals = capitals;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public Converter getConverter() {
+ return converter;
+ }
+
+ public void setConverter(Converter converter) {
+ this.converter = converter;
+ }
+
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java 2011-08-05
12:07:57 UTC (rev 22595)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.converter;
+
+import java.util.List;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.model.Capital;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+@FacesConverter(value = "capitalConverter")
+public class CapitalConverter implements Converter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CapitalConverter.class);
+ // FIXME: @ManagedProperty(value="#{model.capitals}")
+ private List<Capital> capitals = Model.unmarshallCapitals();
+
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ LOGGER.info(value);
+ for(Capital capital : capitals) {
+ if (capitalAsString(capital).equals(value)) {
+ Capital toReturn = new Capital();
+ toReturn.setName(capital.getName());
+ toReturn.setState(capital.getState());
+ toReturn.setTimeZone(capital.getTimeZone());
+ return toReturn;
+ }
+ }
+ throw new FacesException("Cannot convert parameter \"" + value +
"\" to the Capital.");
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ if (!(value instanceof Capital)) {
+ throw new FacesException("Cannot convert parameter \"" + value
+ "\" to the String.");
+ }
+ return capitalAsString((Capital) value);
+ }
+
+ public List<Capital> getCapitals() {
+ return capitals;
+ }
+
+ public void setCapitals(List<Capital> capitals) {
+ this.capitals = capitals;
+ }
+
+ private String capitalAsString(Capital capital) {
+ return capital.getName();
+ }
+
+}
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/list.xhtml 2011-08-05
12:07:57 UTC (rev 22595)
@@ -0,0 +1,41 @@
+<?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 Ordering List</ui:define>
+
+ <ui:define name="links">
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page that contains <b>rich:panel</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/richOrderingList/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml 2011-08-05
12:07:57 UTC (rev 22595)
@@ -0,0 +1,121 @@
+<?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:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:it="http://richfaces.org/iteration">
+
+<!--
+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>
+ <h:commandButton value="submit">
+ <f:ajax execute="@form" render="orderingList
output" />
+ </h:commandButton>
+ <br />
+ <rich:orderingList
columnClasses="#{richOrderingListBean.attributes['columnClasses'].value}"
+
columnVar="#{richOrderingListBean.attributes['columnVar'].value}"
+
converter="#{richOrderingListBean.attributes['converter'].value}"
+
converterMessage="#{richOrderingListBean.attributes['converterMessage'].value}"
+
defaultLabel="#{richOrderingListBean.attributes['defaultLabel'].value}"
+
disabled="#{richOrderingListBean.attributes['disabled'].value}"
+
disabledClass="#{richOrderingListBean.attributes['disabledClass'].value}"
+
downBottomText="#{richOrderingListBean.attributes['downBottomText'].value}"
+
downText="#{richOrderingListBean.attributes['downText'].value}"
+
headerClass="#{richOrderingListBean.attributes['headerClass'].value}"
+ id="orderingList"
+
immediate="#{richOrderingListBean.attributes['immediate'].value}"
+
itemClass="#{richOrderingListBean.attributes['itemClass'].value}"
+
itemLabel="#{richOrderingListBean.attributes['itemlabel'].value}"
+ itemValue="#{capital}"
+
itemValues="#{richOrderingListBean.attributes['itemValues'].value}"
+
listHeight="#{richOrderingListBean.attributes['listHeight'].value}"
+
listWidth="#{richOrderingListBean.attributes['listWidth'].value}"
+
maxListHeight="#{richOrderingListBean.attributes['maxListHeight'].value}"
+
minListHeight="#{richOrderingListBean.attributes['minListHeight'].value}"
+
onadditem="#{richOrderingListBean.attributes['onadditem'].value}"
+
onblur="#{richOrderingListBean.attributes['onblur'].value}"
+
onchange="#{richOrderingListBean.attributes['onchange'].value}"
+
onclick="#{richOrderingListBean.attributes['onclick'].value}"
+
ondblclick="#{richOrderingListBean.attributes['ondbclick'].value}"
+
onfocus="#{richOrderingListBean.attributes['onfocus'].value}"
+
onkeydown="#{richOrderingListBean.attributes['onkeydown'].value}"
+
onkeypress="#{richOrderingListBean.attributes['onkeypress'].value}"
+
onkeyup="#{richOrderingListBean.attributes['onkeyup'].value}"
+
onlistclick="#{richOrderingListBean.attributes['onlistclick'].value}"
+
onlistdblclick="#{richOrderingListBean.attributes['onlistdblclick'].value}"
+
onlistkeydown="#{richOrderingListBean.attributes['onlistkeydown'].value}"
+
onlistkeypress="#{richOrderingListBean.attributes['onlistkeypress'].value}"
+
onlistkeyup="#{richOrderingListBean.attributes['onlistkeyup'].value}"
+
onlistmousedown="#{richOrderingListBean.attributes['onlistmousedown'].value}"
+
onlistmousemove="#{richOrderingListBean.attributes['onlistmousemove'].value}"
+
onlistmouseout="#{richOrderingListBean.attributes['onlistmouseout'].value}"
+
onlistmouseover="#{richOrderingListBean.attributes['onlistmouseover'].value}"
+
onlistmouseup="#{richOrderingListBean.attributes['onlistmouseup'].value}"
+
onmousedown="#{richOrderingListBean.attributes['onmousedown'].value}"
+
onmousemove="#{richOrderingListBean.attributes['onmousemove'].value}"
+
onmouseout="#{richOrderingListBean.attributes['onmouseout'].value}"
+
onmouseover="#{richOrderingListBean.attributes['onmouseover'].value}"
+
onmouseup="#{richOrderingListBean.attributes['onmouseup'].value}"
+
onremoveitem="#{richOrderingListBean.attributes['onremoveitem'].value}"
+
rendered="#{richOrderingListBean.attributes['rendered'].value}"
+
required="#{richOrderingListBean.attributes['required'].value}"
+
requiredMessage="#{richOrderingListBean.attributes['requiredMessage'].value}"
+
selectItemClass="#{richOrderingListBean.attributes['selectItemClass'].value}"
+
showButton="#{richOrderingListBean.attributes['showButton'].value}"
+
style="#{richOrderingListBean.attributes['style'].value}"
+
styleClass="#{richOrderingListBean.attributes['styleClass'].value}"
+
upText="#{richOrderingListBean.attributes['upText'].value}"
+
upTopText="#{richOrderingListBean.attributes['upTopText'].value}"
+
validator="#{richOrderingListBean.attributes['validator'].value}"
+
validatorMessage="#{richOrderingListBean.attributes['validatorMessage'].value}"
+ value="#{richOrderingListBean.capitals}"
+
valueChangeListener="#{richOrderingListBean.attributes['valueChangeListener'].value}"
+
var="#{richOrderingListBean.attributes['var'].value}"
+ >
+ <f:converter converterId="capitalConverter" />
+ <rich:column>
+ <f:facet name="header">State</f:facet>
+ #{capital.state}
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">Name</f:facet>
+ #{capital.name}
+ </rich:column>
+ </rich:orderingList>
+ <br />
+ <rich:list id="output"
value="#{richOrderingListBean.capitals}" var="capital">
+ <h:outputText value="#{capital.state}, #{capital.name}"
/>
+ </rich:list>
+ </h:form>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richOrderingListBean.attributes}"
id="attributes" />
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file