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/05/10 07:26:05 UTC

svn commit: r1743111 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp: WEB-INF/faces-config.xml content/30-concept/06-validation/00/content-validation.xhtml menu.xhtml

Author: lofwyr
Date: Tue May 10 07:26:04 2016
New Revision: 1743111

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

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=1743111&r1=1743110&r2=1743111&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml Tue May 10 07:26:04 2016
@@ -79,55 +79,6 @@
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
 
-  <!--best practice-->
-
-  <navigation-rule>
-    <navigation-case>
-      <from-outcome>best-practice/intro</from-outcome>
-      <to-view-id>/content/12-best-practice/best-practice.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/error</from-outcome>
-      <to-view-id>/content/12-best-practice/00/error.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/theme</from-outcome>
-      <to-view-id>/content/12-best-practice/01/theme.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/transition</from-outcome>
-      <to-view-id>/content/12-best-practice/02/transition.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/transition-after-sleep</from-outcome>
-      <to-view-id>/content/12-best-practice/02/x-transition-after-sleep.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/non-faces-response</from-outcome>
-      <to-view-id>/content/12-best-practice/03/non-faces-response.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/tool-bar-customizer</from-outcome>
-      <to-view-id>/content/05-toolBar/00/tool-bar-customizer.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>best-practice/facelets-as-resources</from-outcome>
-      <to-view-id>/content/12-best-practice/04/facelets-as-resources.xhtml</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-
-  <navigation-rule>
-    <from-view-id>/content/12-best-practice/00/error.xhtml</from-view-id>
-    <navigation-case>
-      <from-outcome>error-404</from-outcome>
-      <to-view-id>/content/12-best-practice/00/x-not-existing-page.xhtml</to-view-id>
-    </navigation-case>
-    <navigation-case>
-      <from-outcome>syntax</from-outcome>
-      <to-view-id>/content/12-best-practice/00/x-error-in-syntax.xhtml</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-
   <converter>
     <converter-id>org.apache.myfaces.tobago.example.demo.OnOffConverter</converter-id>
     <converter-class>org.apache.myfaces.tobago.example.demo.OnOffConverter</converter-class>

Added: 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=1743111&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/00/content-validation.xhtml Tue May 10 07:26:04 2016
@@ -0,0 +1,99 @@
+<?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="/main.xhtml"
+                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.validation}"/>
+  <p>There are several ways to validate the content of a component. In general input components have the option
+    for validation. In the following sections, the different kinds von validation are explained.</p>
+
+  <p>Tag Library Documentation:
+    <tc:link label="&lt;tc:sheet/>" image="image/feather-leaf.png"
+             link="#{overviewBundle.tagDocUrl}/sheet.html"/>
+    |
+    <tc:link label="&lt;tc:column/>" image="image/feather-leaf.png"
+             link="#{overviewBundle.tagDocUrl}/column.html"/></p>
+
+  <tc:section label="Required">
+    <p>A simple way of validation is the <code>required</code> attribute in some input components.
+      The text area must not empty if the submit button is pressed. Otherwise a error message is displayed.</p>
+    <pre><code class="language-markup">&lt;tc:textarea label="Text Area" required="true"/></code></pre>
+    <tc:form>
+      <tc:textarea id="t1" label="Text Area" required="true"/>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
+
+  <tc:section label="Validate Length">
+    <p>The length of a value can be validated by the <code class="language-markup">&lt;f:validateLength/></code> tag.
+      Length means the number of characters.
+      In this example, the given string must have at least two characters and maximal four characters.</p>
+    <pre><code class="language-markup">&lt;tc:in label="Input">
+  &lt;f:validateLength minimum="2" maximum="4"/>
+&lt;/tc:in></code></pre>
+    <tc:form>
+      <tc:in id="i1" label="Text">
+        <f:validateLength minimum="2" maximum="4"/>
+      </tc:in>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
+
+  <tc:section label="Validate Range">
+    <p>The range of a number can be validated via <code class="language-markup">&lt;f:validateLongRange/></code>
+      or - for floating point numbers - <code class="language-markup">&lt;f:validateDoubleRange/></code>.
+      In the following inputfield numbers from 3 to 77 can be added.</p>
+    <pre><code class="language-markup">&lt;tc:in label="Number" markup="number">
+  &lt;f:validateLongRange minimum="3" maximum="77"/>
+&lt;/tc:in></code></pre>
+    <tc:form>
+      <tc:in id="i2" label="Number" markup="number">
+        <f:validateLongRange minimum="3" maximum="77"/>
+      </tc:in>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
+
+  <tc:section label="Regex Validation">
+    <p>A value can be validated against a regex patter via the
+      <code class="language-markup">&lt;f:validateRegex/></code> tag.</p>
+    <pre><code class="language-markup">&lt;tc:in label="Letter &amp; Number" >
+  &lt;f:validateRegex pattern="[A-Za-z][0-9]"/>
+&lt;/tc:in></code></pre>
+    <tc:form>
+      <p>The value in the field must be a word character combined with a number. For example 'T3'.</p>
+      <tc:in id="i3" label="Letter &amp; Number">
+        <f:validateRegex pattern="[A-Za-z][0-9]"/>
+      </tc:in>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
+
+  <tc:section label="Custom Validator">
+    <p>It's also possible to add custom validators using the <code>validator</code> attribute of an input component.
+      In this case, only the string 'Tobago' is accepted.</p>
+    <tc:form>
+      <tc:in id="i4" label="Text" validator="#{validationController.customValidator}"/>
+      <tc:button label="Submit"/>
+    </tc:form>
+  </tc:section>
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml?rev=1743111&r1=1743110&r2=1743111&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml Tue May 10 07:26:04 2016
@@ -113,12 +113,12 @@
         </tc:form>
         <tc:form>
           <tc:button immediate="true" id="previous"
-                     image="fa-chevron-left"
+                     image="fa-angle-left"
                      action="#{navigationState.gotoPrevious}"
                      disabled="#{navigationState.first}"
                      tip="#{overviewBundle.footer_previous}"/>
           <tc:button immediate="true" id="next"
-                     image="fa-chevron-right"
+                     image="fa-angle-right"
                      action="#{navigationState.gotoNext}"
                      disabled="#{navigationState.last}"
                      tip="#{overviewBundle.footer_next}"/>