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 2020/10/15 10:02:09 UTC

[myfaces-tobago] branch master updated (517ffc5 -> d9f37ed)

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

lofwyr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git.


    from 517ffc5  undo jdk 15
     new 3bb34c0  cleanup: remove unused code
     new c2bba9a  cleanup: remove deprecated <tc:span>
     new bf17a0d  <tc:attribute> might be deprecated
     new 9f93d0e  demo
     new 24cbf82  fix package
     new d9f37ed  Generify

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../tobago/el/ConstantMethodExpression.java        | 103 -----------------
 .../org/apache/myfaces/tobago/el/UserWrapper.java  | 123 ---------------------
 .../myfaces/tobago/facelets/AttributeHandler.java  |  81 +++++++++++++-
 .../myfaces/tobago/facelets/SpanHandler.java       |  34 ------
 .../taglib/component/AttributeTagDeclaration.java  |   7 +-
 .../taglib/component/SpanTagDeclaration.java       |  50 ---------
 .../{internal => }/renderkit/CommandUnitTest.java  |   5 +-
 .../tobago/example/demo/OnOffConverter.java        |   9 +-
 .../60-multiheader/Sheet_Multi_Header.xhtml        |  24 ++--
 .../30-concept/50-partial/Partial_Ajax.xhtml       |  10 +-
 .../40-test/2000-selectItem/Type_Of_Literals.xhtml |   2 +-
 .../9010-mode-valueIfSet/Mode_ValueIfSet.xhtml     |  16 +--
 .../tobago-example-demo/src/main/webapp/main.xhtml |   7 +-
 13 files changed, 122 insertions(+), 349 deletions(-)
 delete mode 100644 tobago-core/src/main/java/org/apache/myfaces/tobago/el/ConstantMethodExpression.java
 delete mode 100644 tobago-core/src/main/java/org/apache/myfaces/tobago/el/UserWrapper.java
 delete mode 100644 tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SpanHandler.java
 delete mode 100644 tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SpanTagDeclaration.java
 rename tobago-core/src/test/java/org/apache/myfaces/tobago/internal/{internal => }/renderkit/CommandUnitTest.java (89%)


[myfaces-tobago] 02/06: cleanup: remove deprecated

Posted by lo...@apache.org.
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 c2bba9a1278602fe312f67aebc9aac41764dc743
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Oct 7 12:14:36 2020 +0200

    cleanup: remove deprecated <tc:span>
    
    * replaced by <tc:gridLayoutConstraint>
---
 .../myfaces/tobago/facelets/SpanHandler.java       | 34 ---------------
 .../taglib/component/SpanTagDeclaration.java       | 50 ----------------------
 .../60-multiheader/Sheet_Multi_Header.xhtml        | 24 +++++------
 .../30-concept/50-partial/Partial_Ajax.xhtml       | 10 ++---
 .../40-test/2000-selectItem/Type_Of_Literals.xhtml |  2 +-
 5 files changed, 18 insertions(+), 102 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SpanHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SpanHandler.java
