You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/05/31 20:43:52 UTC

svn commit: r949830 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ tobago-example/tobago-example-test/src/main/webapp/ tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/componen...

Author: lofwyr
Date: Mon May 31 18:43:52 2010
New Revision: 949830

URL: http://svn.apache.org/viewvc?rev=949830&view=rev
Log:
TOBAGO-881: Make ToolBar work with new LayoutManager
 - implement the hover style effects
 - clean up

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-pointHover.jpg
      - copied, changed from r948367, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-point.jpg
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
    myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
    myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Mon May 31 18:43:52 2010
@@ -17,12 +17,6 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-/*
- * Created by IntelliJ IDEA.
- * User: bommel
- * Date: Sep 23, 2006
- * Time: 10:01:48 AM
- */
 public final class HtmlAttributes {
   public static final String STYLE = "style";
   public static final String TYPE = "type";
@@ -75,5 +69,16 @@ public final class HtmlAttributes {
   public static final String LABEL = "label";
   public static final String TABINDEX = "tabindex";
   public static final String FRAMEBORDER = "frameborder";
+
+  // Non standard attributes ///////////////////////////////////////////////////////////
+
+  /**
+   * Alternate to the src attribute, to implement a hover effect.
+   */
+  public static final String SRCHOVER = "srchover";
+  /**
+   * Alternate to the src attribute, to implement a hover effect.
+   */
+  public static final String SRCDEFAULT = "srcdefault";
 }
 

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-pointHover.jpg (from r948367, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-point.jpg)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-pointHover.jpg?p2=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-pointHover.jpg&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/pidgeon-point.jpg&r1=948367&r2=949830&rev=949830&view=diff
==============================================================================
Binary files - no diff available.

Modified: myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Mon May 31 18:43:52 2010
@@ -19,6 +19,7 @@ package org.apache.myfaces.tobago.compon
 
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
+import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -215,8 +216,12 @@ public class ComponentUtil {
     return ComponentUtils.getFirstGraphicChild(component);
   }
 
-  public static boolean isHoverEnabled(UIComponent component) {
-    return ComponentUtils.isHoverEnabled(component);
+/**
+ * @deprecated
+ */
+@Deprecated  public static boolean isHoverEnabled(UIComponent component) {
+  Deprecation.LOG.error("no longer supported");
+  return ComponentUtils.getBooleanAttribute(component, Attributes.HOVER);
   }
 
   public static UIOutput getFirstNonGraphicChild(UIComponent component) {

Modified: myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java Mon May 31 18:43:52 2010
@@ -18,8 +18,6 @@ package org.apache.myfaces.tobago.render
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.SupportsMarkup;
 import org.apache.myfaces.tobago.component.UICommand;
@@ -38,6 +36,8 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
@@ -371,25 +371,12 @@ public final class HtmlRendererUtil {
   }
 
   /**
-   * @deprecated Please use HtmlRendererUtils
+   * @deprecated
    */
   @Deprecated
   public static void addImageSources(FacesContext facesContext, TobagoResponseWriter writer, String src, String id)
       throws IOException {
-    writer.startJavascript();
-    writer.write("new Tobago.Image('");
-    writer.write(id);
-    writer.write("','");
-    String img = ResourceManagerUtils.getImageWithPath(facesContext, src, false);
-    writer.write(img!=null?img:"");
-    writer.write("','");
-    String disabled = ResourceManagerUtils.getImageWithPath(facesContext, createSrc(src, "Disabled"), true);
-    writer.write(disabled!=null?disabled:"");
-    writer.write("','");
-    String hover = ResourceManagerUtils.getImageWithPath(facesContext, createSrc(src, "Hover"), true);
-    writer.write(hover!=null?hover:"");
-    writer.write("');");
-    writer.endJavascript();
+    Deprecation.LOG.error("using deprecated API");
   }
 
   /**

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java Mon May 31 18:43:52 2010
@@ -22,19 +22,18 @@ package org.apache.myfaces.tobago.render
  * $Id$
  */
 
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UICommand;
 import org.apache.myfaces.tobago.component.UIImage;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -65,14 +64,12 @@ public class ImageRenderer extends Layou
       } else {
         src = null;
         if (isDisabled(image)) {
-          src = ResourceManagerUtils.getImageWithPath(
-              facesContext, HtmlRendererUtils.createSrc(value, "Disabled"), true);
+          src = ResourceManagerUtils.getImageWithPath(facesContext,
+              HtmlRendererUtils.createSrc(value, "Disabled"), true);
         }
         if (src == null) {
           src = ResourceManagerUtils.getImageWithPath(facesContext, value);
         }
-        HtmlRendererUtils.addImageSources(facesContext, writer, image.getUrl(),
-            image.getClientId(facesContext));
       }
     }
 
@@ -88,12 +85,6 @@ public class ImageRenderer extends Layou
     writer.startElement(HtmlConstants.IMG, image);
     final String clientId = image.getClientId(facesContext);
     writer.writeIdAttribute(clientId);
-    if (ComponentUtils.isHoverEnabled(image) && !isDisabled(image)) {
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
-          "Tobago.imageMouseover('" + clientId + "')", false);
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
-          "Tobago.imageMouseout('" + clientId + "')", false);
-    }
     if (src != null) {
       writer.writeAttribute(HtmlAttributes.SRC, src, true);
     }
