myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored
Date Tue, 15 Oct 2019 20:06:55 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a89d2f  refactored
2a89d2f is described below

commit 2a89d2f642b825fbea4ff948d81af717d75d37e8
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Tue Oct 15 22:06:45 2019 +0200

    refactored
---
 .../view/facelets/tag/ui/DecorateHandler.java      | 28 ++++++++++++----------
 .../view/facelets/tag/ui/IncludeHandler.java       |  5 ++--
 .../view/facelets/tag/ui/InsertHandler.java        |  5 +++-
 .../facelets/tag/ui/LegacyDecorateHandler.java     | 27 +++++++++++----------
 .../view/facelets/tag/ui/LegacyIncludeHandler.java |  5 ++--
 5 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
index 15f2f6a..f76e36e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
@@ -39,6 +39,7 @@ import javax.faces.view.facelets.TagHandler;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.TemplateClient;
@@ -156,7 +157,7 @@ public final class DecorateHandler extends TagHandler implements TemplateClient,
                     if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                     {
                         path = this._template.getValue(ctx);
-                        if (path == null || path.isEmpty())
+                        if (StringUtils.isBlank(path))
                         {
                             return;
                         }
@@ -204,8 +205,7 @@ public final class DecorateHandler extends TagHandler implements TemplateClient,
                         //unset markInitialState flag
                         if (isBuildingInitialState == null)
                         {
-                            ctx.getFacesContext().getAttributes().remove(
-                                    StateManager.IS_BUILDING_INITIAL_STATE);
+                            ctx.getFacesContext().getAttributes().remove(StateManager.IS_BUILDING_INITIAL_STATE);
                         }
                         else
                         {
@@ -226,18 +226,20 @@ public final class DecorateHandler extends TagHandler implements TemplateClient,
             if (!_template.isLiteral())
             {
                 fcc.endComponentUniqueIdSection();
+                
+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
+                        && !fcc.isRefreshingTransientBuild())
+                {
+                    //Mark the parent component to be saved and restored fully.
+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
+                }
+                if (fcc.isDynamicComponentSection())
+                {
+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(),
parent);
+                }
             }
         }
-        if (!_template.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
-                && !fcc.isRefreshingTransientBuild())
-        {
-            //Mark the parent component to be saved and restored fully.
-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
-        }
-        if (!_template.isLiteral() && fcc.isDynamicComponentSection())
-        {
-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
-        }
+
     }
 
     @Override
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
index 148d0a8..4d4079a 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
@@ -39,6 +39,7 @@ import javax.faces.view.facelets.TagHandler;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
 import org.apache.myfaces.util.lang.ClassUtils;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
@@ -126,7 +127,7 @@ public final class IncludeHandler extends TagHandler implements ComponentContain
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                 {
                     path = this.src.getValue(ctx);
-                    if (path == null || path.length() == 0)
+                    if (StringUtils.isBlank(path))
                     {
                         return;
                     }
@@ -153,7 +154,7 @@ public final class IncludeHandler extends TagHandler implements ComponentContain
         }
         try
         {
-            if (path == null || path.length() == 0)
+            if (StringUtils.isBlank(path))
             {
                 return;
             }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
index f70d0d3..631d8e6 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
@@ -19,6 +19,7 @@
 package org.apache.myfaces.view.facelets.tag.ui;
 
 import java.io.IOException;
+import java.util.Objects;
 
 import javax.el.ELException;
 import javax.faces.FacesException;
@@ -86,6 +87,7 @@ public final class InsertHandler extends TagHandler implements TemplateClient,
C
     {
         AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
         actx.extendClient(this);
+
         boolean found = false;
         try
         {
@@ -105,11 +107,12 @@ public final class InsertHandler extends TagHandler implements TemplateClient,
C
     public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException,
FacesException,
             FaceletException, ELException
     {
-        if (this.name == name || this.name != null && this.name.equals(name))
+        if (Objects.equals(this.name, name))
         {
             this.nextHandler.apply(ctx, parent);
             return true;
         }
+
         return false;
     }
 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
index 3e03746..39b2c1a 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
@@ -36,6 +36,7 @@ import javax.faces.view.facelets.FaceletException;
 import javax.faces.view.facelets.TagAttribute;
 import javax.faces.view.facelets.TagConfig;
 import javax.faces.view.facelets.TagHandler;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.TemplateClient;
@@ -148,7 +149,7 @@ public final class LegacyDecorateHandler extends TagHandler implements
TemplateC
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                 {
                     path = this._template.getValue(ctx);
-                    if (path == null || path.length() == 0)
+                    if (StringUtils.isBlank(path))
                     {
                         return;
                     }
@@ -198,8 +199,7 @@ public final class LegacyDecorateHandler extends TagHandler implements
TemplateC
                         //unset markInitialState flag
                         if (isBuildingInitialState == null)
                         {
-                            ctx.getFacesContext().getAttributes().remove(
-                                    StateManager.IS_BUILDING_INITIAL_STATE);
+                            ctx.getFacesContext().getAttributes().remove(StateManager.IS_BUILDING_INITIAL_STATE);
                         }
                         else
                         {
@@ -221,18 +221,19 @@ public final class LegacyDecorateHandler extends TagHandler implements
TemplateC
             if (!_template.isLiteral())
             {
                 fcc.endComponentUniqueIdSection();
+                
+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
+                        && !fcc.isRefreshingTransientBuild())
+                {
+                    //Mark the parent component to be saved and restored fully.
+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
+                }
+                if (fcc.isDynamicComponentSection())
+                {
+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(),
parent);
+                }
             }
         }
-        if (!_template.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
-                && !fcc.isRefreshingTransientBuild())
-        {
-            //Mark the parent component to be saved and restored fully.
-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
-        }
-        if (!_template.isLiteral() && fcc.isDynamicComponentSection())
-        {
-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
-        }
     }
 
     @Override
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
index 5e9fed5..95071c0 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
@@ -36,6 +36,7 @@ import javax.faces.view.facelets.TagConfig;
 import javax.faces.view.facelets.TagHandler;
 
 import org.apache.myfaces.util.lang.ClassUtils;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
@@ -116,7 +117,7 @@ public final class LegacyIncludeHandler extends TagHandler implements
ComponentC
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                 {
                     path = this.src.getValue(ctx);
-                    if (path == null || path.length() == 0)
+                    if (StringUtils.isBlank(path))
                     {
                         return;
                     }
@@ -143,7 +144,7 @@ public final class LegacyIncludeHandler extends TagHandler implements
ComponentC
         }
         try
         {
-            if (path == null || path.length() == 0)
+            if (StringUtils.isBlank(path))
             {
                 return;
             }


Mime
View raw message