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 2013/09/06 20:16:47 UTC

svn commit: r1520651 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets: ScriptHandler.java StyleHandler.java

Author: lofwyr
Date: Fri Sep  6 18:16:47 2013
New Revision: 1520651

URL: http://svn.apache.org/r1520651
Log:
remove unneeded logging

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java?rev=1520651&r1=1520650&r2=1520651&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java Fri Sep  6 18:16:47 2013
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.facelets;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.component.UIScript;
 
 import javax.faces.component.UIComponent;
@@ -37,7 +38,10 @@ public class ScriptHandler extends Compo
   public void onComponentCreated(FaceletContext context, UIComponent component, UIComponent parent) {
     final FaceletHandler next = getComponentConfig().getNextHandler();
     if (next instanceof TextHandler) {
-      ((UIScript) component).setScript(((TextHandler) next).getText(context));
+      final String script = ((TextHandler) next).getText(context);
+      if (StringUtils.isNotBlank(script)) {
+        ((UIScript) component).setScript(script);
+      }
     }
   }
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java?rev=1520651&r1=1520650&r2=1520651&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java Fri Sep  6 18:16:47 2013
@@ -19,9 +19,8 @@
 
 package org.apache.myfaces.tobago.facelets;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.component.UIStyle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.view.facelets.ComponentConfig;
@@ -32,25 +31,19 @@ import javax.faces.view.facelets.TextHan
 
 public class StyleHandler extends ComponentHandler {
 
-  private static final Logger LOG = LoggerFactory.getLogger(StyleHandler.class);
-
   public StyleHandler(ComponentConfig config) {
     super(config);
   }
 
   public void onComponentCreated(FaceletContext context, UIComponent component, UIComponent parent) {
 
-    StringBuilder content = new StringBuilder();
     final FaceletHandler next = getComponentConfig().getNextHandler();
     if (next instanceof TextHandler) {
-      content.append(((TextHandler) next).getText(context));
-    } else {
-      // TBD: is this okay, or is here something to do?
-      // on the other side, Script inside the page is deprecated.
-      LOG.warn("Not applied for handler: " + next.getClass().getName());
+      final String style = ((TextHandler) next).getText(context);
+      if (StringUtils.isNotBlank(style)) {
+        ((UIStyle) component).setStyle(style);
+      }
     }
-
-    ((UIStyle) component).setStyle(content.toString());
   }
 
   public void applyNextHandler(FaceletContext ctx, UIComponent c) {