@@ -105,8 +96,6 @@ public class ImageRenderer extends Layou
     HtmlRendererUtils.renderDojoDndItem(image, writer, true);
     writer.writeClassAttribute();
     writer.endElement(HtmlConstants.IMG);
-
-
   }
 
   private String createSrc(String src, String ext) {

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java Mon May 31 18:43:52 2010
@@ -22,11 +22,9 @@ package org.apache.myfaces.tobago.render
  * $Id$
  */
 
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UITime;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.internal.util.DateFormatUtils;
 import org.apache.myfaces.tobago.renderkit.InputRendererBase;
@@ -38,6 +36,8 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -133,7 +133,6 @@ public class TimeRenderer extends InputR
 
     String imageId = idPrefix + "inc";
     String imageSrc = "image/timeIncrement.gif";
-    HtmlRendererUtils.addImageSources(facesContext, writer, imageSrc, imageId);
     writer.startElement(HtmlConstants.IMG, null);
     writer.writeIdAttribute(imageId);
     writer.writeClassAttribute("tobago-time-inc-image"
@@ -144,16 +143,11 @@ public class TimeRenderer extends InputR
     if (!(ComponentUtils.getBooleanAttribute(input, Attributes.DISABLED)
         || ComponentUtils.getBooleanAttribute(input, Attributes.READONLY))) {
       writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgIncTime(this)", false);
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
-          "Tobago.imageMouseover('" + imageId + "')", null);
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
-          "Tobago.imageMouseout('" + imageId + "')", null);
     }
     writer.endElement(HtmlConstants.IMG);
 
     imageId = idPrefix + "dec";
     imageSrc = "image/timeDecrement.gif";
-    HtmlRendererUtils.addImageSources(facesContext, writer, imageSrc, imageId);
     writer.startElement(HtmlConstants.IMG, null);
     writer.writeIdAttribute(imageId);
     writer.writeClassAttribute("tobago-time-dec-image"
@@ -163,10 +157,6 @@ public class TimeRenderer extends InputR
     if (!(ComponentUtils.getBooleanAttribute(input, Attributes.DISABLED)
         || ComponentUtils.getBooleanAttribute(input, Attributes.READONLY))) {
       writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgDecTime(this)", false);
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
-          "Tobago.imageMouseover('" + imageId + "')", null);
-      writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
-          "Tobago.imageMouseout('" + imageId + "')", null);
     }
     writer.endElement(HtmlConstants.IMG);
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Mon May 31 18:43:52 2010
@@ -223,13 +223,8 @@ public abstract class ToolBarRendererBas
     final String labelPosition = getLabelPosition(command.getParent());
     final String iconSize = getIconSize(command.getParent());
     final String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
-    final String image;
     final boolean lackImage = iconName == null;
-    if (lackImage) {
-      image = ResourceManagerUtils.getImageWithPath(facesContext, "image/1x1.gif");
-    } else {
-      image = getImage(facesContext, iconName, iconSize, disabled, selected);
-    }
+    final String image = lackImage ? null : getImage(facesContext, iconName, iconSize, disabled, selected);
     final String graphicId = clientId + ComponentUtils.SUB_SEPARATOR + "icon";
 
     final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
@@ -370,7 +365,6 @@ public abstract class ToolBarRendererBas
     writer.writeClassAttribute(itemClass);
     HtmlRendererUtils.renderTip(command, writer);
     writer.writeStyleAttribute(itemStyle);
