Hi,
there is a private _isNumericField() method inside the renderer. Not called atm.
Wouldn't it be nice, if we render a CSS rule (text-align: right;),
when the rendered input field is a numberic field ?
For that, we could do something like:
private boolean _isNumericField(
FacesBean bean
)
{
ValueExpression binding = getValueExpression(bean);
if (binding != null)
{
FacesContext context = FacesContext.getCurrentInstance();
Class type = binding.getType(context.getELContext());
return Number.class.isAssignableFrom(type) ||
(type.isPrimitive() && _NUMBER_TYPES.contains(type));
}
return false;
}
Where _NUMBER_TYPES is:
private final static Set<Class> _NUMBER_TYPES = new HashSet<Class>();
static
{
_NUMBER_TYPES.add(Byte.TYPE);
_NUMBER_TYPES.add(Short.TYPE);
_NUMBER_TYPES.add(Integer.TYPE);
_NUMBER_TYPES.add(Long.TYPE);
_NUMBER_TYPES.add(Float.TYPE);
_NUMBER_TYPES.add(Double.TYPE);
}
by making it protected, subclasses could also use it..
What do you think ?
(yes, I used unified EL in this example..., on trunk that would be
ValueBinding for instance)
-Matthias
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org