Commit 972d686ac7e5b0217f347e4d8cd04ad01059dbc2
1 parent
f7d45ddf
Added styleClass property to watermark component.
Showing
4 changed files
with
11 additions
and
26 deletions
| @@ -24,14 +24,14 @@ | @@ -24,14 +24,14 @@ | ||
| 24 | <taghandler generate="true"> | 24 | <taghandler generate="true"> | 
| 25 | <classname>org.richfaces.taglib.WatermarkTagHandler</classname> | 25 | <classname>org.richfaces.taglib.WatermarkTagHandler</classname> | 
| 26 | <superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass> | 26 | <superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass> | 
| 27 | - </taghandler> &ui_output_attributes; | 27 | + </taghandler> | 
| 28 | + &ui_output_attributes; | ||
| 28 | <property> | 29 | <property> | 
| 29 | - <name>for</name> | 30 | + <name>styleClass</name> | 
| 30 | <classname>java.lang.String</classname> | 31 | <classname>java.lang.String</classname> | 
| 31 | - <description> | ||
| 32 | - Id of component that should be focused | 32 | + <description>Assigns one or more CSS class names to the component. Corresponds to the HTML "class" | 
| 33 | + attribute. | ||
| 33 | </description> | 34 | </description> | 
| 34 | - <defaultvalue>""</defaultvalue> | ||
| 35 | </property> | 35 | </property> | 
| 36 | </component> | 36 | </component> | 
| 37 | </components> | 37 | </components> | 
| @@ -7,8 +7,8 @@ public abstract class UIWatermark extends UIOutput { | @@ -7,8 +7,8 @@ public abstract class UIWatermark extends UIOutput { | ||
| 7 | public static final String COMPONENT_TYPE = "org.richfaces.Watermark"; | 7 | public static final String COMPONENT_TYPE = "org.richfaces.Watermark"; | 
| 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Watermark"; | 8 | public static final String COMPONENT_FAMILY = "org.richfaces.Watermark"; | 
| 9 | 9 | ||
| 10 | - public abstract String getFor(); | 10 | + public abstract String getStyleClass(); | 
| 11 | 11 | ||
| 12 | - public abstract void setFor(String value); | 12 | + public abstract void setStyleClass(String styleClass); | 
| 13 | 13 | ||
| 14 | } | 14 | } | 
| 1 | if (window.RichFaces == null) { | 1 | if (window.RichFaces == null) { | 
| 2 | window.RichFaces = {}; | 2 | window.RichFaces = {}; | 
| 3 | } | 3 | } | 
| 4 | -RichFaces.Watermark = function(targetId, text) { | 4 | +RichFaces.Watermark = function(targetId, text, options) { | 
| 5 | jQuery(function() { | 5 | jQuery(function() { | 
| 6 | - jQuery(document.getElementById(targetId)).watermark(text); | 6 | + jQuery(document.getElementById(targetId)).watermark(text, options); | 
| 7 | }); | 7 | }); | 
| 8 | }; | 8 | }; | 
| @@ -19,27 +19,12 @@ | @@ -19,27 +19,12 @@ | ||
| 19 | 19 | ||
| 20 | <jsp:scriptlet> | 20 | <jsp:scriptlet> | 
| 21 | <![CDATA[ | 21 | <![CDATA[ | 
| 22 | - String sid = (String) component.getAttributes().get("for"); | ||
| 23 | - String target; | ||
| 24 | - if (sid != null && ! "".equals(sid)) { | ||
| 25 | - try { | ||
| 26 | - UIComponent forcomp = getUtils().findComponentFor((UIComponent)component,sid); | ||
| 27 | - if (forcomp != null) { | ||
| 28 | - target = forcomp.getClientId(context); | ||
| 29 | - } else { | ||
| 30 | - target = sid; | ||
| 31 | - } | ||
| 32 | - }catch(IllegalArgumentException e) { | ||
| 33 | - target = sid; | ||
| 34 | - } | ||
| 35 | - } else { | ||
| 36 | - target = component.getParent().getClientId(context); | ||
| 37 | - } | 22 | + String target = getUtils().clientId(context,component.getParent()); | 
| 38 | variables.setVariable("for",target); | 23 | variables.setVariable("for",target); | 
| 39 | ]]> | 24 | ]]> | 
| 40 | </jsp:scriptlet> | 25 | </jsp:scriptlet> | 
| 41 | 26 | ||
| 42 | <script type="text/javascript" id="#{clientId}"> | 27 | <script type="text/javascript" id="#{clientId}"> | 
| 43 | - RichFaces.Watermark('#{for}', '#{component.attributes["value"]}'); | 28 | + RichFaces.Watermark('#{for}', '#{component.attributes["value"]}', {className:'#{component.attributes["styleClass"]}'}); | 
| 44 | </script> | 29 | </script> | 
| 45 | </f:root> | 30 | </f:root> | 
Please
register
or
login
to post a comment