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, 18 Dec 2018 17:05:19 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 f2f9672  refactored
f2f9672 is described below

commit f2f967245d3c1575269e95d5e3b05bf67d44be4f
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Tue Dec 18 18:05:13 2018 +0100

    refactored
---
 .../facelets/FaceletViewDeclarationLanguage.java   | 60 ++++++++++------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
index c7d42dc..16c58e1 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
@@ -213,23 +213,19 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
     public final static String CACHED_COMPONENT_IDS = "oam.CACHED_COMPONENT_IDS"; 
     
     private static final String ASTERISK = "*";
-
-    private FaceletFactory _faceletFactory;
-
-    private StateManagementStrategy _stateMgmtStrategy;
-
-    private ResourceResolver _resourceResolver;
-    
-    private Map<String, List<String>> _contractMappings;
-    private List<String> _prefixWildcardKeys;
     
+    private final FaceletFactory faceletFactory;
     private final ViewDeclarationLanguageStrategy strategy;
     private final FaceletsCompilerSupport faceletsCompilerSupport;
     private final MyfacesConfig config;
     private final ViewPoolProcessor viewPoolProcessor;
     private final ViewHandlerSupport viewHandlerSupport;
     
+    private StateManagementStrategy stateManagementStrategy;
     private Set<String> fullStateSavingViewIds;
+    private ResourceResolver _resourceResolver;
+    private Map<String, List<String>> _contractMappings;
+    private List<String> _prefixWildcardKeys;
 
     public FaceletViewDeclarationLanguage(FacesContext context)
     {
@@ -248,18 +244,23 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
 
         Compiler compiler = createCompiler(context);
 
-        _faceletFactory = createFaceletFactory(context, compiler);
+        faceletFactory = createFaceletFactory(context, compiler);
 
-        ExternalContext eContext = context.getExternalContext();
+        if (config.isPartialStateSaving())
+        {
+            stateManagementStrategy = new DefaultFaceletsStateManagementStrategy(context);
+        }
+
+        ExternalContext externalContext = context.getExternalContext();
         
-        String[] viewIds = config.getFullStateSavingViewIds();
-        if (viewIds != null && viewIds.length > 0)
+        String[] fullStateSavingViewIds = config.getFullStateSavingViewIds();
+        if (fullStateSavingViewIds != null && fullStateSavingViewIds.length >
0)
         {
-            fullStateSavingViewIds = new HashSet<>(viewIds.length, 1.0f);
-            Collections.addAll(fullStateSavingViewIds, viewIds);
+            this.fullStateSavingViewIds = new HashSet<>(fullStateSavingViewIds.length,
1.0f);
+            Collections.addAll(this.fullStateSavingViewIds, fullStateSavingViewIds);
         }
 
-        _initializeContractMappings(eContext);
+        _initializeContractMappings(externalContext);
         
         // Create a component ids cache and store it on application map to
         // reduce the overhead associated with create such ids over and over.
@@ -267,7 +268,7 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
         {
             String[] componentIdsCached = SectionUniqueIdCounter.generateUniqueIdCache("_",

                     config.getComponentUniqueIdsCacheSize());
-            eContext.getApplicationMap().put(CACHED_COMPONENT_IDS, componentIdsCached);
+            externalContext.getApplicationMap().put(CACHED_COMPONENT_IDS, componentIdsCached);
         }
 
         log.finest("Initialization Successful");
@@ -695,11 +696,11 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
         try
         {
             Facelet compositeComponentFacelet;
-            FaceletFactory.setInstance(_faceletFactory);
+            FaceletFactory.setInstance(faceletFactory);
             try
             {
                 compositeComponentFacelet
-                        = _faceletFactory.getCompositeComponentMetadataFacelet(componentResource.getURL());
+                        = faceletFactory.getCompositeComponentMetadataFacelet(componentResource.getURL());
             }
             finally
             {
@@ -1742,12 +1743,7 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
     {
         // Use partial state saving strategy only if javax.faces.PARTIAL_STATE_SAVING is
"true" and
         // the current view is not on javax.faces.FULL_STATE_SAVING_VIEW_IDS.
-        if (config.isPartialStateSaving() && _stateMgmtStrategy == null)
-        {
-            _stateMgmtStrategy = new DefaultFaceletsStateManagementStrategy(context);
-        }
-
-        return _usePartialStateSavingOnThisView(viewId) ? _stateMgmtStrategy : null;
+        return _usePartialStateSavingOnThisView(viewId) ? stateManagementStrategy : null;
     }
 
     /**
@@ -2385,10 +2381,10 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
     private Facelet _getFacelet(FacesContext context, String viewId) throws IOException
     {
         // grab our FaceletFactory and create a Facelet
-        FaceletFactory.setInstance(_faceletFactory);
+        FaceletFactory.setInstance(faceletFactory);
         try
         {
-            return _faceletFactory.getFacelet(context, viewId);
+            return faceletFactory.getFacelet(context, viewId);
         }
         finally
         {
@@ -2399,10 +2395,10 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
     private Facelet _getViewMetadataFacelet(FacesContext context, String viewId) throws IOException
     {
         // grab our FaceletFactory and create a Facelet used to create view metadata
-        FaceletFactory.setInstance(_faceletFactory);
+        FaceletFactory.setInstance(faceletFactory);
         try
         {
-            return _faceletFactory.getViewMetadataFacelet(context, viewId);
+            return faceletFactory.getViewMetadataFacelet(context, viewId);
         }
         finally
         {
@@ -2540,7 +2536,7 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
     
     public FaceletFactory getFaceletFactory()
     {
-        return _faceletFactory;
+        return faceletFactory;
     }
 
     @Override
@@ -2552,11 +2548,11 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
         try
         {
             Facelet componentFacelet;
-            FaceletFactory.setInstance(_faceletFactory);
+            FaceletFactory.setInstance(faceletFactory);
             try
             {
                 componentFacelet
-                        = _faceletFactory.compileComponentFacelet(taglibURI, tagName, attributes);
+                        = faceletFactory.compileComponentFacelet(taglibURI, tagName, attributes);
             }
             finally
             {


Mime
View raw message