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 2016/11/23 08:31:01 UTC

svn commit: r1770933 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/ webapp/content/20-component/020-output/45-figure/ webapp/content/20-component/080-sheet/30-event/ webapp/content/2...

Author: lofwyr
Date: Wed Nov 23 08:31:00 2016
New Revision: 1770933

URL: http://svn.apache.org/viewvc?rev=1770933&view=rev
Log:
TOBAGO-1544 Revise Demo Application for Tobago 3.0
* small improvements for demo
[developed by hnoeth]

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/45-figure/figure.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java Wed Nov 23 08:31:00 2016
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.exampl
 import javax.enterprise.context.RequestScoped;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
 import javax.inject.Named;
@@ -41,4 +42,20 @@ public class ValidationController implem
               "Please type in 'Tobago'"));
     }
   }
+
+  public void passwordValidator(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+    String password = value.toString();
+
+    UIInput confirmationField = (UIInput) component.getAttributes().get("confirmationField");
+    String confirmationFieldValue = confirmationField.getSubmittedValue().toString();
+
+    if (password.isEmpty() || confirmationFieldValue.isEmpty()) {
+      return;
+    }
+
+    if (!password.equals(confirmationFieldValue)) {
+      confirmationField.setValid(false);
+      throw new ValidatorException(new FacesMessage("Passwords must match."));
+    }
+  }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/45-figure/figure.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/45-figure/figure.xhtml?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/45-figure/figure.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/020-output/45-figure/figure.xhtml Wed Nov 23 08:31:00 2016
@@ -21,17 +21,27 @@
                 xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core">
-  <ui:param name="title" value="#{overviewBundle.image} &lt;tc:image&gt;"/>
-  <p>Create an figure with <code class="language-markup">&lt;tc:figure/&gt;</code> around an image, video or something else.
-  The label can be set via the label attribute or with the label facet.</p>
+  <ui:param name="title" value="#{overviewBundle.figure} &lt;tc:figure>"/>
+  <p>Create a figure with <code class="language-markup">&lt;tc:figure/&gt;</code> around an image,
+    video or something else. The label can be set via the label attribute or with the label facet.</p>
+  <tc:link label="Tag Library Documentation" image="image/feather-leaf.png"
+           link="#{overviewBundle.tagDocUrl}/figure.html"/>
 
-  <tc:section label="Basics">
-    <pre><code class="language-markup">&lt;tc:figure&gt;
-  &lt;f:facet name="label"&gt;Label Text&lt;/f:facet&gt;
-  &lt;tc:image value=.../&gt;
-&lt;/tc:figure&gt;</code></pre>
-    <tc:figure id="figure">
-      <f:facet name="label">Label Text</f:facet>
+  <tc:section label="Label attribute">
+    <p>For simple captions use the <code>label</code> attribute.</p>
+    <pre><code class="language-markup">&lt;tc:figure label="Picture of the alps.">
+  &lt;tc:image value="image/alps.png"/>
+&lt;/tc:figure></code></pre>
+    <tc:figure label="Picture of the alps.">
+      <tc:image value="image/alps.png"/>
+    </tc:figure>
+  </tc:section>
+
+  <tc:section label="Label facet">
+    <p>For more complex captions use <code class="language-markup">&lt;f:facet name="label"></code>.
+      In this example the word 'tobago' is colored red.</p>
+    <tc:figure>
+      <f:facet name="label">The <span style="color: red">tobago</span> logo.</f:facet>
       <tc:image id="image" value="image/tobago_head.png"/>
     </tc:figure>
   </tc:section>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml Wed Nov 23 08:31:00 2016
@@ -22,7 +22,7 @@
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core">
-  <ui:param name="title" value="#{overviewBundle.sheet_column_event} &lt;tc:columnEvent>"/>
+  <ui:param name="title" value="#{overviewBundle.sheet_event} &lt;tc:row>"/>
   <p>A <code class="language-markup">&lt;tc:sheet/></code> can contain a
     <code class="language-markup">&lt;tc:columnEvent/></code> tag, which knows two types of events.
     The event type can be set by the <code>event</code> attribute. Possible values are 'click' and 'dblclick'.

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml Wed Nov 23 08:31:00 2016
@@ -24,7 +24,7 @@
                 xmlns:f="http://java.sun.com/jsf/core">
   <ui:param name="title" value="#{overviewBundle.tree} &lt;tc:tree>"/>
   <p>A classic tree can created with the <code class="language-markup">&lt;tc:tree/></code> tag.
-    Tobage knows two more presentations of a tree. As a <tc:link label="menu" link="03-menu/tree-menu.xhtml"/>
+    Tobago knows two more presentations of a tree. As a <tc:link label="menu" link="03-menu/tree-menu.xhtml"/>
     and as a <tc:link label="list" link="04-listbox/tree-listbox.xhtml"/>.</p>
   <p>Tag Library Documentation:
     <tc:link label="&lt;tc:tree/>" image="image/feather-leaf.png"

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml Wed Nov 23 08:31:00 2016
@@ -97,4 +97,21 @@
       <tc:button id="submit" label="Submit"/>
     </tc:form>
   </tc:section>
+
+  <tc:section label="Two Field Validation">
+    <p>A validator check the password against the confirmation field.
+      To get access to the confirmation field from the validator a binding with the <code>binding</code> attribute
+      and the <code class="language-markup">&lt;f:attribute/></code> tag is created.</p>
+    <pre><code class="language-markup">&lt;tc:in label="Password" value="qwe" validator="\#{validationController.passwordValidator}">
+  &lt;f:attribute name="confirmationField" value="\#{confirmBinding}"/>
+&lt;/tc:in>
+&lt;tc:in label="Confirmation" value="asdf" binding="\#{confirmBinding}"/></code></pre>
+    <tc:form>
+      <tc:in label="Password" required="true" validator="#{validationController.passwordValidator}">
+        <f:attribute name="confirmationField" value="#{confirmBinding}"/>
+      </tc:in>
+      <tc:in label="Confirmation" required="true" binding="#{confirmBinding}"/>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
 </ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=1770933&r1=1770932&r2=1770933&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Wed Nov 23 08:31:00 2016
@@ -48,6 +48,7 @@
   <entry key="out">Output</entry>
   <entry key="label">Label</entry>
   <entry key="messages">Messages</entry>
+  <entry key="figure">Figure</entry>
   <entry key="image">Image</entry>
   <entry key="progress">Progress Bar</entry>
   <entry key="object">External Object (iframe)</entry>
@@ -81,7 +82,7 @@
   <entry key="sheet_column_content">Column Content</entry>
   <entry key="sheet_sorting">Sorting</entry>
   <entry key="sheet_column_selector">Column Selector</entry>
-  <entry key="sheet_column_event">Column Event</entry>
+  <entry key="sheet_event">Event</entry>
   <entry key="sheet_markup">Markup</entry>
   <entry key="sheet_dropdown">Dropdown Box</entry>
   <entry key="sheet_filter">Filtering</entry>