You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2021/06/28 13:13:22 UTC
[myfaces-tobago] branch master updated: fix(demo): navigation
synchronizeState
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/master by this push:
new c26c6d9 fix(demo): navigation synchronizeState
c26c6d9 is described below
commit c26c6d973c469ffef54aaca33b10701ff690b02f
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Jun 28 14:38:11 2021 +0200
fix(demo): navigation synchronizeState
It was possible, that the current navigation node was set to "Root_Dummy".
---
.../tobago/example/demo/SynchronizeNavigationPhaseListener.java | 8 +++++---
tobago-example/tobago-example-demo/src/main/webapp/main.xhtml | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
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 f32431a..a01d1ba 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
@@ -58,9 +58,11 @@ public class SynchronizeNavigationPhaseListener implements PhaseListener {
// in case of direct links the ViewRoot is empty after "restore view".
if (viewRoot != null && ComponentUtils.findChild(viewRoot, AbstractUIPage.class) == null) {
final String viewId = viewRoot.getViewId();
- final NavigationTree navigation
- = (NavigationTree) VariableResolverUtils.resolveVariable(facesContext, "navigationTree");
- navigation.gotoNode(navigation.findByViewId(viewId));
+ if (viewId != null && viewId.startsWith("/content")) {
+ final NavigationTree navigation
+ = (NavigationTree) VariableResolverUtils.resolveVariable(facesContext, "navigationTree");
+ navigation.gotoNode(navigation.findByViewId(viewId));
+ }
}
}
}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
index 8e7b060..1660d9e 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
@@ -33,7 +33,7 @@
</f:metadata>
-->
- <tc:page label="#{title != null ? title : 'Tobago Demo - '.concat(navigationState.currentNode.label)}" id="page">
+ <tc:page label="#{'Tobago Demo - '.concat(navigationState.currentNode.label)}" id="page">
<!--
<tc:dataAttribute name="tobago-log-level" value="DEBUG"/>
@@ -66,7 +66,7 @@
<tc:panel>
<tc:messages id="messages" orderBy="severity" rendered="#{!hideGlobalMessages}"/>
- <tc:section label="#{title != null ? title : navigationState.currentNode.label}" id="content">
+ <tc:section label="#{navigationState.currentNode.label}" id="content">
<tc:form id="mainForm">
<ui:insert/>
</tc:form>