Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / util / NotEmptyValidator.java @ 15280

History | View | Annotate | Download (930 Bytes)

1
//******************************************************************
2
// NotEmptyValidator
3
// Copyright ? 2003 by Tino Schwarze
4
//******************************************************************
5
package com.izforge.izpack.util;
6

    
7
import com.izforge.izpack.panels.ProcessingClient;
8
import com.izforge.izpack.panels.Validator;
9

    
10
/**
11
 * A validator to enforce non-empty fields.
12
 * 
13
 * This validator can be used for rule input fields in the UserInputPanel to make
14
 * sure that the user entered something.
15
 * 
16
 * @author tisc
17
 */
18
public class NotEmptyValidator implements Validator
19
{
20

    
21
  public boolean validate(ProcessingClient client)
22
  {
23
    int numfields = client.getNumFields();
24
    
25
    for (int i = 0; i < numfields; i++)
26
    {
27
      String value = client.getFieldContents(i);
28
      
29
      if ((value == null) || (value.length() == 0))
30
        return false;
31
    }
32
    
33
    return true;
34
  }
35

    
36
}