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/04/14 14:21:42 UTC
svn commit: r1739067 - in
/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main:
java/org/apache/myfaces/tobago/example/demo/ webapp/ webapp/WEB-INF/
webapp/content/20-component/010-input/20-suggest/ webapp/content/30-concep...
Author: lofwyr
Date: Thu Apr 14 12:21:42 2016
New Revision: 1739067
URL: http://svn.apache.org/viewvc?rev=1739067&view=rev
Log:
TOBAGO-1544: Revise Demo Application for Tobago 3.0
[developed by hnoeth]
Added:
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversionController.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/FormController.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationJsr303Controller.java
Removed:
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Conversion.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationBean.java
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Login.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/07-conversion/conversion.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/80-security/20-roles/roles.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversionController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversionController.java?rev=1739067&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversionController.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversionController.java Thu Apr 14 12:21:42 2016
@@ -0,0 +1,39 @@
+/*
+ * 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.example.demo;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@RequestScoped
+@Named
+public class ConversionController implements Serializable {
+
+ private double amount = 7200000.9876;
+
+ public double getAmount() {
+ return amount;
+ }
+
+ public void setAmount(double amount) {
+ this.amount = amount;
+ }
+}
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/FormController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/FormController.java?rev=1739067&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/FormController.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/FormController.java Thu Apr 14 12:21:42 2016
@@ -0,0 +1,57 @@
+/*
+ * 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.example.demo;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@SessionScoped
+@Named
+public class FormController implements Serializable {
+
+ private String outerValue;
+ private String innerValue1;
+ private String innerValue2;
+
+ public String getOuterValue() {
+ return outerValue;
+ }
+
+ public void setOuterValue(String outerValue) {
+ this.outerValue = outerValue;
+ }
+
+ public String getInnerValue1() {
+ return innerValue1;
+ }
+
+ public void setInnerValue1(String innerValue1) {
+ this.innerValue1 = innerValue1;
+ }
+
+ public String getInnerValue2() {
+ return innerValue2;
+ }
+
+ public void setInnerValue2(String innerValue2) {
+ this.innerValue2 = innerValue2;
+ }
+}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Login.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Login.java?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Login.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Login.java Thu Apr 14 12:21:42 2016
@@ -50,7 +50,7 @@ public class Login {
LOG.info("Successful login user: '{}'", username);
response.sendRedirect(response.encodeRedirectURL(
- request.getContextPath() + "/faces/content/30-concept/80-security/content-security-policy.xhtml"));
+ request.getContextPath() + "/faces/content/30-concept/80-security/20-roles/roles.xhtml"));
}
public void logout() throws ServletException, IOException {
@@ -60,7 +60,8 @@ public class Login {
request.logout();
- response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/"));
+ response.sendRedirect(response.encodeRedirectURL(
+ request.getContextPath() + "/faces/content/30-concept/80-security/20-roles/roles.xhtml"));
}
public String getUsername() {
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java?rev=1739067&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationController.java Thu Apr 14 12:21:42 2016
@@ -0,0 +1,44 @@
+/*
+ * 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.example.demo;
+
+import javax.enterprise.context.RequestScoped;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@RequestScoped
+@Named
+public class ValidationController implements Serializable {
+
+ public void customValidator(final FacesContext context, final UIComponent component, final Object value)
+ throws ValidatorException {
+ if (value == null) {
+ return;
+ }
+ if (!"tobago".equalsIgnoreCase(value.toString())) {
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Please type in 'Tobago'",
+ "Please type in 'Tobago'"));
+ }
+ }
+}
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationJsr303Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationJsr303Controller.java?rev=1739067&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationJsr303Controller.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationJsr303Controller.java Thu Apr 14 12:21:42 2016
@@ -0,0 +1,53 @@
+/*
+ * 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.example.demo;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+
+@RequestScoped
+@Named
+public class ValidationJsr303Controller implements Serializable {
+
+ @NotNull
+ private String required;
+
+ @Size(min = 2, max = 4, message = "Length must be between 2 and 4")
+ private String length;
+
+ public String getRequired() {
+ return required;
+ }
+
+ public void setRequired(String required) {
+ this.required = required;
+ }
+
+ public String getLength() {
+ return length;
+ }
+
+ public void setLength(String length) {
+ this.length = length;
+ }
+}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml Thu Apr 14 12:21:42 2016
@@ -174,8 +174,8 @@
<display-name>Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Application Area</web-resource-name>
- <url-pattern>/faces/content/*</url-pattern>
- <url-pattern>/content/*</url-pattern>
+ <url-pattern>/faces/content/30-concept/80-security/20-roles/*</url-pattern>
+ <url-pattern>/content/30-concept/80-security/20-roles/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>demo-admin</role-name>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml Thu Apr 14 12:21:42 2016
@@ -59,7 +59,7 @@
<tc:section label="Client sided">
<p>For optimization, the filtering can be done by the client.
For that, <code>update</code> must be 'false' and <code>minimumCharacters</code> have to be '0'.
- If client sided filtering is activated, the <code>filter</code> attribute has an effect.</p>
+ The <code>filter</code> attribute has only an effect, if client sided filtering is activated.</p>
<pre><code class="language-markup"><tc:suggest suggestMethod="\#{suggestController.getCountryLanguageList}"
update="false" minimumCharacters="0" filter="prefix"/></code></pre>
<tc:in id="i3" label="Language" value="#{suggestController.suggestInput}">
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/06-validation/01/validation-jsr303.xhtml Thu Apr 14 12:21:42 2016
@@ -21,33 +21,30 @@
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="JSR-303: Bean Validation"/>
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout rows="40px;auto;auto;*;auto"/>
- </f:facet>
-
- <tc:out value="TODO: Explain JSR-303 Bean Validation"/>
-
- <tc:messages/>
-
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto;auto;auto"/>
- </f:facet>
- <tc:in label="Required" value="#{jsr303.required}"/>
- <tc:in label="Length" value="#{jsr303.length}"/>
- </tc:panel>
-
- <tc:panel/>
-
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout columns="1*;100px"/>
- </f:facet>
- <tc:panel/>
- <tc:button action="#{jsr303.action}" label="#{overviewBundle.validation_submit}"/>
- </tc:panel>
-
- </tc:panel>
+ <ui:param name="title" value="#{overviewBundle.validation_jsr303}"/>
+ <p>Tobago has JSR 303 Validation support.
+ With it, you can describe the validation in an annotation in the controller.</p>
+
+ <tc:section label="Required">
+ <p>In this example, the input cannot be empty - in other words, it's required.
+ The value in the controller is annotated with <code class="language-java">@NotNull</code>.</p>
+ <pre><code class="language-markup"><tc:in label="Input" value="\#{validationJsr303Controller.required}"/></code></pre>
+ <pre><code class="language-java">@NotNull
+private String required;</code></pre>
+ <tc:form>
+ <tc:in label="Input (required)" value="#{validationJsr303Controller.required}"/>
+ <tc:button label="Submit"/>
+ </tc:form>
+ </tc:section>
+
+ <tc:section label="Length">
+ <p>The length of the given string must be between 2 and 4 characters.</p>
+ <pre><code class="language-markup"><tc:in label="Input" value="\#{validationJsr303Controller.length}"/></code></pre>
+ <pre><code class="language-java">@Size(min = 2, max = 4, message = "Length must be between 2 and 4")
+private String length;</code></pre>
+ <tc:form>
+ <tc:in label="2 to 4 Character" value="#{validationJsr303Controller.length}"/>
+ <tc:button label="Submit"/>
+ </tc:form>
+ </tc:section>
</ui:composition>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/07-conversion/conversion.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/07-conversion/conversion.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/07-conversion/conversion.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/07-conversion/conversion.xhtml Thu Apr 14 12:21:42 2016
@@ -21,20 +21,88 @@
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="Conversion"/>
- <tc:panel>
+ <ui:param name="title" value="#{overviewBundle.conversion}"/>
+ <p>To convert numbers put a <code class="language-markup"><f:convertNumber/></code> tag in an component.</p>
+ <tc:section label="Example">
+ <p>The following examples show the basic functions of the number converter.
+ The given number is in every example:</p>
+ <tc:label value="#{conversionController.amount}"/>
- <tc:out escape="false" value="JSF feature: conversion"/>
+ <tc:section label="Default">
+ <p>By default, grouping is activated and only three digits after the point are shown.
+ Also the value of <code>type</code> is 'number'.</p>
+ <pre><code class="language-markup"><tc:out label="Number"
+ markup="number" value="\#{conversionController.amount}">
+ <f:convertNumber/>
+</tc:out></code></pre>
+ <tc:out id="o1" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber/>
+ </tc:out>
+ </tc:section>
- <tc:in label="java.math.BigDecimal" markup="number" value="#{conversion.big}" id="big">
- <f:convertNumber/>
- </tc:in>
-
- <tc:flowLayout>
- <tc:style textAlign="right"/>
- <tc:button action="#{overviewController.noop}" label="#{overviewBundle.validation_submit}"
- defaultCommand="true"/>
- </tc:flowLayout>
+ <tc:section label="Grouping">
+ <p>Grouping is deactivated.</p>
+ <pre><code class="language-markup"><f:convertNumber groupingUsed="false"/></code></pre>
+ <tc:out id="o2" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber groupingUsed="false"/>
+ </tc:out>
+ </tc:section>
- </tc:panel>
+ <tc:section label="Integer only">
+ <p>Only integer values are shown.</p>
+ <pre><code class="language-markup"><f:convertNumber integerOnly="true"/></code></pre>
+ <tc:out id="o3" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber integerOnly="true"/>
+ </tc:out>
+ </tc:section>
+
+ <tc:section label="Minimal Digits">
+ <p>There are at minimum 10 integer digits and 5 digits after the point shown.
+ The given amount is not high enough in both ways. </p>
+ <pre><code class="language-markup"><f:convertNumber minIntegerDigits="10" minFractionDigits="5"/></code></pre>
+ <tc:out id="o4" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber minIntegerDigits="10" minFractionDigits="5"/>
+ </tc:out>
+ </tc:section>
+
+ <tc:section label="Maximal Digits">
+ <p>There are maximal 6 integer digits and 2 digits after the point shown.
+ Notice, that the second digit after the point is rounded up.</p>
+ <pre><code class="language-markup"><f:convertNumber maxIntegerDigits="6" maxFractionDigits="2"/></code></pre>
+ <tc:out id="o5" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber maxIntegerDigits="6" maxFractionDigits="2"/>
+ </tc:out>
+ </tc:section>
+
+ <tc:section label="Type">
+ <p>The <code>type</code> attribute can have the value 'number' (default), 'currency' and 'percent'.
+ If the type is set to 'currency', a code or a symbol must be set. Have a look at the following examples.</p>
+
+ <tc:section label="Currency Code">
+ <p>The currency code is set to 'EUR'. Also the type must set to 'currency', otherwise the
+ <code>currencyCode</code> attribute has no effect.</p>
+ <pre><code class="language-markup"><f:convertNumber type="currency" currencyCode="EUR"/></code></pre>
+ <tc:out id="i6" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber type="currency" currencyCode="EUR"/>
+ </tc:out>
+ </tc:section>
+
+ <tc:section label="Currency Symbol">
+ <p>The currency symbol is set to 'â¬'. Also the type must set to 'currency', otherwise the
+ <code>currencyCode</code> attribute has no effect.</p>
+ <pre><code class="language-markup"><f:convertNumber type="currency" currencySymbol="â¬"/></code></pre>
+ <tc:out id="i7" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber type="currency" currencySymbol="â¬"/>
+ </tc:out>
+ </tc:section>
+
+ <tc:section label="Percent">
+ <p>The type is set to 'percent'.</p>
+ <pre><code class="language-markup"><f:convertNumber type="percent"/></code></pre>
+ <tc:out id="i8" label="Number" markup="number" value="#{conversionController.amount}">
+ <f:convertNumber type="percent"/>
+ </tc:out>
+ </tc:section>
+ </tc:section>
+ </tc:section>
</ui:composition>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/08-form/form.xhtml Thu Apr 14 12:21:42 2016
@@ -18,69 +18,61 @@
-->
<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.form}"/>
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout/>
- </f:facet>
-
- <!--
- <tc:out escape="false" value="#{overviewBundle.form_text1}" />
- -->
-
- <tc:box label="#{overviewBundle.form_outTitle}">
- <f:facet name="layout">
- <tc:gridLayout rows="80px;auto;auto;auto;auto"/>
- </f:facet>
-
- <tc:out escape="false" value="#{overviewBundle.form_text2}"/>
-
- <tc:box label="#{overviewBundle.form_in1Title}">
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto;" columns="1*;100px"/>
- </f:facet>
-
- <tc:form id="form1">
- <tc:in value="#{demo.text[0]}" required="true" label="#{overviewBundle.newValue1}"/>
- <tc:button label="#{overviewBundle.submitForm1}">
- <tc:gridLayoutConstraint rowSpan="2"/>
- </tc:button>
- <tc:in value="#{demo.text[0]}" readonly="true" label="#{overviewBundle.modelValue1}"/>
- </tc:form>
-
- </tc:box>
-
- <tc:box label="#{overviewBundle.form_in2Title}">
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto" columns="1*;100px"/>
- </f:facet>
-
- <tc:form id="form2">
- <tc:in value="#{demo.text[1]}" required="true" label="#{overviewBundle.newValue2}"/>
- <tc:button label="#{overviewBundle.submitForm2}">
- <tc:gridLayoutConstraint rowSpan="2"/>
- </tc:button>
- <tc:in value="#{demo.text[1]}" readonly="true" label="#{overviewBundle.modelValue2}"/>
- </tc:form>
- </tc:box>
-
- <tc:separator label="#{overviewBundle.form_outTitle}" />
-
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto" columns="*;100px"/>
- </f:facet>
-
- <tc:in value="#{demo.text[2]}" required="true" label="#{overviewBundle.newValue2}"/>
- <tc:button label="#{overviewBundle.submitAll}">
- <tc:gridLayoutConstraint rowSpan="2"/>
- </tc:button>
- <tc:in value="#{demo.text[2]}" readonly="true" label="#{overviewBundle.modelValue2}"/>
-
- </tc:panel>
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <ui:param name="title" value="#{overviewBundle.form} <tc:form>"/>
+ <p>Tobago supports nested forms and can treat each form separately.
+ Values can be stored separately into the model, while already filled input elements keep their values (temporarily).
+ If the validation of a form is activated but the actual value of this form is only stored temporarily,
+ the validation is deactivated until the value is definitely stored into the model.
+ Forms are add by the <code class="language-markup"><tc:form/></code> tag.</p>
+ <p>Forms are also relevant for
+ <tc:link label="#{overviewBundle.default_command}"
+ resource="/faces/content/20-component/040-command/00-default/default-command.xhtml"/>.</p>
+ <tc:link label="Tag Library Documentation" image="image/feather-leaf.png"
+ link="#{overviewBundle.tagDocUrl}/form.html"/>
+
+ <tc:section label="Example">
+ <p>Every form in this example is surrounded by a content box.
+ The submit buttons in the inner forms only put the inner value into the model.
+ The submit button in the outer form put all values into the model.
+ Notice, that the inputfield in the outer form is required.</p>
+
+ <pre><code class="language-markup"><tc:form>
+ <tc:form>
+ <tc:in label="Inner Value 1" value="\#{formController.innerValue1}"/>
+ ...
+ </tc:form>
+ <tc:form>
+ <tc:in label="Inner Value 2" value="\#{formController.innerValue2}"/>
+ ...
+ </tc:form>
+ <tc:in label="Outer Value" required="true" value="\#{formController.outerValue}"/>
+ ...
+</tc:form></code></pre>
+
+ <tc:box label="Outer Form">
+ <tc:form>
+ <tc:box label="Inner Form 1">
+ <tc:form>
+ <tc:in label="Inner Value 1" value="#{formController.innerValue1}"/>
+ <tc:out label="Value in Model" value="#{formController.innerValue1}"/>
+ <tc:button label="Submit"/>
+ </tc:form>
+ </tc:box>
+ <tc:box label="Inner Form 2">
+ <tc:form>
+ <tc:in label="Inner Value 2" value="#{formController.innerValue2}"/>
+ <tc:out label="Value in Model" value="#{formController.innerValue2}"/>
+ <tc:button label="Submit"/>
+ </tc:form>
+ </tc:box>
+ <tc:separator/>
+ <tc:in label="Outer Value" required="true" value="#{formController.outerValue}"/>
+ <tc:out label="Value in Model" value="#{formController.outerValue}"/>
+ <tc:button label="Submit"/>
+ </tc:form>
</tc:box>
- </tc:panel>
+ </tc:section>
</ui:composition>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/80-security/20-roles/roles.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/80-security/20-roles/roles.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/80-security/20-roles/roles.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/80-security/20-roles/roles.xhtml Thu Apr 14 12:21:42 2016
@@ -50,6 +50,10 @@ admin: admin,demo-admin</code></pre>
<tc:section label="Example">
<p>In this example there are two content boxes. The left one is for admin users.
The right one is for guests and admins.</p>
+ <p>If you run the demo on your local machine, you may change the scope of the
+ <code>RoleController</code> from <code class="language-java">@SessionScoped</code> to
+ <code class="language-java">@ApplicationScoped</code>.
+ In that case, the guest can read the text added by the admin.</p>
<tc:segmentLayout medium="6;6">
<tc:box label="Admin Box">
<p>This is a box only for admins. A text can be added in the inputfield.
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml Thu Apr 14 12:21:42 2016
@@ -18,30 +18,24 @@
-->
<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">
-
- <ui:param name="title" value="Login"/>
+ <ui:param name="title" value="#{overviewBundle.login}"/>
+ <p>This login site is only to demonstrate roles.
+ After login, you will be redirected to the roles page.</p>
<tc:section label="Login">
-
- <p>
- Use one of the following users to login
- (Shortcuts:
+ <p>Use one of the following users to login (Shortcuts:
<tc:link label="guest/guest" omit="true">
<tc:dataAttribute name="login" value='{"username": "guest", "password": "guest"}'/>
</tc:link>
or
<tc:link label="admin/admin" omit="true">
<tc:dataAttribute name="login" value='{"username": "admin", "password": "admin"}'/>
- </tc:link>).
- </p>
-
- <tc:in id="username" value="#{login.username}" label="User"/>
+ </tc:link>).</p>
+ <tc:in id="username" value="#{login.username}" label="User" focus="true"/>
<tc:in id="password" value="#{login.password}" password="true" label="Password"/>
-
<tc:button id="login" action="#{login.login}" label="Login" defaultCommand="true"/>
-
</tc:section>
-
</ui:composition>
Modified: myfaces/tobago/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Thu Apr 14 12:21:42 2016
@@ -19,11 +19,12 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
- <entry key="tobago_url">http://myfaces.apache.org/tobago</entry>
+ <entry key="tobago_url">http://myfaces.apache.org/tobago</entry>
+ <entry key="notTranslated">Sorry, not completely translated yet.</entry>
+ <entry key="pageTitle">Tobago Demo</entry>
-<entry key="notTranslated">Sorry, not completely translated yet.</entry>
-<entry key="pageTitle">Tobago Demo</entry>
+ <entry key="login">Login</entry>
<!-- menu -->
<entry key="menu_navigate">_Navigation</entry>
@@ -33,8 +34,10 @@
<entry key="menu_locale">_Locale</entry>
<entry key="menu_about">About</entry>
-<!-- navigate -->
+ <!-- navigate -->
<entry key="intro">Intro</entry>
+
+ <!-- navigate : components -->
<entry key="component">Components</entry>
<entry key="input">Input Fields</entry>
<entry key="in">Input</entry>
@@ -90,12 +93,17 @@
<entry key="wysiwyg_editor">WYSIWYG Editor</entry>
<entry key="tinymce">TinyMCE</entry>
<entry key="ckeditor">CKEditor</entry>
+
+ <!-- navigate : concept -->
+ <entry key="concept">Concepts</entry>
<entry key="validation">Validation</entry>
+ <entry key="validation_jsr303">JSR 303: Bean Validation</entry>
+ <entry key="conversion">Conversion</entry>
+ <entry key="form">Forms</entry>
<entry key="roles">Roles</entry>
<entry key="validation-severity">Severity</entry>
- <entry key="form">Forms</entry>
<entry key="theme">Themes</entry>
<entry key="browser">Browser</entry>
<entry key="locale">Locale</entry>
@@ -297,15 +305,6 @@
<li style="line-height: 130%;">If the first input contains an error but the second
one validates, the validation of the first form is deactivated.</li>
</entry>
-<entry key="form_text2">Tobago supports nested forms and can treat each form seperatly:
-<ul style="margin-top: 2px;">
-<li style="line-height: 130%;">Values can be stored seperatly into the model
- while already filled in input elements keep their values (temporarily)</li>
-<li style="line-height: 130%;">If the validation of a form is activated
- but the actual value of this form is only stored temporarily, the validation
- is deactivated until the value is definitly stored into the model. </li>
-</ul>
- </entry>
<entry key="form_in1Title">First inner form</entry>
<entry key="form_in2Title">Second inner form</entry>
<entry key="newValue1">New model-value</entry>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml?rev=1739067&r1=1739066&r2=1739067&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview_de.properties.xml Thu Apr 14 12:21:42 2016
@@ -34,7 +34,6 @@
<entry key="overview">Ãbersicht</entry>
<entry key="toolbar">Toolbar</entry>
<entry key="validation">Validierung</entry>
- <entry key="form">Formulare</entry>
<entry key="themes">Designs</entry>
<!-- browser=Browser -->
<entry key="locale">Lokalisierung</entry>