-    writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
 
     writer.startElement(HtmlConstants.SPAN, command);
     writer.writeClassAttribute(
@@ -379,11 +373,15 @@ public abstract class ToolBarRendererBas
     writer.writeAttribute(HtmlAttributes.ONCLICK, commandClick != null ? commandClick : menuClick, true);
     // render icon
     if (showIcon && iconName != null) {
-      HtmlRendererUtils.addImageSources(facesContext, writer, iconName, graphicId);
       writer.startElement(HtmlConstants.IMG, command);
       writer.writeAttribute(HtmlAttributes.SRC, image, false);
+      String imageHover
+          = ResourceManagerUtils.getImageWithPath(facesContext, HtmlRendererUtils.createSrc(iconName, "Hover"), true);
+      if (imageHover != null) {
+        writer.writeAttribute(HtmlAttributes.SRCDEFAULT, image, false);
+        writer.writeAttribute(HtmlAttributes.SRCHOVER, imageHover, false);
+      }
       writer.writeAttribute(HtmlAttributes.ALT, label.getText(), true);
-//      writer.writeClassAttribute("tobago-toolBar-icon");
       writer.writeStyleAttribute(iconStyle);
       writer.endElement(HtmlConstants.IMG);
     }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Mon May 31 18:43:52 2010
@@ -18,15 +18,12 @@ package org.apache.myfaces.tobago.render
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.SupportsMarkup;
 import org.apache.myfaces.tobago.component.UICommand;
 import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.component.UISheet;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
 import org.apache.myfaces.tobago.internal.util.Deprecation;
@@ -36,8 +33,11 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
@@ -253,24 +253,6 @@ public final class HtmlRendererUtils {
     classes.addMarkupClass(component, rendererName);
   }
 
-  public static void addImageSources(FacesContext facesContext, TobagoResponseWriter writer, String src, String id)
-      throws IOException {
-    writer.startJavascript();
-    writer.write("new Tobago.Image('");
-    writer.write(id);
-    writer.write("','");
-    String img = ResourceManagerUtils.getImageWithPath(facesContext, src, false);
-    writer.write(img!=null?img:"");
-    writer.write("','");
-    String disabled = ResourceManagerUtils.getImageWithPath(facesContext, createSrc(src, "Disabled"), true);
-    writer.write(disabled!=null?disabled:"");
-    writer.write("','");
-    String hover = ResourceManagerUtils.getImageWithPath(facesContext, createSrc(src, "Hover"), true);
-    writer.write(hover!=null?hover:"");
-    writer.write("');");
-    writer.endJavascript();
-  }
-
   public static String createSrc(String src, String ext) {
     int dot = src.lastIndexOf('.');
     if (dot == -1) {

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=949830&r1=949829&r2=949830&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Mon May 31 18:43:52 2010
@@ -125,8 +125,6 @@ var Tobago = {
     return id;
   },
 
-  images: {},
-
   treeNodes: {},
 
   reloadTimer: {},
@@ -780,48 +778,6 @@ var Tobago = {
   },
 
   /**
-    * Mouseover function for images.
-    */
-  imageMouseover: function(id) {
-    var image = this.element(id);
-    if (image && this.images[id]) {
-      var hover = this.images[id].hover;
-      if (hover != '' && hover != image.src) {
-        image.src = hover;
-      }
-    }
-  },
-
-  /**
-    * Mouseout function for images.
-    */
-  imageMouseout: function(id) {
-    var image = this.element(id);
-    if (image && this.images[id]) {
-      var normal = this.images[id].normal;
-      if (normal != '' && normal != image.src) {
-        image.src = normal;
-      }
-    }
-  },
-
-  /**
-   * Mouseover function for toolbar buttons.
-   */
-  toolbarMousesover: function(element, className, imageId) {
-    this.addCssClass(element, className);
-    this.imageMouseover(imageId);
-  },
-
-  /**
-    * Mouseout function for toolbar buttons.
-    */
-  toolbarMousesout: function(element, className, imageId) {
-    this.removeCssClass(element, className);
-    this.imageMouseout(imageId);
-  },
-
-  /**
     * Focus function for toolbar buttons.
     *  IE only.
     */
@@ -1680,15 +1636,6 @@ var Tobago = {
   }
 };
 
-
-Tobago.Image = function(id, normal, disabled, hover) {
-  this.id = id;
-  this.normal = normal;
-  this.disabled = disabled;
-  this.hover = hover;
-  Tobago.images[id] = this;
-};
-
 Tobago.In = function(inId, required, cssPrefix, maxLength) {
   this.id = inId;
   this.required = required;
@@ -2444,19 +2391,39 @@ Tobago.Updater = {
 // -------- ToolBar ----------------------------------------------------
 // todo: namespace etc.
 
+// todo: what is with initialisation of elements which are loaded with AJAX?
 $(document).ready(function() {
-  $(".tobago-toolBar-item[disabled!=disabled]")
+  jQuery(".tobago-toolBar-item")
+      .not(".tobago-toolBar-item-disabled")
       .mouseenter(function() {
-    $(this).addClass("tobago-toolBar-item-hover");
+    jQuery(this).addClass("tobago-toolBar-item-hover");
   })
       .mouseleave(function() {
-    $(this).removeClass("tobago-toolBar-item-hover");
-  });
-  $(".tobago-toolBar-item[disabled!=disabled]").children(".tobago-toolBar-button, .tobago-toolBar-menu")
+    jQuery(this).removeClass("tobago-toolBar-item-hover");
+  })
+      .children(".tobago-toolBar-button, .tobago-toolBar-menu")
       .mouseenter(function() {
-    $(this).addClass("tobago-toolBar-button-hover");})
+    jQuery(this)
+        .addClass("tobago-toolBar-button-hover").children("img")
+        .each(function() {
+      // set the src to the hover src url.
+      var hover = jQuery(this).attr("srchover");
+      if (hover) {
+        jQuery(this).attr("src", hover);
+      }
+    });
+  })
       .mouseleave(function() {
-    $(this).removeClass("tobago-toolBar-button-hover");
+    jQuery(this)
+        .removeClass("tobago-toolBar-button-hover")
+        .children("img")
+        .each(function() {
+      // restore the original/normal src url.
+      var normal = jQuery(this).attr("srcdefault");
+      if (normal) {
+        jQuery(this).attr("src", normal);
+      }
+    });
   });
 });