deleted file mode 100644
index 5faa1f7..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SpanHandler.java
+++ /dev/null
@@ -1,34 +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.tobago.facelets;
-
-import javax.faces.view.facelets.TagConfig;
-
-/**
- * @since 3.0.0
- * @deprecated since 4.0.0. Please use {@link GridLayoutConstraintHandler}
- */
-@Deprecated
-public class SpanHandler extends GridLayoutConstraintHandler {
-
-  public SpanHandler(final TagConfig config) {
-    super(config);
-  }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SpanTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SpanTagDeclaration.java
deleted file mode 100644
index 023603a..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SpanTagDeclaration.java
+++ /dev/null
@@ -1,50 +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.tobago.internal.taglib.component;
-
-import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
-import org.apache.myfaces.tobago.apt.annotation.Tag;
-import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-
-import javax.el.ValueExpression;
-
-/**
- * Add a column span or row span to the parent UIComponent, useful for a grid layout.
- *
- * @deprecated Since Tobago 4.0.0. Please use &lt;tc:gridLayoutConstraint&gt;
- * from {@link GridLayoutConstraintTagDeclaration} instead.
- */
-@Deprecated
-@Tag(name = "span")
-@SimpleTag(faceletHandler = "org.apache.myfaces.tobago.facelets.GridLayoutConstraintHandler")
-public interface SpanTagDeclaration {
-
-  /**
-   * The number of horizontal cells this component should use.
-   */
-  @TagAttribute(type = "java.lang.Integer")
-  void setColumn(final ValueExpression column);
-
-  /**
-   * The number of vertical cells this component should use.
-   */
-  @TagAttribute(type = "java.lang.Integer")
-  void setRow(final ValueExpression row);
-}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/Sheet_Multi_Header.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/Sheet_Multi_Header.xhtml
index fd78e84..6fe5278 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/Sheet_Multi_Header.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/Sheet_Multi_Header.xhtml
@@ -28,9 +28,9 @@
     The facet could be filled with <code class="language-markup">&lt;tc:out/></code> tags
     to set the names of the header.
     Such an output field tag may also contain
-    <code class="language-markup">&lt;tc:span column="..."/></code>
+    <code class="language-markup">&lt;tc:gridLayoutConstraint columnSpan="..."/></code>
     or
-    <code class="language-markup">&lt;tc:span row="..."/></code>
+    <code class="language-markup">&lt;tc:gridLayoutConstraint rowSpan="..."/></code>
     to set a span over columns or rows.</p>
   <p>Tag Library Documentation:
     <tc:link label="&lt;tc:sheet/>" image="#{request.contextPath}/image/feather-leaf.png"
@@ -39,7 +39,7 @@
     <tc:link label="&lt;tc:column/>" image="#{request.contextPath}/image/feather-leaf.png"
              link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/column.html"/>
     |
-    <tc:link label="&lt;tc:span/>" image="#{request.contextPath}/image/feather-leaf.png"
+    <tc:link label="&lt;tc:gridLayoutConstraint/>" image="#{request.contextPath}/image/feather-leaf.png"
              link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/gridLayoutConstraint.html"/></p>
 
   <tc:section label="Multi-Header">
@@ -51,36 +51,36 @@
       &lt;tc:span row="3"/>
     &lt;/tc:out>
     &lt;tc:out value="Information">
-      &lt;tc:span column="2"/>
+      &lt;tc:gridLayoutConstraint columnSpan="2"/>
     ...</code></pre>
     <tc:sheet value="#{sheetController.solarList}" var="luminary" rows="11"
               columns="3fr 2fr 30px 2fr 2fr 2fr 2fr 2fr 2fr" markup="bordered">
       <f:facet name="header">
         <tc:panel>
           <tc:out value="Name">
-            <tc:span row="3"/>
+            <tc:gridLayoutConstraint rowSpan="3"/>
           </tc:out>
           <tc:out value="Information">
-            <tc:span column="2"/>
+            <tc:gridLayoutConstraint columnSpan="2"/>
           </tc:out>
           <tc:out value="Data">
-            <tc:span column="4"/>
+            <tc:gridLayoutConstraint columnSpan="4"/>
           </tc:out>
           <tc:out value="Discovery">
-            <tc:span column="2"/>
+            <tc:gridLayoutConstraint columnSpan="2"/>
           </tc:out>
 
           <tc:out value="Orbit">
-            <tc:span column="3"/>
+            <tc:gridLayoutConstraint columnSpan="3"/>
           </tc:out>
           <tc:out value="Orb">
-            <tc:span column="3"/>
+            <tc:gridLayoutConstraint columnSpan="3"/>
           </tc:out>
           <tc:out value="Name">
-            <tc:span row="2"/>
+            <tc:gridLayoutConstraint rowSpan="2"/>
           </tc:out>
           <tc:out value="Year">
-            <tc:span row="2"/>
+            <tc:gridLayoutConstraint rowSpan="2"/>
           </tc:out>
 
           <tc:out value="of"/>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/50-partial/Partial_Ajax.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/50-partial/Partial_Ajax.xhtml
index 3bf9682..8accca0 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/50-partial/Partial_Ajax.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/50-partial/Partial_Ajax.xhtml
@@ -82,32 +82,32 @@
         <tc:button label="Reload both" tip="Reload both boxes"
                    action="#{partialReloadController.reload}">
           <f:ajax render="left right :page:header:headerInfo"/>
-          <tc:span column="2"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
         </tc:button>
 
         <tc:button label="Reload full panel"
                    tip="Reload the full area inside the outer box"
                    action="#{partialReloadController.reload}">
           <f:ajax render="parent :page:header:headerInfo"/>
-          <tc:span column="2"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
         </tc:button>
 
         <tc:button label="Reload both (wait 3 s)"
                    tip="Reload both boxes, but the server has a delay of 3 seconds"
                    action="#{partialReloadController.waitAndReload3}">
           <f:ajax render="left right :page:header:headerInfo"/>
-          <tc:span column="2"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
         </tc:button>
 
         <tc:button label="Reload both (wait 7 s, timeout)"
                    tip="Reload both boxes, but the server has a delay of 7 seconds, this is more than the default timeout for AJAX"
                    action="#{partialReloadController.waitAndReload7}">
           <f:ajax render="left right :page:header:headerInfo"/>
-          <tc:span column="2"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
         </tc:button>
 
         <tc:panel id="navTest">
-          <tc:span column="2"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
 
           <tc:selectOneChoice fieldId="navSelect" value="#{partialReloadController.navigateActionValue}"
                               label="On Change">
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/2000-selectItem/Type_Of_Literals.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/2000-selectItem/Type_Of_Literals.xhtml
index 8c59f37..e17b442 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/2000-selectItem/Type_Of_Literals.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/2000-selectItem/Type_Of_Literals.xhtml
@@ -24,7 +24,7 @@
     <tc:gridLayout columns="4fr 1fr">
 
       <tc:panel>
-        <tc:span column="2"/>
+        <tc:gridLayoutConstraint columnSpan="2"/>
         <tc:messages/>
       </tc:panel>
 


[myfaces-tobago] 03/06: might be deprecated

Posted by lo...@apache.org.
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 bf17a0d7fa2834d69208140c16352f773bad6f0d
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Oct 7 12:43:52 2020 +0200

    <tc:attribute> might be deprecated
---
 .../tobago/el/ConstantMethodExpression.java        | 103 ---------------------
 .../myfaces/tobago/facelets/AttributeHandler.java  |  81 +++++++++++++++-
 .../taglib/component/AttributeTagDeclaration.java  |   7 +-
 .../tobago-example-demo/src/main/webapp/main.xhtml |   7 +-
 4 files changed, 89 insertions(+), 109 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/el/ConstantMethodExpression.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/el/ConstantMethodExpression.java
deleted file mode 100644
index 6a063ec..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/el/ConstantMethodExpression.java
+++ /dev/null
@@ -1,103 +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.tobago.el;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.MethodInfo;
-import javax.faces.component.StateHolder;
-import javax.faces.context.FacesContext;
-import java.util.Objects;
-
-public class ConstantMethodExpression extends MethodExpression implements StateHolder {
-
-  private String outcome;
-
-  private boolean transientFlag;
-
-  public ConstantMethodExpression() {
-  }
-
-  public ConstantMethodExpression(final String outcome) {
-    this.outcome = outcome;
-  }
-
-  @Override
-  public MethodInfo getMethodInfo(final ELContext context)
-      throws NullPointerException, ELException {
-    return null;
-  }
-
-  @Override
-  public Object invoke(final ELContext context, final Object[] params)
-      throws NullPointerException, ELException {
-    return outcome;
-  }
-
-  @Override
-  public boolean equals(final Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    final ConstantMethodExpression that = (ConstantMethodExpression) o;
-
-    return Objects.equals(outcome, that.outcome);
-  }
-
-  @Override
-  public int hashCode() {
-    return outcome.hashCode();
-  }
-
-  @Override
-  public String getExpressionString() {
-    return outcome;
-  }
-
-  @Override
-  public boolean isLiteralText() {
-    return true;
-  }
-
-  @Override
-  public Object saveState(final FacesContext context) {
-    return outcome;
-  }
-
-  @Override
-  public void restoreState(final FacesContext context, final Object state) {
-    this.outcome = (String) state;
-  }
-
-  @Override
-  public void setTransient(final boolean transientFlagParameter) {
-    this.transientFlag = transientFlag;
-  }
-
-  @Override
-  public boolean isTransient() {
-    return transientFlag;
-  }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
index 3b4319f..7083046 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
@@ -22,22 +22,25 @@ package org.apache.myfaces.tobago.facelets;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.context.Markup;
-import org.apache.myfaces.tobago.el.ConstantMethodExpression;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.el.ELContext;
 import javax.el.ELException;
 import javax.el.ExpressionFactory;
 import javax.el.MethodExpression;
+import javax.el.MethodInfo;
 import javax.el.ValueExpression;
 import javax.faces.FacesException;
 import javax.faces.component.ActionSource;
 import javax.faces.component.ActionSource2;
 import javax.faces.component.EditableValueHolder;
+import javax.faces.component.StateHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.event.MethodExpressionActionListener;
 import javax.faces.event.MethodExpressionValueChangeListener;
@@ -51,6 +54,7 @@ import javax.faces.view.facelets.TagHandler;
 import java.beans.IntrospectionException;
 import java.beans.PropertyDescriptor;
 import java.lang.invoke.MethodHandles;
+import java.util.Objects;
 
 public final class AttributeHandler extends TagHandler {
 
@@ -351,4 +355,79 @@ public final class AttributeHandler extends TagHandler {
       parent.setValueExpression(nameValue, expression);
     }
   }
+
+  private static class ConstantMethodExpression extends MethodExpression implements StateHolder {
+
+    private String outcome;
+
+    private boolean transientFlag;
+
+    public ConstantMethodExpression() {
+    }
+
+    public ConstantMethodExpression(final String outcome) {
+      this.outcome = outcome;
+    }
+
+    @Override
+    public MethodInfo getMethodInfo(final ELContext context)
+        throws NullPointerException, ELException {
+      return null;
+    }
+
+    @Override
+    public Object invoke(final ELContext context, final Object[] params)
+        throws NullPointerException, ELException {
+      return outcome;
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+
+      final ConstantMethodExpression that = (ConstantMethodExpression) o;
+
+      return Objects.equals(outcome, that.outcome);
+    }
+
+    @Override
+    public int hashCode() {
+      return outcome.hashCode();
+    }
+
+    @Override
+    public String getExpressionString() {
+      return outcome;
+    }
+
+    @Override
+    public boolean isLiteralText() {
+      return true;
+    }
+
+    @Override
+    public Object saveState(final FacesContext context) {
+      return outcome;
+    }
+
+    @Override
+    public void restoreState(final FacesContext context, final Object state) {
+      this.outcome = (String) state;
+    }
+
+    @Override
+    public void setTransient(final boolean transientFlagParameter) {
+      this.transientFlag = transientFlag;
+    }
+
+    @Override
+    public boolean isTransient() {
+      return transientFlag;
+    }
+  }
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTagDeclaration.java
index 25f2034..21a39de 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTagDeclaration.java
@@ -26,8 +26,14 @@ import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import javax.el.ValueExpression;
 
 /**
+ * <p>
  * Add an attribute on the UIComponent
  * associated with the closest parent UIComponent custom action.
+ * </p>
+ * <p>
+ * You might not need this attribute.
+ * Is there a real use case any longer for this tag?
+ * </p>
  */
 @Tag(name = "attribute")
 @SimpleTag(
@@ -46,7 +52,6 @@ public interface AttributeTagDeclaration {
   @TagAttribute(required = true, name = "value", type = "java.lang.String")
   void setValue(final ValueExpression value);
   /**
-   * Warning: The mode is only available when using Facelets.
    * Allowed values are "action", "actionListener", "actionFromValue", "isNotSet", "isSet", "valueIfSet".
    * <br>
    * "action" (method binding) evaluate the expression to find the method binding which is referenced with the template.
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 eb6655f..fc58ee4 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
@@ -25,8 +25,8 @@
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns="http://www.w3.org/1999/xhtml">
   <f:view locale="#{localeController.locale}">
-    <tc:page label="Tobago Demo - #{navigationState.currentNode.label}" id="page">
-      <tc:attribute name="label" value="#{title}" mode="valueIfSet"/>
+
+    <tc:page label="#{title != null ? title : 'Tobago Demo - '.concat(navigationState.currentNode.label)}" id="page">
 
       <!--
             <tc:dataAttribute name="tobago-log-level" value="DEBUG"/>
@@ -59,8 +59,7 @@
             <tc:panel>
               <tc:messages id="messages" orderBy="severity" rendered="#{!hideGlobalMessages}"/>
 
-              <tc:section label="#{navigationState.currentNode.label}" id="content">
-                <tc:attribute name="label" value="#{title}" mode="valueIfSet"/>
+              <tc:section label="#{title != null ? title : navigationState.currentNode.label}" id="content">
                 <tc:form id="mainForm">
                   <ui:insert/>
                 </tc:form>


[myfaces-tobago] 06/06: Generify

Posted by lo...@apache.org.
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 d9f37ed1dc6af0ba0e88cb708e69b0226b0c1202
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Oct 15 12:01:40 2020 +0200

    Generify
---
 .../org/apache/myfaces/tobago/example/demo/OnOffConverter.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
index e02b274..97dc9cd 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
@@ -28,12 +28,15 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import java.lang.invoke.MethodHandles;
 
-public class OnOffConverter implements Converter {
+/**
+ * Example of a boolean converter with a string representation in the model ("on" and "off").
+ */
+public class OnOffConverter implements Converter<String> {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   @Override
-  public Object getAsObject(final FacesContext context, final UIComponent component, final String value)
+  public String getAsObject(final FacesContext facesContext, final UIComponent component, final String value)
       throws ConverterException {
     final String result = Boolean.parseBoolean(value) ? "on" : "off";
     LOG.info("Got value = '" + value + "'. Result = '" + result + "'");
@@ -41,7 +44,7 @@ public class OnOffConverter implements Converter {
   }
 
   @Override
-  public String getAsString(final FacesContext context, final UIComponent component, final Object value)
+  public String getAsString(final FacesContext facesContext, final UIComponent component, final String value)
       throws ConverterException {
     final String result = "on".equals(value) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
     LOG.info("Got value = '" + value + "'. Result: '" + result + "'");


[myfaces-tobago] 01/06: cleanup: remove unused code

Posted by lo...@apache.org.
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 3bb34c021f304d9a5d64a294083133fc99459b18
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Oct 7 11:15:06 2020 +0200

    cleanup: remove unused code
---
 .../org/apache/myfaces/tobago/el/UserWrapper.java  | 123 ---------------------
 1 file changed, 123 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/el/UserWrapper.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/el/UserWrapper.java
deleted file mode 100644
index 3db49d9..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/el/UserWrapper.java
+++ /dev/null
@@ -1,123 +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.tobago.el;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.faces.context.FacesContext;
-import java.lang.invoke.MethodHandles;
-import java.security.Principal;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-public class UserWrapper {
-
-  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-  private Map roles;
-
-  public UserWrapper() {
-    roles = new RolesMap();
-  }
-
-  public Principal getPrincipal() {
-    final FacesContext facesContext = FacesContext.getCurrentInstance();
-    final Principal principal = facesContext.getExternalContext().getUserPrincipal();
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("getPrincipal(): {}", principal);
-    }
-    return principal;
-  }
-
-  public Map getRoles() {
-    return roles;
-  }
-
-  private static class RolesMap implements Map {
-
-    @Override
-    public Object get(final Object key) {
-      final String role = (String) key;
-      final FacesContext facesContext = FacesContext.getCurrentInstance();
-      final boolean inRole = facesContext.getExternalContext().isUserInRole(role);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("is in role '{}': {}", key, inRole);
-      }
-      return Boolean.valueOf(inRole);
-    }
-
-    @Override
-    public int size() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void clear() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean isEmpty() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean containsKey(final Object key) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean containsValue(final Object value) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection values() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void putAll(final Map t) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Set entrySet() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Set keySet() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Object remove(final Object key) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Object put(final Object key, final Object value) {
-      throw new UnsupportedOperationException();
-    }
-  }
-}


[myfaces-tobago] 04/06: demo

Posted by lo...@apache.org.
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 9f93d0eda21eda48ea29c6ebe40263bbe21e5168
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Oct 7 13:03:57 2020 +0200

    demo
---
 .../40-test/9010-mode-valueIfSet/Mode_ValueIfSet.xhtml   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.xhtml
index 1f7b738..12536e6 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/9010-mode-valueIfSet/Mode_ValueIfSet.xhtml
@@ -26,12 +26,12 @@
 
     <tc:box label="Set value via &lt;tc:attribute>">
 
-      <p>
-        The lable after the input field displays the expected string.
-      </p>
-
       <tc:segmentLayout medium="4seg 4seg 4seg">
 
+        <tc:label value="label:"/>
+        <tc:label value="test field:"/>
+        <tc:label value="expected value:"/>
+
         <tc:label value="direct literal:"/>
         <tc:in id="direct" label="literal value" labelLayout="segmentRight">
           <tc:attribute name="value" value="literal value" mode="valueIfSet"/>
@@ -70,12 +70,12 @@
 
     <tc:box label="Set id via &lt;tc:attribute>" id="id-box">
 
-      <p>
-        The lable after the input field displays the expected id attribute.
-      </p>
-
       <tc:segmentLayout medium="4seg 4seg 4seg">
 
+        <tc:label value="label:"/>
+        <tc:label value="test field:"/>
+        <tc:label value="expected id:"/>
+
         <tc:label value="id"/>
         <tc:in label="page:mainForm:my_number_1::field" labelLayout="segmentRight">
           <tc:attribute name="id" value="my_number_1" mode="valueIfSet"/>


[myfaces-tobago] 05/06: fix package

Posted by lo...@apache.org.
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 24cbf8262fc3e9521ce2e7ca02e5f8cd707503fa
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Oct 7 17:28:08 2020 +0200

    fix package
---
 .../tobago/internal/{internal => }/renderkit/CommandUnitTest.java    | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/internal/renderkit/CommandUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/CommandUnitTest.java
similarity index 89%
rename from tobago-core/src/test/java/org/apache/myfaces/tobago/internal/internal/renderkit/CommandUnitTest.java
rename to tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/CommandUnitTest.java
index 7dc4415..dbe8e92 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/internal/renderkit/CommandUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/CommandUnitTest.java
@@ -17,11 +17,8 @@
  * under the License.
  */
 
-package org.apache.myfaces.tobago.internal.internal.renderkit;
+package org.apache.myfaces.tobago.internal.renderkit;
 
-import org.apache.myfaces.tobago.internal.renderkit.Collapse;
-import org.apache.myfaces.tobago.internal.renderkit.Command;
-import org.apache.myfaces.tobago.internal.renderkit.CommandMap;
 import org.apache.myfaces.tobago.internal.util.JsonUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;