Changeset 5107

Show
Ignore:
Timestamp:
07/15/08 16:45:09 (4 months ago)
Author:
magi@…
Message:

Fixes #1949.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/com/itmill/toolkit/ui/Form.java

    r5036 r5107  
    118118 
    119119    /** 
     120     * If this is true, commit implicitly calls setValidationVisible(true). 
     121     */ 
     122    private boolean validationVisibleOnCommit = true; 
     123 
     124    /** 
    120125     * Contructs a new form with default layout. 
    121126     *  
     
    218223    } 
    219224 
     225    /** 
     226     * Controls the making validation visible implicitly on commit. 
     227     *  
     228     * Having commit() call setValidationVisible(true) implicitly is the default 
     229     * behaviour. You can disable the implicit setting by setting this property 
     230     * as false. 
     231     *  
     232     * It is useful, because you usually want to start with the form free of 
     233     * errors and only display them after the user clicks Ok. You can disable 
     234     * the implicit setting by setting this property as false. 
     235     *  
     236     * @param makeVisible 
     237     *            If true (default), validation is made visible when commit() is 
     238     *            called. If false, the visibility is left as it is. 
     239     */ 
     240    public void setValidationVisibleOnCommit(boolean makeVisible) { 
     241        validationVisibleOnCommit = makeVisible; 
     242    } 
     243 
     244    /** 
     245     * Is validation made automatically visible on commit? 
     246     *  
     247     *  See setValidationVisibleOnCommit(). 
     248     *  
     249     * @return true if validation is made automatically visible on commit. 
     250     */ 
     251    public boolean isValidationVisibleOnCommit() { 
     252        return validationVisibleOnCommit; 
     253    } 
     254     
    220255    /* 
    221256     * Commit changes to the data source Don't add a JavaDoc comment here, we 
     
    228263        // Only commit on valid state if so requested 
    229264        if (!isInvalidCommitted() && !isValid()) { 
     265            if (validationVisibleOnCommit) 
     266                setValidationVisible(true); 
    230267            return; 
    231268        }