View Javadoc

1   package org.starobjects.wicket.ui.components.actions;
2   
3   import org.apache.wicket.Component;
4   import org.apache.wicket.model.IModel;
5   import org.starobjects.wicket.model.models.ActionModel;
6   import org.starobjects.wicket.ui.ComponentFactory;
7   import org.starobjects.wicket.ui.ComponentFactoryAbstract;
8   import org.starobjects.wicket.ui.ComponentType;
9   
10  /**
11   * {@link ComponentFactory} for {@link ActionPanel}.
12   */
13  public class ActionPanelFactory extends ComponentFactoryAbstract {
14  
15  	private static final long serialVersionUID = 1L;
16  
17  	public ActionPanelFactory() {
18  		super(ComponentType.ACTION);
19  	}
20  
21  	@Override
22  	public ApplicationAdvice appliesTo(IModel<?> model) {
23  		return appliesIf(model instanceof ActionModel);
24  	}
25  
26  	public Component createComponent(String id, IModel<?> model) {
27  		ActionModel actionModel = (ActionModel) model;
28  		return new ActionPanel(id, actionModel);
29  	}
30  }