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 2025/01/28 21:10:37 UTC

(myfaces-tobago) branch tobago-5.x updated: refactor(demo): show/hide 'Test' menu entry

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new bf62a44ba0 refactor(demo): show/hide 'Test' menu entry
bf62a44ba0 is described below

commit bf62a44ba006b67e53a5f1f5f6f914171508ba25
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Jan 28 22:01:22 2025 +0100

    refactor(demo): show/hide 'Test' menu entry
    
    The "Test" menu navigation entry is now hidden by default. It can be shown by clicking on the "navigation entry" checkbox in the header "Test" menu.
---
 .../org/apache/myfaces/tobago/example/demo/NavigationState.java  | 9 +++++++++
 tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml    | 4 ++++
 .../tobago-example-demo/src/main/webapp/navigation.xhtml         | 7 ++++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
index e9a79950b9..12883b2027 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
@@ -51,6 +51,7 @@ public class NavigationState implements Serializable {
   private TreeState state = new TreeState(new ExpandedState(1), new SelectedState());
 
   private boolean viewSource = false;
+  private boolean showTests = false;
 
   private String searchString;
   private List<NavigationNode> searchResult;
@@ -172,6 +173,14 @@ public void setViewSource(final boolean viewSource) {
     this.viewSource = viewSource;
   }
 
+  public boolean isShowTests() {
+    return showTests;
+  }
+
+  public void setShowTests(boolean showTests) {
+    this.showTests = showTests;
+  }
+
   public String getSearchString() {
     return searchString;
   }
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
index 498464014b..018e89b9f1 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
@@ -68,6 +68,10 @@
                      immediate="true" rendered="#{facesContext.isProjectStage('Development')}"/>
             <tc:link label="Access all pages" outcome="/testAccessAllPages.xhtml" target="_blank"
                      immediate="true" rendered="#{facesContext.isProjectStage('Development')}"/>
+            <tc:selectBooleanCheckbox itemLabel="navigation entry"
+                                      value="#{navigationState.showTests}">
+              <tc:event/>
+            </tc:selectBooleanCheckbox>
           </tc:link>
 
           <tc:link label="Menu" omit="true">
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml
index d4d78b1fd8..fd61748666 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/navigation.xhtml
@@ -22,9 +22,10 @@
   <tc:tree id="#{navigationId}" value="#{navigationTree.tree}" var="node" state="#{navigationState.state}">
     <tc:treeNode id="node">
       <tc:link
-              id="#{linkId}"
-              label="» #{node.label}"
-              outcome="#{node.outcome}"/>
+          id="#{linkId}"
+          label="» #{node.label}"
+          outcome="#{node.outcome}"
+          rendered="#{navigationState.showTests or (node.label != 'Test')}"/>
     </tc:treeNode>
   </tc:tree>
 </f:subview>