You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2018/12/24 21:33:30 UTC
[myfaces] branch master updated: resolve TODOs + cleanup
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 e766ee5 resolve TODOs + cleanup
e766ee5 is described below
commit e766ee52b7a2bc8a5124a378bbe6f2c68bc1cf58
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Mon Dec 24 22:33:41 2018 +0100
resolve TODOs + cleanup
---
.../renderkit/html/HtmlStylesheetRenderer.java | 6 +--
.../facelets/FaceletViewDeclarationLanguage.java | 46 ++----------------
.../PostBuildComponentTreeOnRestoreViewEvent.java | 55 ----------------------
3 files changed, 4 insertions(+), 103 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
index e8f1b15..bf1d85f 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
@@ -46,11 +46,7 @@ import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
/**
* Renderer used by h:outputStylesheet component
- *
- * Note: originally this component required PostBuildComponentTreeOnRestoreViewEvent,
- * but that is no longer true because a tag handler implementing RelocatableResourceHandler
- * interface was associated, so the component is really marked and refreshed.
- *
+ *
* @since 2.0
* @author Leonardo Uribe (latest modification by $Author$)
* @version $Revision$ $Date$
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 f044f3c..0f43439 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
@@ -456,7 +456,6 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
// facelets refreshing algorithm do the opposite.
//FaceletViewDeclarationLanguage._publishPreRemoveFromViewEvent(context, view);
//FaceletViewDeclarationLanguage._publishPostAddToViewEvent(context, view);
- FaceletViewDeclarationLanguage._publishPostBuildComponentTreeOnRestoreViewEvent(context, view);
}
context.getAttributes().remove(REFRESHING_TRANSIENT_BUILD);
@@ -527,11 +526,10 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
// We need to suscribe the listeners of changes in the component tree
// only the first time here. Later we suscribe this listeners on
- // DefaultFaceletsStateManagement.restoreView after calling
- // _publishPostBuildComponentTreeOnRestoreViewEvent(), to ensure
+ // DefaultFaceletsStateManagement.restoreView, to ensure
// relocated components are not retrieved later on getClientIdsRemoved().
- if (!(refreshTransientBuild && PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId())) &&
- !view.isTransient())
+ if (!(refreshTransientBuild && PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
+ && !view.isTransient())
{
((DefaultFaceletsStateManagementStrategy) getStateManagementStrategy(context, view.getViewId())).
suscribeListeners(view);
@@ -615,44 +613,6 @@ public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLangua
}
}
- public static void _publishPostBuildComponentTreeOnRestoreViewEvent(FacesContext context, UIComponent component)
- {
- context.getApplication().publishEvent(context, PostBuildComponentTreeOnRestoreViewEvent.class,
- component.getClass(), component);
-
- if (component.getChildCount() > 0)
- {
- // PostAddToViewEvent could cause component relocation
- // (h:outputScript, h:outputStylesheet, composite:insertChildren, composite:insertFacet)
- // so we need to check if the component was relocated or not
- List<UIComponent> children = component.getChildren();
- UIComponent child = null;
- UIComponent currentChild = null;
- int i = 0;
- while (i < children.size())
- {
- child = children.get(i);
- // Iterate over the same index if the component was removed
- // This prevents skip components when processing
- do
- {
- _publishPostBuildComponentTreeOnRestoreViewEvent(context, child);
- currentChild = child;
- child = children.get(i);
- }
- while ((i < children.size()) && child != currentChild);
- i++;
- }
- }
- if (component.getFacetCount() > 0)
- {
- for (UIComponent child : component.getFacets().values())
- {
- _publishPostBuildComponentTreeOnRestoreViewEvent(context, child);
- }
- }
- }
-
private boolean isFilledView(FacesContext context, UIViewRoot view)
{
// The view is only built on restoreView or renderView, but if
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/PostBuildComponentTreeOnRestoreViewEvent.java b/impl/src/main/java/org/apache/myfaces/view/facelets/PostBuildComponentTreeOnRestoreViewEvent.java
deleted file mode 100644
index 618cad7..0000000
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/PostBuildComponentTreeOnRestoreViewEvent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.view.facelets;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.ComponentSystemEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.SystemEventListener;
-
-/**
- * TODO: Remove it since after MYFACES-2389 this is not necessary anymore.
- * Now, PostAddToViewEvent can be triggered inclusive on postback and restore view
- * phase, but note RestoreViewExecutor call facesContext.setProcessingEvents(false)
- * and cause the same effect than the check on UIComponent.setParent()
- * (postback and restore view phase).
- *
- * @since 2.0
- * @author Leonardo Uribe (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class PostBuildComponentTreeOnRestoreViewEvent extends ComponentSystemEvent
-{
- /**
- * @param component
- */
- public PostBuildComponentTreeOnRestoreViewEvent(UIComponent component)
- {
- super(component);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAppropriateListener(FacesListener listener)
- {
- return listener instanceof SystemEventListener;
- }
-}