svn commit: r707800 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/html/HtmlScreenRenderer.java src/org/ofbiz/widget/screen/ModelScreenWidget.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r707800 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/html/HtmlScreenRenderer.java src/org/ofbiz/widget/screen/ModelScreenWidget.java

bibryam
Author: bibryam
Date: Fri Oct 24 17:42:11 2008
New Revision: 707800

URL: http://svn.apache.org/viewvc?rev=707800&view=rev
Log:
A patch from Dimitri Unruh "Generate alt-attribute in the image element" - OFBIZ-1954

Modified:
    ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java

Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=707800&r1=707799&r2=707800&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Fri Oct 24 17:42:11 2008
@@ -796,6 +796,7 @@
         <xs:attribute type="xs:string" name="width"/>
         <xs:attribute type="xs:string" name="height"/>
         <xs:attribute type="xs:string" name="border"/>
+        <xs:attribute type="xs:string" name="alt"/>        
         <xs:attribute name="url-mode" default="content">
             <xs:simpleType>
                 <xs:restriction base="xs:token">

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=707800&r1=707799&r2=707800&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Fri Oct 24 17:42:11 2008
@@ -568,6 +568,13 @@
             writer.append(border);
             writer.append("\"");
         }
+        String alt = image.getAlt(context);
+        if (UtilValidate.isNotEmpty(alt)) {
+            writer.append(" alt=\"");
+            writer.append(alt);
+            writer.append("\"");
+        }
+        
         writer.append(" src=\"");
         String urlMode = image.getUrlMode();
         boolean fullPath = false;

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=707800&r1=707799&r2=707800&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Fri Oct 24 17:42:11 2008
@@ -1435,6 +1435,7 @@
         protected FlexibleStringExpander widthExdr;
         protected FlexibleStringExpander heightExdr;
         protected FlexibleStringExpander borderExdr;
+        protected FlexibleStringExpander alt;
         protected String urlMode = "content";
 
         public Image(ModelScreen modelScreen, Element imageElement) {
@@ -1444,8 +1445,9 @@
             setId(imageElement.getAttribute("id"));
             setStyle(imageElement.getAttribute("style"));
             setWidth(imageElement.getAttribute("width"));
-            setHeight(imageElement.getAttribute("height"));
-            setBorder(UtilFormatOut.checkEmpty(imageElement.getAttribute("border"), "0"));
+            setHeight(imageElement.getAttribute("height"));            
+            setBorder(imageElement.getAttribute("border"));
+            setAlt(imageElement.getAttribute("alt"));
             setUrlMode(UtilFormatOut.checkEmpty(imageElement.getAttribute("url-mode"), "content"));
         }
 
@@ -1483,6 +1485,10 @@
             return this.borderExdr.expandString(context);
         }
         
+        public String getAlt(Map<String, Object> context) {
+            return this.alt.expandString(context);
+        }
+                
         public String getUrlMode() {
             return this.urlMode;
         }
@@ -1506,6 +1512,11 @@
         public void setBorder(String val) {
             this.borderExdr = FlexibleStringExpander.getInstance(val);
         }
+        public void setAlt(String val) {
+            String altAttr = UtilFormatOut.checkNull(val);
+            this.alt = FlexibleStringExpander.getInstance(altAttr);
+        }
+        
         public void setUrlMode(String val) {
             if (UtilValidate.isEmpty(val)) {
                 this.urlMode = "content";