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 2017/09/27 13:01:00 UTC
[myfaces-tobago] 02/04: Demo works now better with Mojarra
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 3ab2764e396b7423d9c1bb3f103ed8f3d49db24a
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Sep 21 15:12:38 2017 +0200
Demo works now better with Mojarra
---
.../tobago/example/demo/NavigationTree.java | 1 -
.../demo/SynchronizeNavigationPhaseListener.java | 4 +++-
.../src/main/webapp/content/root-dummy.xhtml | 24 ++++++++++++++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
index 2703ff2..72ae677 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
@@ -69,7 +69,6 @@ public class NavigationTree implements Serializable {
servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
final List<String> list = locateResourcesInWar(servletContext, "/content", new ArrayList<>());
- list.add("/content/root-dummy.xhtml"); // helps to build the tree, this is not an existing file
final List<NavigationNode> nodes = new ArrayList<>();
for (final String path : list) {
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SynchronizeNavigationPhaseListener.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SynchronizeNavigationPhaseListener.java
index d827826..f32431a 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SynchronizeNavigationPhaseListener.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SynchronizeNavigationPhaseListener.java
@@ -19,6 +19,8 @@
package org.apache.myfaces.tobago.example.demo;
+import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.util.VariableResolverUtils;
import javax.faces.component.UIViewRoot;
@@ -54,7 +56,7 @@ public class SynchronizeNavigationPhaseListener implements PhaseListener {
final FacesContext facesContext = FacesContext.getCurrentInstance();
final UIViewRoot viewRoot = facesContext.getViewRoot();
// in case of direct links the ViewRoot is empty after "restore view".
- if (viewRoot != null && viewRoot.getChildCount() == 0) {
+ if (viewRoot != null && ComponentUtils.findChild(viewRoot, AbstractUIPage.class) == null) {
final String viewId = viewRoot.getViewId();
final NavigationTree navigation
= (NavigationTree) VariableResolverUtils.resolveVariable(facesContext, "navigationTree");
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/root-dummy.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/root-dummy.xhtml
new file mode 100644
index 0000000..613a6ba
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/root-dummy.xhtml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<ui:composition template="/plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ Root Dummy
+</ui:composition>
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.