/** * Creates a module to be added to the currently selected module as child. * * @param parentModule the parent module. * @param childComponentDescriptor the child component descriptor. * @param childModuleObject the child module object to create the child module for. * @param context the action context. * @return the created child module. */ @SuppressWarnings("unchecked") protected Module createChildModule( Module parentModule, IComponentDescriptor<?> childComponentDescriptor, Object childModuleObject, Map<String, Object> context) { BeanModule childModule = new BeanModule(); IViewDescriptor projectedViewDescriptor = getChildModuleProjectedViewDescriptor(context); if (projectedViewDescriptor != null) { childModule.setProjectedViewDescriptor(projectedViewDescriptor); } else if (parentModule instanceof BeanCollectionModule) { childModule.setProjectedViewDescriptor( ((BeanCollectionModule) parentModule).getElementViewDescriptor()); } childModule.setComponentDescriptor((IComponentDescriptor<Object>) childComponentDescriptor); childModule.setModuleObject(childModuleObject); childModule.setI18nName(String.valueOf(childModuleObject)); return childModule; }
/** {@inheritDoc} */ @Override public BeanModule clone() { BeanModule clone = (BeanModule) super.clone(); clone.moduleObject = null; return clone; }