@Test public void testInitContextWithModel() { Map<String, Object> employeeMap = new HashMap<>(); employeeMap.put(EMPLOYEE_NAME, NAME); employeeMap.put(EMPLOYEE_SURNAME, SURNAME); employeeMap.put(EMPLOYEE_AGE_BINDING, AGE); employeeMap.put(EMPLOYEE_BIRTHDAY, BIRTHDAY); employeeMap.put(EMPLOYEE_MARRIED, MARRIED); Map<String, Object> addressMap = new HashMap<>(); addressMap.put(ADDRESS_STREET, STREET); addressMap.put(ADDRESS_NUM, NUM); employeeMap.put(EMPLOYEE_ADDRESS, addressMap); context.setModel(employeeMap); helper.initContext(context); assertNotNull(context.getModel()); assertTrue(context.getModel() instanceof MapBindableProxy); MapBindableProxy model = (MapBindableProxy) context.getModel(); checkBindableProxy(model); checkModelPropertyValue(model, EMPLOYEE_NAME, NAME); checkModelPropertyValue(model, EMPLOYEE_SURNAME, SURNAME); checkModelPropertyValue(model, EMPLOYEE_AGE_BINDING, AGE); checkModelPropertyValue(model, EMPLOYEE_BIRTHDAY, BIRTHDAY); checkModelPropertyValue(model, EMPLOYEE_MARRIED, MARRIED); assertNotNull(model.get(EMPLOYEE_ADDRESS)); assertTrue(model.get(EMPLOYEE_ADDRESS) instanceof MapBindableProxy); MapBindableProxy addressModel = (MapBindableProxy) model.get(EMPLOYEE_ADDRESS); checkModelPropertyValue(addressModel, ADDRESS_STREET, STREET); checkModelPropertyValue(addressModel, ADDRESS_NUM, NUM); }
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);  }