You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by he...@apache.org on 2006/06/02 17:32:18 UTC

svn commit: r411190 - in /myfaces/tobago/trunk: example/demo/src/main/webapp/overview/ src/site/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ theme/scarborough/src/main/resources/org/apache/myfaces/...

Author: hennes
Date: Fri Jun  2 08:32:16 2006
New Revision: 411190

URL: http://svn.apache.org/viewvc?rev=411190&view=rev
Log:
fixed png fix. is now javaScript based. css version did not work correctly.

Added:
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
Removed:
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/png-fix.htc
Modified:
    myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basicControls.jsp
    myfaces/tobago/trunk/src/site/site.xml
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basicControls.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basicControls.jsp?rev=411190&r1=411189&r2=411190&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basicControls.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basicControls.jsp Fri Jun  2 08:32:16 2006
@@ -95,9 +95,7 @@
         <tc:link id="link" action="overview/basicControls"
             actionListener="#{overviewController.click}"
             label="#{overviewBundle.basic_linkAction}" />
-        <tc:link id="image" action="overview/basicControls"
-            actionListener="#{overviewController.click}"
-            image="image/image_button.gif" />
+        <tc:image id="image" value="image/image_button.png"  />
         <tc:button id="button" action="overview/basicControls"
             actionListener="#{overviewController.click}"
             width="100px"  label="#{overviewBundle.basic_buttonAction}" />

Modified: myfaces/tobago/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/src/site/site.xml?rev=411190&r1=411189&r2=411190&view=diff
==============================================================================
--- myfaces/tobago/trunk/src/site/site.xml (original)
+++ myfaces/tobago/trunk/src/site/site.xml Fri Jun  2 08:32:16 2006
@@ -11,7 +11,6 @@
     <href>http://myfaces.apache.org/tobago</href>
   </bannerRight>
   <body>
-
     <links>
       <item name="Apache" href="http://www.apache.org/"/>
       <item name="MyFaces" href="http://myfaces.apache.org/"/>

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=411190&r1=411189&r2=411190&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Fri Jun  2 08:32:16 2006
@@ -272,7 +272,11 @@
     writer.writeComponentClass();
     writer.writeIdAttribute(clientId);
 
-    if (debugMode) {
+    String blank = ResourceManagerUtil.getImageWithPath(facesContext, "image/blank.gif");
+
+    HtmlRendererUtil.writeJavascript(writer, "Tobago.pngFixBlankImage = \"" + blank + "\";");
+
+      if (debugMode) {
       final String[] jsFiles = new String[] {
           "script/effects.js",
           "script/dragdrop.js",

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css?rev=411190&r1=411189&r2=411190&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/style.css Fri Jun  2 08:32:16 2006
@@ -93,8 +93,4 @@
 
 a:link.tobago-toolBar-button-link, a:visited.tobago-toolBar-button-link, a:active.tobago-toolBar-button-link {
    color: #000000;
-}
-
-img {
-  behavior: url("png-fix.htc");
-}
+}
\ No newline at end of file

Added: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js?rev=411190&view=auto
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js (added)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js Fri Jun  2 08:32:16 2006
@@ -0,0 +1,63 @@
+Tobago.loadPngFix= function() {
+
+    var images = document.getElementsByTagName("img");
+    var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
+
+    if (! supported)  {
+      return;
+    }
+
+    for (i = 0; i < images.length; i++) {
+
+      var image = images[i];
+
+      fixImage(image);
+      Tobago.addEventListener(image, 'propertyChanged', propertyChanged);
+    }
+  }
+
+  function propertyChanged() {
+
+     var pName = event.propertyName;
+     if (pName != "src") return;
+     // if not set to blank
+     if ( ! new RegExp(Tobago.pngFixBlankImage).test(src))  {
+        fixImage(this);
+     }
+  }
+
+  function fixImage(element) {
+     // get src
+     var src = element.src;
+     // check for real change
+
+     if (src == element.realSrc) {
+        element.src = Tobago.pngFixBlankImage;
+        return;
+     }
+
+     if ( ! new RegExp(Tobago.pngFixBlankImage).test(src)) {
+        // backup old src
+        element.realSrc = src;
+     }
+
+     // test for png
+     if ( /\.png$/.test( element.realSrc.toLowerCase() ) ) {
+       // get width and height of old src
+       var origWidth = element.clientWidth;
+       var origHeight = element.clientHeight;
+
+        // set blank image
+        element.src = Tobago.pngFixBlankImage;
+        // set filter
+
+        element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
+                                       src + "',sizingMethod='scale')";
+        element.style.width = origWidth + 'px';
+        element.style.height = origHeight + 'px';
+
+     } else {
+        // remove filter
+        element.runtimeStyle.filter = "";
+     }
+  }
\ No newline at end of file

Modified: myfaces/tobago/trunk/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/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=411190&r1=411189&r2=411190&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Jun  2 08:32:16 2006
@@ -220,6 +220,7 @@
     }
     TbgTimer.endAppOnload = new Date();
 
+    this.loadPngFix();
     this.setFocus();
 
     this.addBindEventListener(document, "keypress", this.acceleratorKeys, "observe");
@@ -1153,6 +1154,9 @@
       target[property] = source[property];
     }
     return target;
+  },
+
+  loadPngFix: function() {
   }
 };