Author: dolander
Date: Tue Mar  8 13:44:56 2005
New Revision: 156571

URL: http://svn.apache.org/viewcvs?view=rev&rev=156571
Log:
TODO Cleanup
remove the special onmouseover/onmouseout fields from the ImageTag renderer.
Move the renderAttribute method out of the AbstractClassicTag to the single 
place it is used (Section)



Modified:
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ImageAnchor.java
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/ImageTag.java
    
incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Section.java

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java?view=diff&r1=156570&r2=156571
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/AbstractClassicTag.java
 Tue Mar  8 13:44:56 2005
@@ -65,7 +65,6 @@
 public abstract class AbstractClassicTag
         extends BodyTagSupport implements INetuiTag
 {
-    //@todo: how should we handle errors messages from third party tags?
     //@todo: need to implement the flag to turn errors into JSP exceptions
 
     private static final Logger logger = 
Logger.getInstance(AbstractClassicTag.class);
@@ -148,26 +147,6 @@
             logger.error(Bundle.getString("Tags_WriteException"), e);
             RequestUtils.saveException((PageContext) pageContext, e);
         }
-    }
-
-    /**
-     * This method will write append an attribute value to a StringBuilder.
-     * The method assumes that the attr is not <code>null</code>.  If the
-     * value is <code>null</code> the attribute will not be appended to the
-     * <code>StringBuilder</code>.
-     */
-    protected final void renderAttribute(StringBuilder buf, String name,
-                                         String value)
-    {
-        assert (name != null);
-        if (value == null)
-            return;
-
-        buf.append(" ");
-        buf.append(name);
-        buf.append("=\"");
-        buf.append(value);
-        buf.append("\"");
     }
 
     ///////////////////////////  Naming and NamingInterceptor support 
////////////////////////////

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ImageAnchor.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ImageAnchor.java?view=diff&r1=156570&r2=156571
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ImageAnchor.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/ImageAnchor.java
 Tue Mar  8 13:44:56 2005
@@ -433,10 +433,12 @@
             }
 
             if (getJavaScriptAttribute(ONMOUSEOUT) == null) {
-                _imgState.onmouseout = "swapImage(this,'" + 
response.encodeURL(_imgState.src) + "')";
+                String s = "swapImage(this,'" + 
response.encodeURL(_imgState.src) + "')";
+                _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, 
ONMOUSEOUT, s);
             }
             if (getJavaScriptAttribute(ONMOUSEOVER) == null) {
-                _imgState.onmouseover = "swapImage(this,'" + 
response.encodeURL(_rolloverImage) + "')";
+                String s = "swapImage(this,'" + 
response.encodeURL(_rolloverImage) + "')";
+                _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, 
ONMOUSEOVER, s);
             }
         }
 

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/ImageTag.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/ImageTag.java?view=diff&r1=156570&r2=156571
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/ImageTag.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/ImageTag.java
 Tue Mar  8 13:44:56 2005
@@ -27,7 +27,6 @@
  */
 abstract public class ImageTag extends TagHtmlBase implements HtmlConstants
 {
-    // @todo: need to remove onmouseover and onmouseout
     public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml)
     {
         html.put(IMAGE_TAG, new HtmlRendering());
@@ -38,16 +37,12 @@
     public static class State extends AbstractHtmlState
     {
         public String src;
-        public String onmouseover;
-        public String onmouseout;
 
         public void clear()
         {
             super.clear();
 
             src = null;
-            onmouseover = null;
-            onmouseout = null;
         }
     }
 
@@ -67,8 +62,6 @@
         renderAttribute(sb, CLASS, state.styleClass);
         renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
         renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
-        renderAttribute(sb, ONMOUSEOUT, state.onmouseout);
-        renderAttribute(sb, ONMOUSEOVER, state.onmouseover);
 
         writeEnd(sb);
     }

Modified: 
incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Section.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Section.java?view=diff&r1=156570&r2=156571
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Section.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-template/org/apache/beehive/netui/tags/template/Section.java
 Tue Mar  8 13:44:56 2005
@@ -341,6 +341,25 @@
         return idScript;
     }
 
+    /**
+     * This method will write append an attribute value to a StringBuilder.
+     * The method assumes that the attr is not <code>null</code>.  If the
+     * value is <code>null</code> the attribute will not be appended to the
+     * <code>StringBuilder</code>.
+     */
+    private void renderAttribute(StringBuilder buf, String name, String value)
+    {
+        assert (name != null);
+        if (value == null)
+            return;
+
+        buf.append(" ");
+        buf.append(name);
+        buf.append("=\"");
+        buf.append(value);
+        buf.append("\"");
+    }
+
     private String mapLegacyTagId(String tagId, String value)
     {
         // @todo: this is sort of broken, it needs to be updated


Reply via email to