Examples of EntityForm


Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

        String attributeValue = element.getAttributeValue(attributeName);
       
        BindStatus bindStatus = FieldUtils.getBindStatus(arguments.getConfiguration(), arguments, attributeValue);
       
        if (bindStatus.isError()) {
            EntityForm form = (EntityForm) ((BindingResult)bindStatus.getErrors()).getTarget();
           
            // Map of tab name -> (Map field Name -> list of error messages)
            Map<String, Map<String, List<String>>> result = new HashMap<String, Map<String, List<String>>>();
            for (FieldError err : bindStatus.getErrors().getFieldErrors()) {
                //attempt to look up which tab the field error is on. If it can't be found, just use
                //the default tab for the group
                String tabName = EntityForm.DEFAULT_TAB_NAME;
                Tab tab = form.findTabForField(err.getField());
                if (tab != null) {
                    tabName = tab.getTitle();
                }
               
                Map<String, List<String>> tabErrors = result.get(tabName);
                if (tabErrors == null) {
                    tabErrors = new HashMap<String, List<String>>();
                    result.put(tabName, tabErrors);
                }
                if (err.getField().contains(DynamicEntityFormInfo.FIELD_SEPARATOR)) {
                    //at this point the field name actually occurs within some array syntax
                    String fieldName = err.getField().substring(err.getField().indexOf('[') + 1, err.getField().lastIndexOf(']'));
                    String[] fieldInfo = fieldName.split("\\" + DynamicEntityFormInfo.FIELD_SEPARATOR);
                    Field formField = form.getDynamicForm(fieldInfo[0]).getFields().get(fieldName);
                   
                    if (formField != null) {
                        addFieldError(formField.getFriendlyName(), err.getCode(), tabErrors);
                    } else {
                        LOG.warn("Could not find field " + fieldName + " within the dynamic form " + fieldInfo[0]);
                        addFieldError(fieldName, err.getCode(), tabErrors);
                    }
                } else {
                    Field formField = form.findField(err.getField());
                    if (formField != null) {
                        addFieldError(formField.getFriendlyName(), err.getCode(), tabErrors);
                    } else {
                        LOG.warn("Could not field field " + err.getField() + " within the main form");
                        addFieldError(err.getField(), err.getCode(), tabErrors);
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

    public String viewEntityForm(HttpServletRequest request, HttpServletResponse response, Model model,
            @PathVariable  Map<String, String> pathVars,
            @PathVariable(value="id") String id) throws Exception {
        // Get the normal entity form for this item
        String returnPath = super.viewEntityForm(request, response, model, pathVars, id);
        EntityForm ef = (EntityForm) model.asMap().get("entityForm");
       
        // Attach the dynamic fields to the form
        DynamicEntityFormInfo info = new DynamicEntityFormInfo()
                .withCeilingClassName(PageTemplate.class.getName())
                .withSecurityCeilingClassName(Page.class.getName())
                .withCriteriaName("constructForm")
                .withPropertyName("pageTemplate")
                .withPropertyValue(ef.findField("pageTemplate").getValue());
        EntityForm dynamicForm = getDynamicFieldTemplateForm(info, id, null);
        ef.putDynamicFormInfo("pageTemplate", info);
        ef.putDynamicForm("pageTemplate", dynamicForm);
       
        // Mark the field that will drive this dynamic form
        ef.findField("pageTemplate").setOnChangeTrigger("dynamicForm-pageTemplate");
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

        if (result.hasErrors()) {
            info = entityForm.getDynamicFormInfo("pageTemplate");
            info.setPropertyValue(entityForm.findField("pageTemplate").getValue());
           
            //grab back the dynamic form that was actually put in
            EntityForm inputDynamicForm = entityForm.getDynamicForm("pageTemplate");
           
            EntityForm dynamicForm = getDynamicFieldTemplateForm(info, id, inputDynamicForm);
            entityForm.putDynamicForm("pageTemplate", dynamicForm);
        }
       
        return returnPath;
    }
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

    public String viewEntityForm(HttpServletRequest request, HttpServletResponse response, Model model,
            @PathVariable  Map<String, String> pathVars,
            @PathVariable(value="id") String id) throws Exception {
        // Get the normal entity form for this item
        String returnPath = super.viewEntityForm(request, response, model, pathVars, id);
        EntityForm ef = (EntityForm) model.asMap().get("entityForm");
       
        // Attach the dynamic fields to the form
        DynamicEntityFormInfo info = new DynamicEntityFormInfo()
                .withCeilingClassName(StructuredContentType.class.getName())
                .withSecurityCeilingClassName(StructuredContent.class.getName())
                .withCriteriaName("constructForm")
                .withPropertyName("structuredContentType")
                .withPropertyValue(ef.findField("structuredContentType").getValue());
        EntityForm dynamicForm = getDynamicFieldTemplateForm(info, id, null);
        ef.putDynamicFormInfo("structuredContentType", info);
        ef.putDynamicForm("structuredContentType", dynamicForm);
       
        // We don't want to allow changing types once a structured content item exists
        ef.findField("structuredContentType").setReadOnly(true);
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

        if (result.hasErrors()) {
            info = entityForm.getDynamicFormInfo("structuredContentType");
            info.setPropertyValue(entityForm.findField("structuredContentType").getValue());
           
            //grab back the dynamic form that was actually put in
            EntityForm inputDynamicForm = entityForm.getDynamicForm("structuredContentType");
           
            EntityForm dynamicForm = getDynamicFieldTemplateForm(info, id, inputDynamicForm);
            entityForm.putDynamicForm("structuredContentType", dynamicForm);
        }
       
        return returnPath;
    }
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String showAddTranslation(HttpServletRequest request, HttpServletResponse response, Model model,
            @ModelAttribute(value="form") TranslationForm form, BindingResult result) throws Exception {
        adminRemoteSecurityService.securityCheck(form.getCeilingEntity(), EntityOperationType.FETCH);
       
        EntityForm entityForm = formService.buildTranslationForm(form);
       
        model.addAttribute("entityForm", entityForm);
        model.addAttribute("viewType", "modal/translationAdd");
        model.addAttribute("currentUrl", request.getRequestURL().toString());
        model.addAttribute("modalHeaderType", "addTranslation");
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

        adminRemoteSecurityService.securityCheck(form.getCeilingEntity(), EntityOperationType.FETCH);
       
        Translation t = translationService.findTranslationById(form.getTranslationId());
        form.setTranslatedValue(t.getTranslatedValue());
       
        EntityForm entityForm = formService.buildTranslationForm(form);
        entityForm.setId(String.valueOf(form.getTranslationId()));
       
        model.addAttribute("entityForm", entityForm);
        model.addAttribute("viewType", "modal/translationAdd");
        model.addAttribute("currentUrl", request.getRequestURL().toString());
        model.addAttribute("modalHeaderType", "updateTranslation");
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

        adminRemoteSecurityService.securityCheck(form.getCeilingEntity(), EntityOperationType.UPDATE);
        SectionCrumb sectionCrumb = new SectionCrumb();
        sectionCrumb.setSectionIdentifier(TranslationImpl.class.getName());
        sectionCrumb.setSectionId(String.valueOf(form.getTranslationId()));
        List<SectionCrumb> sectionCrumbs = Arrays.asList(sectionCrumb);
        EntityForm entityForm = formService.buildTranslationForm(form);
        entityForm.setCeilingEntityClassname(Translation.class.getName());
        entityForm.setEntityType(TranslationImpl.class.getName());

        Field id = new Field();
        id.setName("id");
        id.setValue(String.valueOf(form.getTranslationId()));
        entityForm.getFields().put("id", id);
        entityForm.setId(String.valueOf(form.getTranslationId()));

        service.removeEntity(entityForm, getSectionCustomCriteria(), sectionCrumbs);
        return viewTranslation(request, response, model, form, result);
    }
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

    }

    @Override
    public EntityForm createEntityForm(ClassMetadata cmd, List<SectionCrumb> sectionCrumbs)
            throws ServiceException {
        EntityForm ef = createStandardEntityForm();
        populateEntityForm(cmd, ef, sectionCrumbs);
        return ef;
    }
View Full Code Here

Examples of org.broadleafcommerce.openadmin.web.form.entity.EntityForm

    }
   
    @Override
    public EntityForm createEntityForm(ClassMetadata cmd, Entity entity, List<SectionCrumb> sectionCrumbs)
            throws ServiceException {
        EntityForm ef = createStandardEntityForm();
        populateEntityForm(cmd, entity, ef, sectionCrumbs);
        addAdditionalFormActions(ef);
        extensionManager.getProxy().addAdditionalFormActions(ef);
        return ef;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.