***********************
Your mail has been scanned by InterScan MSS.
***********************
Hi Mario,
I thought SelectItem/converter is always used in conjunction with an input
component? Using it in conjunction with SelectOneMenu, SelectOneRadio etc
would not require this test. The following would be good enough:
public String getAsString(FacesContext context, UIComponent component,
Object value) {
if (value == null) return "";
Enum e = (Enum) value;
return e.getClass().getName() + "@" + e.ordinal();
}
Where else could the converter be used? Sorry if this is JSF 101.
Cheers,
Yee
-----Original Message-----
From: Mario Ivankovits [mailto:[EMAIL PROTECTED]
Sent: Friday, October 20, 2006 1:58 PM
To: MyFaces Discussion
Subject: Re: JSF and Java 5.0 Enums
Hi Yee!
> Qestion - what is the purpose of th e following test?
>
> if (component instanceof UIInput ||
> UIInput.COMPONENT_FAMILY.equals(component.getFamily())) {
>
The idea behind this converter is, that in case of an input component
the conversion has to be reversible (or symmetric), thus, the
[EMAIL PROTECTED] rendering, in any other case - usually output components
only - it uses enum.toString() to have a nice user-readable
representation (assumed that toString() has been overloaded)
Ciao,
Mario