Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.temp.client.foundation.widget.input.fieldsupport;

import com.temp.shared.utils.Validate;
import com.temp.shared.validators.MaxLengthValueValidator;

public abstract class AbstractGeneratedStringInputField<C extends AbstractGeneratedStringInputField<C>> extends AbstractGeneratedInputField<String, C> {
    private Integer maxLength;

    public final Integer getMaxLength() {
        return maxLength;
    }

    public final void setMaxLength(Integer maxLength) {
        assertBuildMode("setMaxLength");
        setValidatedMaxLength(Validate.optionalLength("MaxLength", maxLength));
    }

    public C maxLength(int maxLength) {
        assertBuildMode("maxLength");
        setValidatedMaxLength(Validate.optionalLength("MaxLength", maxLength));
        return inheritanceLeaf();
    }

    protected void setValidatedMaxLength(Integer maxLength) {
        this.maxLength = maxLength;
    }

    // The above must be set/changed BEFORE the widget is attached!

    @Override
    protected void augmentValidator(InputWidgetValidator<String> validator) {
        if (maxLength != null) {
            addTo(validator, new MaxLengthValueValidator(maxLength));
        }
        super.augmentValidator(validator);
    }
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/fieldsupport/AbstractGeneratedStringInputField.java

Diff revisions: vs.
Revision Author Commited Message
632 Diff Diff GeorgeS picture GeorgeS Wed 18 Apr, 2012 18:11:29 +0000
630 Diff Diff GeorgeS picture GeorgeS Tue 17 Apr, 2012 20:22:17 +0000
629 GeorgeS picture GeorgeS Tue 17 Apr, 2012 05:47:55 +0000