1 |
/* gnu.java.beans.editors.NativeBooleanEditor |
/* gnu.java.beans.editors.NativeBooleanEditor |
2 |
Copyright (C) 1998 Free Software Foundation, Inc. |
Copyright (C) 1998, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
54 |
public class NativeBooleanEditor extends PropertyEditorSupport { |
public class NativeBooleanEditor extends PropertyEditorSupport { |
55 |
String[] tags = {"true","false"}; |
String[] tags = {"true","false"}; |
56 |
|
|
57 |
/** setAsText for boolean checks for true or false or t or f. "" also means false. **/ |
/** |
58 |
|
* setAsText for boolean checks for true or false or t or f. |
59 |
|
* "" also means false. |
60 |
|
**/ |
61 |
public void setAsText(String val) throws IllegalArgumentException { |
public void setAsText(String val) throws IllegalArgumentException { |
62 |
if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) { |
if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) { |
|
setValue(Boolean.FALSE); |
|
|
} else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) { |
|
63 |
setValue(Boolean.TRUE); |
setValue(Boolean.TRUE); |
64 |
|
} else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) { |
65 |
|
setValue(Boolean.FALSE); |
66 |
} else { |
} else { |
67 |
throw new IllegalArgumentException("Value must be true, false, t, f or empty."); |
throw new IllegalArgumentException("Value must be true, false, t, f or empty."); |
68 |
} |
} |