|
19 | 19 | package net.bootsfaces.component.inputSecret; |
20 | 20 |
|
21 | 21 | import javax.faces.component.FacesComponent; |
22 | | -import net.bootsfaces.C; |
23 | 22 |
|
| 23 | +import net.bootsfaces.C; |
24 | 24 | import net.bootsfaces.component.inputText.InputText; |
25 | 25 |
|
26 | 26 | /** |
|
30 | 30 |
|
31 | 31 | @FacesComponent(InputSecret.COMPONENT_TYPE) |
32 | 32 | public class InputSecret extends InputText { |
33 | | - |
34 | | - public static final String COMPONENT_TYPE=C.BSFCOMPONENT + ".inputSecret.InputSecret"; |
35 | | - |
| 33 | + |
| 34 | + public static final String COMPONENT_TYPE = C.BSFCOMPONENT + ".inputSecret.InputSecret"; |
| 35 | + |
| 36 | + protected enum PropertyKeys { |
| 37 | + renderValue; |
| 38 | + String toString; |
| 39 | + |
| 40 | + PropertyKeys(String toString) { |
| 41 | + this.toString = toString; |
| 42 | + } |
| 43 | + |
| 44 | + PropertyKeys() { |
| 45 | + } |
| 46 | + |
| 47 | + public String toString() { |
| 48 | + return ((this.toString != null) ? this.toString : super.toString()); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * By default, the value of the password field is never sent to the client. |
| 54 | + * However, if you need to send the value to the client for some reason, you can |
| 55 | + * set this flag to true. Please make sure that this is not a security hole. The |
| 56 | + * password may be unreadable on the screen, but hackers can read it easily. |
| 57 | + * <P> |
| 58 | + * |
| 59 | + * @return Returns the value of the attribute, or false, if it hasn't been set |
| 60 | + * by the JSF file. |
| 61 | + */ |
| 62 | + public boolean isRenderValue() { |
| 63 | + return (boolean) (Boolean) getStateHelper().eval(PropertyKeys.renderValue, false); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * By default, the value of the password field is never sent to the client. |
| 68 | + * However, if you need to send the value to the client for some reason, you can |
| 69 | + * set this flag to true. Please make sure that this is not a security hole. The |
| 70 | + * password may be unreadable on the screen, but hackers can read it easily. |
| 71 | + * <P> |
| 72 | + * Usually this method is called internally by the JSF engine. |
| 73 | + */ |
| 74 | + public void setRenderValue(boolean _renderValue) { |
| 75 | + getStateHelper().put(PropertyKeys.renderValue, _renderValue); |
| 76 | + } |
| 77 | + |
36 | 78 | } |
0 commit comments