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 2015/07/15 10:30:35 UTC

svn commit: r1691144 - in /myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/ValidationBean.java webapp/content/06-validation/validation.xhtml

Author: lofwyr
Date: Wed Jul 15 08:30:35 2015
New Revision: 1691144

URL: http://svn.apache.org/r1691144
Log:
currency demo

Added:
    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/webapp/content/06-validation/validation.xhtml

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationBean.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/ValidationBean.java?rev=1691144&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationBean.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ValidationBean.java Wed Jul 15 08:30:35 2015
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+@Named
+@SessionScoped
+public class ValidationBean implements Serializable {
+
+  private int number;
+  private double price;
+  private String custom;
+  private String text;
+
+  public int getNumber() {
+    return number;
+  }
+
+  public void setNumber(int number) {
+    this.number = number;
+  }
+
+  public double getPrice() {
+    return price;
+  }
+
+  public void setPrice(double price) {
+    this.price = price;
+  }
+
+  public String getCustom() {
+    return custom;
+  }
+
+  public void setCustom(String custom) {
+    this.custom = custom;
+  }
+
+  public String getText() {
+    return text;
+  }
+
+  public void setText(String text) {
+    this.text = text;
+  }
+}

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation/validation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation/validation.xhtml?rev=1691144&r1=1691143&r2=1691144&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation/validation.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation/validation.xhtml Wed Jul 15 08:30:35 2015
@@ -35,25 +35,29 @@
       <f:facet name="layout">
         <tc:gridLayout columns="1*;1*"/>
       </f:facet>
-      <tx:in label="#{overviewBundle.validation_number}" markup="number" required="true">
+      <tx:in label="#{overviewBundle.validation_number}" markup="number" required="true"
+             value="#{validationBean.number}">
         <f:validateLength minimum="7" maximum="7"/>
         <f:validateLongRange maximum="9000000"/>
       </tx:in>
-      <tx:in label="#{overviewBundle.validation_price}" markup="number">
+      <tx:in label="#{overviewBundle.validation_price}" markup="number" value="#{validationBean.price}">
         <f:validateDoubleRange minimum="0.01" maximum="1000"/>
+        <f:convertNumber pattern="#,##0.00 ¤" currencySymbol="€" type="currency" />
       </tx:in>
-      <tx:in label="#{overviewBundle.validation_custom}" validator="#{overviewController.customValidator}">
+      <tx:in label="#{overviewBundle.validation_custom}" validator="#{overviewController.customValidator}"
+             value="#{validationBean.custom}">
       </tx:in>
     </tc:panel>
 
-    <tx:textarea label="#{overviewBundle.validation_description}" required="true"/>
+    <tx:textarea label="#{overviewBundle.validation_description}" required="true" value="#{validationBean.text}"/>
 
     <tc:panel>
       <f:facet name="layout">
         <tc:gridLayout columns="1*;100px"/>
       </f:facet>
       <tc:panel/>
-      <tc:button action="#{overviewController.noop}" label="#{overviewBundle.validation_submit}"/>
+      <tc:button action="#{overviewController.noop}" label="#{overviewBundle.validation_submit}"
+          defaultCommand="true"/>
     </tc:panel>
 
   </tc:panel>