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.foundation.client.widget.input.fieldsupport;

import com.temp.common.shared.utils.*;
import com.temp.common.shared.validators.*;

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/foundation/client/widget/input/fieldsupport/AbstractGeneratedStringInputField.java

Diff revisions: vs.
Revision Author Commited Message
965 GeorgeS picture GeorgeS Fri 01 Aug, 2014 03:20:35 +0000

!