View Javadoc

1   package org.starobjects.wicket.ui.components.scalars.wizardpagedesc;
2   
3   import org.apache.wicket.Component;
4   import org.apache.wicket.model.IModel;
5   import org.starobjects.wicket.metamodel.facets.WizardPageDescriptionFacet;
6   import org.starobjects.wicket.model.models.ScalarModel;
7   import org.starobjects.wicket.ui.ComponentFactory;
8   import org.starobjects.wicket.ui.components.scalars.ComponentFactoryScalarAbstract;
9   
10  /**
11   * {@link ComponentFactory} for {@link WizardPageDescriptionPanel}.
12   */
13  public class WizardPageDescriptionPanelFactory extends ComponentFactoryScalarAbstract {
14  
15  	private static final long serialVersionUID = 1L;
16  
17  	public WizardPageDescriptionPanelFactory() {
18  		super(String.class);
19  	}
20  
21  	@Override
22  	public ApplicationAdvice appliesTo(IModel<?> model) {
23  		final ApplicationAdvice applicationAdvice = super.appliesTo(model);
24  		if (!applicationAdvice.applies()) {
25  			return applicationAdvice;
26  		}
27  		ScalarModel scalarModel = (ScalarModel) model;
28  		return appliesExclusivelyIf(scalarModel.getFacet(WizardPageDescriptionFacet.class) != null);
29  	}
30  
31  	public Component createComponent(String id, ScalarModel scalarModel) {
32  		return new WizardPageDescriptionPanel(id, scalarModel);
33  	}
34  
35  }