From e9836c4e879ce7f45d5e83cb1b2eade07ce1c587 Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Fri, 25 Feb 2011 08:02:27 +0000 Subject: [PATCH] Added "for" and "suffix" attributes to watermark component. --- src/main/config/component/watermark.xml | 32 +++++++++++++++++++++++++++++++- src/main/java/org/richfaces/component/UIWatermark.java | 13 ++++++++++++- src/main/templates/htmlWatermark.jspx | 21 ++++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/main/config/component/watermark.xml b/src/main/config/component/watermark.xml index e54a7da..12cf919 100755 --- a/src/main/config/component/watermark.xml +++ b/src/main/config/component/watermark.xml @@ -8,7 +8,12 @@ org.richfaces.component.html.HtmlWatermark org.richfaces.component.UIWatermark - + org.richfaces.component.renderkit.html.WatermarkRenderer @@ -33,5 +38,30 @@ attribute. + + suffix + java.lang.String + + Use this if watermark should be attached to element with id different then component id. + i.e.: rich:comboBox with id="combo" nested in form with id="f" renders input with + clientId="f:combocomboboxField" + So in order to attach watermark to that element provide suffix="comboboxField". + + + + for + java.lang.String + + Use this if watermark cannot be nested within come components i.e. in calendar. + + Example 1: rich:calendar with id="c" nested in form with id="f" renders input with + clientId="f:cInputDate". + rich:calendar also gets messed up if watermark is nested within, so place it outside of calendar. + So in order to attach watermark to that element provide for="c" suffix="InputDate". + + Example 2: watermark should be attached to pure html input (not jsf component) with id="htmlInput". + To achieve this provide for="htmlInput". + + diff --git a/src/main/java/org/richfaces/component/UIWatermark.java b/src/main/java/org/richfaces/component/UIWatermark.java index 566e172..b103036 100755 --- a/src/main/java/org/richfaces/component/UIWatermark.java +++ b/src/main/java/org/richfaces/component/UIWatermark.java @@ -3,12 +3,23 @@ package org.richfaces.component; import javax.faces.component.UIOutput; public abstract class UIWatermark extends UIOutput { +// ------------------------------ FIELDS ------------------------------ - public static final String COMPONENT_TYPE = "org.richfaces.Watermark"; public static final String COMPONENT_FAMILY = "org.richfaces.Watermark"; + public static final String COMPONENT_TYPE = "org.richfaces.Watermark"; + +// -------------------------- OTHER METHODS -------------------------- + + public abstract String getFor(); + public abstract String getStyleClass(); + public abstract String getSuffix(); + + public abstract void setFor(String _for); + public abstract void setStyleClass(String styleClass); + public abstract void setSuffix(String suffix); } diff --git a/src/main/templates/htmlWatermark.jspx b/src/main/templates/htmlWatermark.jspx index 7b679a7..d704df6 100755 --- a/src/main/templates/htmlWatermark.jspx +++ b/src/main/templates/htmlWatermark.jspx @@ -19,7 +19,26 @@ -- libgit2 0.24.0