On 6/19/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Maybe a bit OT, but how exactly do you implement this Jan?
The project I'm working on has:
public final class ValidationListener implements
IComponentOnBeforeRenderListener {
public void onBeforeRender(Component component) {
if (component instanceof FormComponent && !component.hasBeenRendered()) {
processComponent((FormComponent) component);
}
}
...
and then somewhere in processComponent:
...
Column column = field.getAnnotation(Column.class);
Class<?> type = field.getType();
..
if (column.nullable() == false && type != Boolean.class && type !=
Boolean.TYPE) {
component.setRequired(true);
}
processComponent starts like this:
public static void processComponent(FormComponent component) {
IModel model = component.getModel();
if (model instanceof IPropertyReflectionAwareModel) {
Field field = ((IPropertyReflectionAwareModel)
model).getPropertyField();
if (field != null) {
processComponentField(field, (FormComponent)
component);
Eelco