@Test public void testInitContextWithEmptyModel() { context.setModel(new HashMap<>()); helper.initContext(context); assertNotNull(context.getModel()); assertTrue(context.getModel() instanceof MapBindableProxy); MapBindableProxy model = (MapBindableProxy) context.getModel(); checkBindableProxy(model); assertNull(model.get(EMPLOYEE_NAME)); assertNull(model.get(EMPLOYEE_SURNAME)); assertNull(model.get(EMPLOYEE_AGE_BINDING)); assertNull(model.get(EMPLOYEE_BIRTHDAY)); assertNull(model.get(EMPLOYEE_MARRIED)); }
public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); }
MapModelBindingHelper { public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); } }
MapModelBindingHelper { public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); }  }
MapModelBindingHelper { public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); }  @PostConstruct void initialize(); void initContext(MapModelRenderingContext context); void prepareMapContent(Map<String, Object> formData,
                                  FormDefinition form,
                                  Map<String, Object> contextData,
                                  MapModelRenderingContext context); MapPropertyType getModeldefinitionFor(SubFormFieldDefinition subFormField,
                                                 MapModelRenderingContext context,
                                                 Map<String, Map<String, PropertyType>> availableModels); MapPropertyType getModeldefinitionFor(MultipleSubFormFieldDefinition subFormField,
                                                 MapModelRenderingContext context,
                                                 Map<String, Map<String, PropertyType>> availableModels); }
MapModelBindingHelper { public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); }  @PostConstruct void initialize(); void initContext(MapModelRenderingContext context); void prepareMapContent(Map<String, Object> formData,
                                  FormDefinition form,
                                  Map<String, Object> contextData,
                                  MapModelRenderingContext context); MapPropertyType getModeldefinitionFor(SubFormFieldDefinition subFormField,
                                                 MapModelRenderingContext context,
                                                 Map<String, Map<String, PropertyType>> availableModels); MapPropertyType getModeldefinitionFor(MultipleSubFormFieldDefinition subFormField,
                                                 MapModelRenderingContext context,
                                                 Map<String, Map<String, PropertyType>> availableModels);  }