[scales~mercurial:447] NPE fix

  • From: jasondlee@kenai.com
  • To: commits@scales.kenai.com
  • Subject: [scales~mercurial:447] NPE fix
  • Date: Sat, 17 Jul 2010 04:54:23 +0000

Project:    scales
Repository: mercurial
Revision:   447
Author:     jasondlee
Date:       2010-07-17 04:54:13 UTC
Link:       

Log Message:
------------
NPE fix
Update to YUI 2.8.1
Other minor fixes


Revisions:
----------
447


Modified Paths:
---------------
demo/src/main/webapp/dateselector.xhtml
demo/src/main/webapp/template.xhtml
main/src/main/java/com/sun/mojarra/scales/component/Captcha.java
main/src/main/java/com/sun/mojarra/scales/component/HtmlEditor.java
main/src/main/resources/META-INF/resources/scales/js/scales.js
pom.xml


Diffs:
------
diff -r 09a5821bb20d -r b20ddfbe9a02 demo/src/main/webapp/dateselector.xhtml
--- a/demo/src/main/webapp/dateselector.xhtml   Fri Mar 05 16:49:18 2010 -0600
+++ b/demo/src/main/webapp/dateselector.xhtml   Fri Jul 16 23:54:13 2010 -0500
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 
 <ui:composition xmlns="http://www.w3.org/1999/xhtml" ;
xmlns:ui="http://java.sun.com/jsf/facelets";
                 xmlns:h="http://java.sun.com/jsf/html" ;
xmlns:f="http://java.sun.com/jsf/core";

diff -r 09a5821bb20d -r b20ddfbe9a02 demo/src/main/webapp/template.xhtml
--- a/demo/src/main/webapp/template.xhtml       Fri Mar 05 16:49:18 2010 -0600
+++ b/demo/src/main/webapp/template.xhtml       Fri Jul 16 23:54:13 2010 -0500
@@ -92,5 +92,6 @@
             } catch(err) {
             }
         </script>
+        <h:outputStylesheet library="css" name="style.css" target="head" />
     </h:body>
 </html>

diff -r 09a5821bb20d -r b20ddfbe9a02 
main/src/main/java/com/sun/mojarra/scales/component/Captcha.java
--- a/main/src/main/java/com/sun/mojarra/scales/component/Captcha.java  Fri 
Mar 05 16:49:18 2010 -0600
+++ b/main/src/main/java/com/sun/mojarra/scales/component/Captcha.java  Fri 
Jul 16 23:54:13 2010 -0500
@@ -26,12 +26,17 @@
  */
 @FacesComponent("com.sun.mojarra.scales.Captcha")
 public class Captcha extends UIInput implements NamingContainer {
-    protected static final ImageCaptchaService captchaService = new 
DefaultManageableImageCaptchaService();
+    protected static final ImageCaptchaService captchaService;
 
     enum PropertyKeys {
 
     }
 
+    static {
+        System.setProperty("java.awt.headless", "true");
+        captchaService = new DefaultManageableImageCaptchaService();
+    }
+    
     @Override
     public String getFamily() {
         return UINamingContainer.COMPONENT_FAMILY;

diff -r 09a5821bb20d -r b20ddfbe9a02 
main/src/main/java/com/sun/mojarra/scales/component/HtmlEditor.java
--- a/main/src/main/java/com/sun/mojarra/scales/component/HtmlEditor.java     
  Fri Mar 05 16:49:18 2010 -0600
+++ b/main/src/main/java/com/sun/mojarra/scales/component/HtmlEditor.java     
  Fri Jul 16 23:54:13 2010 -0500
@@ -113,7 +113,8 @@
         writer.startElement("textarea", this);
         writer.writeAttribute("id", getClientId(context), "id");
         writer.writeAttribute("name", getClientId(context), "name");
-        writer.write((String)getValue());
+        Object value = getValue();
+        writer.write((value != null) ? (String)getValue() : "");
         writer.endElement("textarea");
         RenderingHelper.writeOnDomReady(writer, "scales.createEditor({" + 
buildConfig(context) + "});");
     }

diff -r 09a5821bb20d -r b20ddfbe9a02 
main/src/main/resources/META-INF/resources/scales/js/scales.js
--- a/main/src/main/resources/META-INF/resources/scales/js/scales.js    Fri 
Mar 05 16:49:18 2010 -0600
+++ b/main/src/main/resources/META-INF/resources/scales/js/scales.js    Fri 
Jul 16 23:54:13 2010 -0500
@@ -45,6 +45,7 @@
     
     var scales = {
         scalesPanels: new Array(),
+        scalesEditors: new Array(),
         scalesLayouts: new Array(),
         currentMaxZ: 1,
 
@@ -111,7 +112,10 @@
             var full = false,defaults = {};
 
             YAHOO.widget.Toolbar.prototype.STR_COLLAPSE = 'Full Screen Mode';
-            var editor = new YAHOO.widget.Editor(config.clientId, {height: 
config.height, width: config.width, dompath: config.domPath, handleSubmit: 
true, animate: config.animate});
+            var editor = new YAHOO.widget.Editor(config.clientId, 
+                {height: config.height, width: config.width, dompath: 
config.domPath, handleSubmit: true, animate: config.animate});
+            scales.scalesEditors[config.clientId] = editor;
+            /*
             editor.on('toolbarLoaded', function() {
                 editor.toolbar.on('toolbarCollapsed', function() {
                     //Cancel the default action
@@ -142,9 +146,14 @@
                 defaults.height = editor.get('height');
                 defaults.width = editor.get('width');
             });
+            */
             editor.render();
         },
 
+        getEditor: function(id) {
+            return scales.scalesEditors[id];
+        },
+
         createLayoutManager: function(clientId, fullPage, units) {
             var layout = null;
             if (fullPage === true) {
@@ -392,4 +401,4 @@
         } else newObj[i] = this[i]
     }
     return newObj;
-};
\ No newline at end of file
+};

diff -r 09a5821bb20d -r b20ddfbe9a02 pom.xml
--- a/pom.xml   Fri Mar 05 16:49:18 2010 -0600
+++ b/pom.xml   Fri Jul 16 23:54:13 2010 -0500
@@ -60,7 +60,7 @@
         <log4j.version>1.2.15</log4j.version>
         <logging.version>1.0.4</logging.version>
         <servlet.version>2.5</servlet.version>
-        <yui.version>2.8.0r4</yui.version>
+        <yui.version>2.8.1</yui.version>
     </properties>
 
     <dependencies>






[scales~mercurial:447] NPE fix

jasondlee 07/17/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close