Author: jjamrich
Date: 2011-08-01 18:06:37 -0400 (Mon, 01 Aug 2011)
New Revision: 22581
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
RFPL-1546: add rich:pickList into 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-01
21:58:53 UTC (rev 22580)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2011-08-01
22:06:37 UTC (rev 22581)
@@ -160,6 +160,7 @@
richComponents.put("richPanelMenu", "Rich Panel Menu");
richComponents.put("richPanelMenuGroup", "Rich Panel Menu
Group");
richComponents.put("richPanelMenuItem", "Rich Panel Menu
Item");
+ richComponents.put("richPickList", "Rich Pick List");
richComponents.put("richPopupPanel", "Rich Popup Panel");
richComponents.put("richProgressBar", "Rich Progress Bar");
richComponents.put("richSelect", "Rich Select");
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java 2011-08-01
22:06:37 UTC (rev 22581)
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.ViewScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import javax.faces.validator.ValidatorException;
+
+import org.richfaces.component.UIPickList;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.model.Capital;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Backing Bean for rich:pickList component at
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richPickListBean")
+@ViewScoped
+public class RichPickListBean implements Serializable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RichPickListBean.class);
+
+ /** Generated Serial UID Number */
+ private static final long serialVersionUID = 2158237918061200181L;
+
+ private Attributes attributes;
+ @ManagedProperty(value = "#{model.capitals}")
+ private List<Capital> capitals;
+ private List<SelectItem> capitalsOptions = null;
+ private List<SelectItem> validationOptions = null;
+ private List<SelectItem> value = null;
+
+ @PostConstruct
+ public void init() {
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIPickList.class,
getClass());
+ capitalsOptions = new ArrayList<SelectItem>();
+ validationOptions = new ArrayList<SelectItem>();
+ value = new ArrayList<SelectItem>();
+
+ for (Capital capital : capitals) {
+ capitalsOptions.add(new SelectItem(capital.getState(), capital.getState()));
+ validationOptions.add(new SelectItem(capital.getState(),
capital.getState()));
+ }
+ validationOptions.add(new SelectItem("@@", "@@"));
+ validationOptions.add(new SelectItem("", ""));
+ validationOptions.add(new SelectItem("RichFaces",
"RichFaces"));
+ validationOptions.add(new SelectItem("richfaces",
"richfaces"));
+
+ attributes.setAttribute("rendered", Boolean.TRUE);
+ attributes.setAttribute("minListHeight", "100");
+
+ attributes.remove("converter");
+ attributes.remove("converterMessage");
+ }
+
+ /**
+ * Test method for verify validator attribute
+ * @param context
+ * @param component
+ * @param value
+ */
+ public void validatePickListValue(FacesContext context, UIComponent component, Object
value) {
+ LOG.info(" #validatePickListValue: Custom validation for rich:pickList
");
+
+ @SuppressWarnings("unchecked")
+ List<String> l = (List<String>)value;
+ if (l.contains("@@")) {
+ LOG.info(" Validation rule violation found! One of picked items contains
'@'!");
+ throw new ValidatorException(
+ new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ "PickList don't like '@' char!", "PickList
don't like '@' char!"));
+ }
+ }
+
+ /**
+ *
+ * @return attributes
+ */
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ *
+ * @param attributes
+ */
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ *
+ * @return capitals
+ */
+ public List<Capital> getCapitals() {
+ return capitals;
+ }
+
+ /**
+ *
+ * @param capitals
+ */
+ public void setCapitals(List<Capital> capitals) {
+ this.capitals = capitals;
+ }
+
+ /**
+ * @return the capitalsOptions
+ */
+ public List<SelectItem> getCapitalsOptions() {
+ return capitalsOptions;
+ }
+
+ /**
+ * @param capitalsOptions the capitalsOptions to set
+ */
+ public void setCapitalsOptions(List<SelectItem> capitalsOptions) {
+ this.capitalsOptions = capitalsOptions;
+ }
+
+ /**
+ * @return the validationOptions
+ */
+ public List<SelectItem> getValidationOptions() {
+ return validationOptions;
+ }
+
+ /**
+ * @param validationOptions the validationOptions to set
+ */
+ public void setValidationOptions(List<SelectItem> validationOptions) {
+ this.validationOptions = validationOptions;
+ }
+
+ /**
+ * @return the value
+ */
+ public List<SelectItem> getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(List<SelectItem> value) {
+ this.value = value;
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/list.xhtml 2011-08-01
22:06:37 UTC (rev 22581)
@@ -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 Pick List</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ Simple page containing rich:pickList and input boxes for all its
attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml 2011-08-01
22:06:37 UTC (rev 22581)
@@ -0,0 +1,136 @@
+<?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" >
+
+ <!--
+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="view">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:pickList id="pickList"
+ addAllText="#{richPickListBean.attributes['addAllText'].value}"
+ addText="#{richPickListBean.attributes['addText'].value}"
+ columnClasses="#{richPickListBean.attributes['columnClasses'].value}"
+ columnVar="#{richPickListBean.attributes['columnVar'].value}"
+ defaultLabel="#{richPickListBean.attributes['defaultLabel'].value}"
+ disabled="#{richPickListBean.attributes['disabled'].value}"
+ disabledClass="#{richPickListBean.attributes['disabledClass'].value}"
+ headerClass="#{richPickListBean.attributes['headerClass'].value}"
+ immediate="#{richPickListBean.attributes['immediate'].value}"
+ itemClass="#{richPickListBean.attributes['itemClass'].value}"
+ listHeight="#{richPickListBean.attributes['listHeight'].value}"
+ listWidth="#{richPickListBean.attributes['listWidth'].value}"
+ maxListHeight="#{richPickListBean.attributes['maxListHeight'].value}"
+ minListHeight="#{richPickListBean.attributes['minListHeight'].value}"
+ onadditem="#{richPickListBean.attributes['onadditem'].value}"
+ onblur="#{richPickListBean.attributes['onblur'].value}"
+ onchange="#{richPickListBean.attributes['onchange'].value}"
+ onclick="#{richPickListBean.attributes['onclick'].value}"
+ ondblclick="#{richPickListBean.attributes['ondblclick'].value}"
+ onfocus="#{richPickListBean.attributes['onfocus'].value}"
+ onkeydown="#{richPickListBean.attributes['onkeydown'].value}"
+ onkeypress="#{richPickListBean.attributes['onkeypress'].value}"
+ onkeyup="#{richPickListBean.attributes['onkeyup'].value}"
+ onlistclick="#{richPickListBean.attributes['onlistclick'].value}"
+ onlistdblclick="#{richPickListBean.attributes['onlistdblclick'].value}"
+ onlistkeydown="#{richPickListBean.attributes['onlistkeydown'].value}"
+ onlistkeypress="#{richPickListBean.attributes['onlistkeypress'].value}"
+ onlistkeyup="#{richPickListBean.attributes['onlistkeyup'].value}"
+ onlistmousedown="#{richPickListBean.attributes['onlistmousedown'].value}"
+ onlistmousemove="#{richPickListBean.attributes['onlistmousemove'].value}"
+ onlistmouseout="#{richPickListBean.attributes['onlistmouseout'].value}"
+ onlistmouseover="#{richPickListBean.attributes['onlistmouseover'].value}"
+ onlistmouseup="#{richPickListBean.attributes['onlistmouseup'].value}"
+ onmousedown="#{richPickListBean.attributes['onmousedown'].value}"
+ onmousemove="#{richPickListBean.attributes['onmousemove'].value}"
+ onmouseout="#{richPickListBean.attributes['onmouseout'].value}"
+ onmouseover="#{richPickListBean.attributes['onmouseover'].value}"
+ onmouseup="#{richPickListBean.attributes['onmouseup'].value}"
+ onremoveitem="#{richPickListBean.attributes['onremoveitem'].value}"
+ onsourceclick="#{richPickListBean.attributes['onsourceclick'].value}"
+ onsourcedblclick="#{richPickListBean.attributes['onsourcedblclick'].value}"
+ onsourcekeydown="#{richPickListBean.attributes['onsourcekeydown'].value}"
+ onsourcekeypress="#{richPickListBean.attributes['onsourcekeypress'].value}"
+ onsourcekeyup="#{richPickListBean.attributes['onsourcekeyup'].value}"
+ onsourcemousedown="#{richPickListBean.attributes['onsourcemousedown'].value}"
+ onsourcemousemove="#{richPickListBean.attributes['onsourcemousemove'].value}"
+ onsourcemouseout="#{richPickListBean.attributes['onsourcemouseout'].value}"
+ onsourcemouseover="#{richPickListBean.attributes['onsourcemouseover'].value}"
+ onsourcemouseup="#{richPickListBean.attributes['onsourcemouseup'].value}"
+ ontargetclick="#{richPickListBean.attributes['ontargetclick'].value}"
+ ontargetdblclick="#{richPickListBean.attributes['ontargetdblclick'].value}"
+ ontargetkeydown="#{richPickListBean.attributes['ontargetkeydown'].value}"
+ ontargetkeypress="#{richPickListBean.attributes['ontargetkeypress'].value}"
+ ontargetkeyup="#{richPickListBean.attributes['ontargetkeyup'].value}"
+ ontargetmousedown="#{richPickListBean.attributes['ontargetmousedown'].value}"
+ ontargetmousemove="#{richPickListBean.attributes['ontargetmousemove'].value}"
+ ontargetmouseout="#{richPickListBean.attributes['ontargetmouseout'].value}"
+ ontargetmouseover="#{richPickListBean.attributes['ontargetmouseover'].value}"
+ ontargetmouseup="#{richPickListBean.attributes['ontargetmouseup'].value}"
+ removeAllText="#{richPickListBean.attributes['removeAllText'].value}"
+ removeText="#{richPickListBean.attributes['removeText'].value}"
+ rendered="#{richPickListBean.attributes['rendered'].value}"
+ required="#{richPickListBean.attributes['required'].value}"
+ requiredMessage="#{richPickListBean.attributes['requiredMessage'].value}"
+ selectItemClass="#{richPickListBean.attributes['selectItemClass'].value}"
+ showButton="#{richPickListBean.attributes['showButton'].value}"
+ sourceCaption="#{richPickListBean.attributes['sourceCaption'].value}"
+ style="#{richPickListBean.attributes['style'].value}"
+ styleClass="#{richPickListBean.attributes['styleClass'].value}"
+ targetCaption="#{richPickListBean.attributes['targetCaption'].value}"
+ validator="#{richPickListBean.validatePickListValue}"
+ value="#{richPickListBean.value}"
+ valueChangeListener="#{richBean.valueChangeListener}" >
+
+ <f:selectItems value="#{richPickListBean.validationOptions}" />
+
+ </rich:pickList>
+ <rich:message id="msg" for="pickList"/>
+
+ <br/><br/>
+ <h:commandButton id="hButton" value="h:commandButton"
style="margin-right: 10px;"/>
+ <a4j:commandButton id="a4jButton"
value="a4j:commandButton"/>
+
+ <br/><br/>
+ output: <h:outputText id="output"
value="#{richPickListBean.attributes['value'].value}"/>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ Attributes for pickList:
+ <metamer:attributes value="#{richPickListBean.attributes}"
id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file