Subversion Repository Public Repository

litesoft

Diff Revisions 629 vs 630 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/fieldsupport/AbstractGeneratedStringInputField.java

Diff revisions: vs.
  @@ -1,44 +1,37 @@
1 1 package com.temp.client.foundation.widget.input.fieldsupport;
2 2
3 - import com.temp.shared.utils.*;
4 - import com.temp.shared.validators.*;
3 + import com.temp.shared.utils.Validate;
4 + import com.temp.shared.validators.MaxLengthValueValidator;
5 5
6 - public abstract class AbstractGeneratedStringInputField extends AbstractGeneratedInputField<String>
7 - {
6 + public abstract class AbstractGeneratedStringInputField<C extends AbstractGeneratedStringInputField<C>> extends AbstractGeneratedInputField<String, C> {
8 7 private Integer maxLength;
9 8
10 9 // The above must be set/changed BEFORE the widget is attached!
11 10
12 - public final Integer getMaxLength()
13 - {
11 + public final Integer getMaxLength() {
14 12 return maxLength;
15 13 }
16 14
17 - public final void setMaxLength( Integer maxLength )
18 - {
19 - assertBuildMode( "setMaxLength" );
20 - setValidatedMaxLength( Validate.optionalLength( "MaxLength", maxLength ) );
15 + public final void setMaxLength(Integer maxLength) {
16 + assertBuildMode("setMaxLength");
17 + setValidatedMaxLength(Validate.optionalLength("MaxLength", maxLength));
21 18 }
22 19
23 - public AbstractGeneratedStringInputField maxLength( int maxLength )
24 - {
25 - assertBuildMode( "maxLength" );
26 - setValidatedMaxLength( Validate.optionalLength( "MaxLength", maxLength ) );
27 - return this;
20 + public C maxLength(int maxLength) {
21 + assertBuildMode("maxLength");
22 + setValidatedMaxLength(Validate.optionalLength("MaxLength", maxLength));
23 + return inheritanceLeaf();
28 24 }
29 25
30 - protected void setValidatedMaxLength( Integer maxLength )
31 - {
26 + protected void setValidatedMaxLength(Integer maxLength) {
32 27 this.maxLength = maxLength;
33 28 }
34 29
35 30 @Override
36 - protected void augmentValidator( InputWidgetValidator<String> validator )
37 - {
38 - if ( maxLength != null )
39 - {
40 - addTo( validator, new MaxLengthValueValidator( maxLength ) );
31 + protected void augmentValidator(InputWidgetValidator<String> validator) {
32 + if (maxLength != null) {
33 + addTo(validator, new MaxLengthValueValidator(maxLength));
41 34 }
42 - super.augmentValidator( validator );
35 + super.augmentValidator(validator);
43 36 }
44 37 }