Example usage for org.apache.wicket.markup.html.form FormComponent setDefaultModel

List of usage examples for org.apache.wicket.markup.html.form FormComponent setDefaultModel

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form FormComponent setDefaultModel.

Prototype

Component setDefaultModel(IModel<?> model);

Source Link

Usage

From source file:name.martingeisse.wicket.simpleform.DecoratorBuilder.java

License:Open Source License

/**
 * <p>/*from  w  w w  .j  a va2 s. co  m*/
 * Adds a decorator for decorated body that contains a single form component. Form component options apply.
 * </p>
 * 
 * @param decoratedBody the decorated body to wrap
 * @param formComponent the raw form component
 */
public final void addDecoratorForSingleFormComponent(final Component decoratedBody,
        final FormComponent<?> formComponent) {
    if (dataModel != null) {
        formComponent.setDefaultModel(dataModel);
    }
    if (dataConversionType != null) {
        formComponent.setType(dataConversionType);
    }
    if (requiredness != null) {
        formComponent.setRequired(requiredness);
    }
    if (formComponentBehaviors != null) {
        for (Behavior behavior : formComponentBehaviors) {
            formComponent.add(behavior);
        }
    }
    addDecorator(decoratedBody, formComponent, formComponent);
}