You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2005/05/12 02:45:15 UTC

svn commit: r169739 - in /myfaces/trunk: src/components/org/apache/myfaces/component/ src/components/org/apache/myfaces/component/html/ext/ src/components/org/apache/myfaces/custom/inputHtml/ tlds/entities/

Author: svieujot
Date: Wed May 11 17:45:14 2005
New Revision: 169739

URL: http://svn.apache.org/viewcvs?rev=169739&view=rev
Log:
Add displayValueOnlyStyle & displayValueOnlyStyleClass.

Modified:
    myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java
    myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.java
    myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.xml
    myfaces/trunk/src/components/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java
    myfaces/trunk/tlds/entities/display_value_only_attributes.xml

Modified: myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java?rev=169739&r1=169738&r2=169739&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java Wed May 11 17:45:14 2005
@@ -28,4 +28,10 @@
 {
     public boolean isDisplayValueOnly();
     public void setDisplayValueOnly(boolean displayValueOnly);
+	
+    public String getDisplayValueOnlyStyle();
+    public void setDisplayValueOnlyStyle(String style);
+	
+    public String getDisplayValueOnlyStyleClass();
+    public void setDisplayValueOnlyStyleClass(String styleClass);
 }

Modified: myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.java?rev=169739&r1=169738&r2=169739&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.java (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.java Wed May 11 17:45:14 2005
@@ -51,6 +51,8 @@
     private String _enabledOnUserRole = null;
     private String _visibleOnUserRole = null;
 	private Boolean _displayValueOnly = null;
+	private String _displayValueOnlyStyle = null;
+	private String _displayValueOnlyStyleClass = null;
 
     public HtmlInputText()
     {
@@ -100,13 +102,39 @@
         return v != null ? v.booleanValue() : DEFAULT_DISPLAYVALUEONLY;
     }
 
+    public void setDisplayValueOnlyStyle(String displayValueOnlyStyle)
+    {
+		_displayValueOnlyStyle = displayValueOnlyStyle;
+    }
+
+    public String getDisplayValueOnlyStyle()
+    {
+        if (_displayValueOnlyStyle != null) return _displayValueOnlyStyle;
+        ValueBinding vb = getValueBinding("displayValueOnlyStyle");
+        return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+    }
+	
+    public void setDisplayValueOnlyStyleClass(String displayValueOnlyStyleClass)
+    {
+		_displayValueOnlyStyleClass = displayValueOnlyStyleClass;
+    }
+
+    public String getDisplayValueOnlyStyleClass()
+    {
+        if (_displayValueOnlyStyleClass != null) return _displayValueOnlyStyleClass;
+        ValueBinding vb = getValueBinding("displayValueOnlyStyleClass");
+        return vb != null ? (String)vb.getValue(getFacesContext()) : null;
+    }
+
     public Object saveState(FacesContext context)
     {
-        Object values[] = new Object[4];
+        Object values[] = new Object[6];
         values[0] = super.saveState(context);
         values[1] = _enabledOnUserRole;
         values[2] = _visibleOnUserRole;
 		values[3] = _displayValueOnly;
+		values[4] = _displayValueOnlyStyle;
+		values[5] = _displayValueOnlyStyleClass;
         return values;
     }
 
@@ -117,6 +145,8 @@
         _enabledOnUserRole = (String)values[1];
         _visibleOnUserRole = (String)values[2];
 		_displayValueOnly = (Boolean)values[3];
+		_displayValueOnlyStyle = (String)values[4];
+		_displayValueOnlyStyleClass = (String)values[5];
     }
     //------------------ GENERATED CODE END ---------------------------------------
 }

Modified: myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.xml
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.xml?rev=169739&r1=169738&r2=169739&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.xml (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/component/html/ext/HtmlInputText.xml Wed May 11 17:45:14 2005
@@ -19,4 +19,12 @@
         <type>boolean</type>
         <default-value>false</default-value>
     </field>
+	<field>
+        <name>displayValueOnlyStyle</name>
+        <type>java.lang.String</type>
+    </field>
+	<field>
+        <name>displayValueOnlyStyleClass</name>
+        <type>java.lang.String</type>
+    </field>
 </component>

Modified: myfaces/trunk/src/components/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java?rev=169739&r1=169738&r2=169739&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java Wed May 11 17:45:14 2005
@@ -75,11 +75,10 @@
         writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
         HtmlRendererUtils.writeIdIfNecessary(writer, editor, context);
 
-		// TODO : Change to use displayValueOnlyStyle/StyleClass ?
-		if( editor.getStyle()!=null )
-            writer.writeAttribute(HTML.STYLE_ATTR, editor.getStyle(), null);
-		if( editor.getStyleClass()!=null )
-            writer.writeAttribute(HTML.STYLE_CLASS_ATTR, editor.getStyleClass(), null);
+		if( editor.getDisplayValueOnlyStyle()!=null )
+            writer.writeAttribute(HTML.STYLE_ATTR, editor.getDisplayValueOnlyStyle(), null);
+		if( editor.getDisplayValueOnlyStyleClass()!=null )
+            writer.writeAttribute(HTML.STYLE_CLASS_ATTR, editor.getDisplayValueOnlyStyleClass(), null);
 
         String text = RendererUtils.getStringValue(context, editor);
         writer.write( getHtmlBody( text ) );

Modified: myfaces/trunk/tlds/entities/display_value_only_attributes.xml
URL: http://svn.apache.org/viewcvs/myfaces/trunk/tlds/entities/display_value_only_attributes.xml?rev=169739&r1=169738&r2=169739&view=diff
==============================================================================
--- myfaces/trunk/tlds/entities/display_value_only_attributes.xml (original)
+++ myfaces/trunk/tlds/entities/display_value_only_attributes.xml Wed May 11 17:45:14 2005
@@ -8,3 +8,19 @@
                 Default is false.
             </description>
         </attribute>
+        <attribute>
+            <name>displayValueOnlyStyle</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+            <description>
+                Style used when displayValueOnly is true.
+            </description>
+        </attribute>
+        <attribute>
+            <name>displayValueOnlyStyleClass</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+            <description>
+                Style class used when displayValueOnly is true.
+            </description>
+        </attribute>        
\ No newline at end of file