addUnderlyingViews(underlyingId, model, factory);
}
private void addUnderlyingViews(final String underlyingId, final T model, final ComponentFactory factory) {
final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
final ComponentFactory firstComponentFactory = componentFactories.get(0);
final Model<ComponentFactory> componentFactoryModel = new Model<ComponentFactory>();
componentFactoryModel.setObject(firstComponentFactory);
if (componentFactories.size() > 1) {
final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
final DropDownChoiceComponentFactory viewsDropDown = new DropDownChoiceComponentFactory(ID_VIEWS_DROP_DOWN, componentFactoryModel, componentFactories, this, underlyingId, model);
views.addOrReplace(viewsDropDown);
addOrReplace(views);
} else {
permanentlyHide(ID_VIEWS);
}
addOrReplace(firstComponentFactory.createComponent(underlyingId, model));
}