Author: jpapouse
Date: 2011-07-20 08:18:32 -0400 (Wed, 20 Jul 2011)
New Revision: 22559
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/converter/ConstantConverter.java
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/webapp/components/watermark/hInputSecret.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml
Log:
FPL-1520: updated attributes of the watermark component and used constant converter
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
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/bean/WatermarkBean.java 2011-07-20
12:18:32 UTC (rev 22559)
@@ -3,12 +3,12 @@
import java.io.Serializable;
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.AbstractWatermark;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.converter.ConstantConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,8 +26,7 @@
private static final long serialVersionUID = -3976697340610316015L;
private static Logger logger;
private Attributes attributes;
- @ManagedProperty(value = "#{constantConverter}")
- private Converter converter;
+ private Converter converter = new ConstantConverter(ConstantConverter.DEFAULT_OBJECT,
DEFAULT_WATERMARK_TEXT);
private Object watermarkedObject;
/**
@@ -41,10 +40,12 @@
attributes = Attributes.getComponentAttributesFromClass(AbstractWatermark.class,
getClass());
attributes.setAttribute("for", "watermarked");
attributes.setAttribute("rendered", true);
- attributes.setAttribute("value", DEFAULT_WATERMARK_TEXT);
-// attributes.setAttribute("converter", converter);
+ attributes.setAttribute("value", "qwertyuiopasdfghjkl");
+
attributes.remove("suffix");
attributes.remove("title");
+ attributes.remove("valid");
+ attributes.remove("converter");
}
/**
Added:
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/converter/ConstantConverter.java
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/converter/ConstantConverter.java
(rev 0)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/java/org/richfaces/tests/metamer/converter/ConstantConverter.java 2011-07-20
12:18:32 UTC (rev 22559)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.apache.commons.lang.Validate;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class ConstantConverter implements Converter {
+
+ public static final Object DEFAULT_OBJECT = "converted as object";
+ public static final String DEFAULT_STRING = "converted as string";
+
+ private Object object;
+ private String string;
+
+ public ConstantConverter() {
+ this(DEFAULT_OBJECT, DEFAULT_STRING);
+ }
+
+ public ConstantConverter(Object object, String string) {
+ Validate.notNull(object);
+ Validate.notNull(string);
+ this.object = object;
+ this.string = string;
+ }
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+ return object;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value)
{
+ return string;
+ }
+
+}
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputSecret.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -31,15 +31,21 @@
<ui:define name="component">
<h:form>
- <h:inputSecret id="watermarked">
+ <h:inputSecret id="watermarked"
value="#{watermarkBean.watermarkedObject}">
<a4j:ajax event="change" execute="@form"
render="output"/>
</h:inputSecret>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
-
title="#{watermarkBean.attributes['title'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputText.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -31,15 +31,21 @@
<ui:define name="component">
<h:form>
- <h:inputText id="watermarked">
+ <h:inputText id="watermarked"
value="#{watermarkBean.watermarkedObject}">
<a4j:ajax event="change" execute="@form"
render="output"/>
</h:inputText>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
-
title="#{watermarkBean.attributes['title'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/hInputTextArea.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -31,15 +31,21 @@
<ui:define name="component">
<h:form>
- <h:inputTextarea id="watermarked">
+ <h:inputTextarea id="watermarked"
value="#{watermarkBean.watermarkedObject}">
<a4j:ajax event="change" execute="@form"
render="output"/>
</h:inputTextarea>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
-
title="#{watermarkBean.attributes['title'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richAutocomplete.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -34,17 +34,24 @@
<rich:autocomplete
autocompleteMethod="#{richAutocompleteBean.autocomplete}"
id="watermarked"
+ value="#{watermarkBean.watermarkedObject}"
<a4j:ajax event="change"
execute="@form" render="output"/>
</rich:autocomplete>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
suffix="Input"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
-
title="#{watermarkBean.attributes['title'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richCalendar.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -32,16 +32,26 @@
<ui:define name="component">
<h:form>
- <rich:calendar id="watermarked"
enableManualInput="true">
+ <rich:calendar enableManualInput="true"
+ id="watermarked"
+ value="#{watermarkBean.watermarkedObject}"
+ >
<a4j:ajax event="change" execute="@form"
render="output"/>
</rich:calendar>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
suffix="InputDate"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">
Modified:
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml
===================================================================
---
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml 2011-07-20
12:09:46 UTC (rev 22558)
+++
modules/tests/metamer/branches/sandbox-components/application/src/main/webapp/components/watermark/richSelect.xhtml 2011-07-20
12:18:32 UTC (rev 22559)
@@ -32,18 +32,27 @@
<ui:define name="component">
<h:form>
- <rich:select id="watermarked"
enableManualInput="true">
+ <rich:select enableManualInput="true"
+ id="watermarked"
+ value="#{watermarkBean.watermarkedObject}"
+ >
<f:selectItems value="#{richSelectBean.capitalsOptions}"
/>
<a4j:ajax event="change" execute="@form"
render="output"/>
</rich:select>
- <watermark:watermark
converter="#{watermarkBean.attributes['converter'].value}"
+ <watermark:watermark converter="#{watermarkBean.converter}"
+
converterMessage="#{watermarkBean.attributes['converterMessage'].value}"
for="#{watermarkBean.attributes['for'].value}"
+
immediate="#{watermarkBean.attributes['immediate'].value}"
rendered="#{watermarkBean.attributes['rendered'].value}"
+
required="#{watermarkBean.attributes['required'].value}"
+
requiredMessage="#{watermarkBean.attributes['requiredMessage'].value}"
suffix="Input"
+
validator="#{watermarkBean.attributes['validator'].value}"
+
validatorMessage="#{watermarkBean.attributes['validatorMessage'].value}"
value="#{watermarkBean.attributes['value'].value}"
-
title="#{watermarkBean.attributes['title'].value}"
+
valueChangeListener="#{watermarkBean.attributes['valueChangeListener'].value}"
/>
<a4j:outputPanel id="output" layout="block">