summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/book/SSNField.java
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-01-02 14:40:19 +0000
committerArtur Signell <artur.signell@itmill.com>2009-01-02 14:40:19 +0000
commitd9a13c237889ba32830edb27ad34c4d9ea2f180b (patch)
treed1bda61bf6de5b5b3724eb99f2618861fb45abcb /src/com/itmill/toolkit/tests/book/SSNField.java
parent19636fc0509e45d3bcedf4d7ba92670fdea4630d (diff)
downloadvaadin-framework-d9a13c237889ba32830edb27ad34c4d9ea2f180b.tar.gz
vaadin-framework-d9a13c237889ba32830edb27ad34c4d9ea2f180b.zip
Cleaned up the whole project
svn changeset:6398/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/tests/book/SSNField.java')
-rw-r--r--src/com/itmill/toolkit/tests/book/SSNField.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/com/itmill/toolkit/tests/book/SSNField.java b/src/com/itmill/toolkit/tests/book/SSNField.java
index 0659ebb910..2dcb2d5c68 100644
--- a/src/com/itmill/toolkit/tests/book/SSNField.java
+++ b/src/com/itmill/toolkit/tests/book/SSNField.java
@@ -4,8 +4,6 @@
package com.itmill.toolkit.tests.book;
-import java.text.MessageFormat;
-
import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.data.Validator;
import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -19,7 +17,8 @@ import com.itmill.toolkit.ui.TextField;
public class SSNField extends CustomComponent implements
Property.ValueChangeListener {
OrderedLayout layout = new FormLayout();
- // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new FormLayout();
+ // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new
+ // FormLayout();
TextField myfield;
Label myerror;
@@ -39,11 +38,13 @@ public class SSNField extends CustomComponent implements
/** Validate the given SSN. */
public void validate(Object value) throws InvalidValueException {
final String ssn = (String) value;
- if (ssn.length() == 0)
- return;
+ if (ssn.length() == 0) {
+ return;
+ }
- if (ssn.length() != 11)
+ if (ssn.length() != 11) {
throw new InvalidValueException("Invalid SSN length");
+ }
final String numbers = ssn.substring(0, 6) + ssn.substring(7, 10);
final int checksum = new Integer(numbers).intValue() % 31;
@@ -66,8 +67,10 @@ public class SSNField extends CustomComponent implements
/* Create and set the validator object for the field. */
myfield.addValidator(new SSNValidator());
- /* ValueChageEvent will be generated immediately when the component
- loses focus. */
+ /*
+ * ValueChageEvent will be generated immediately when the component
+ * loses focus.
+ */
myfield.setImmediate(true);
/* Listen for ValueChangeEvent events. */