Search in sources :

Example 36 with ModelFormField

use of org.apache.ofbiz.widget.model.ModelFormField in project ofbiz-framework by apache.

the class FoFormRenderer method renderFileField.

public void renderFileField(Appendable writer, Map<String, Object> context, FileField textField) throws IOException {
    ModelFormField modelFormField = textField.getModelFormField();
    this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
    appendWhitespace(writer);
}
Also used : ModelFormField(org.apache.ofbiz.widget.model.ModelFormField)

Example 37 with ModelFormField

use of org.apache.ofbiz.widget.model.ModelFormField in project ofbiz-framework by apache.

the class FoFormRenderer method renderHyperlinkField.

public void renderHyperlinkField(Appendable writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException {
    ModelFormField modelFormField = hyperlinkField.getModelFormField();
    this.makeBlockString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
    appendWhitespace(writer);
}
Also used : ModelFormField(org.apache.ofbiz.widget.model.ModelFormField)

Example 38 with ModelFormField

use of org.apache.ofbiz.widget.model.ModelFormField in project ofbiz-framework by apache.

the class FoFormRenderer method renderDateFindField.

public void renderDateFindField(Appendable writer, Map<String, Object> context, DateFindField dateFindField) throws IOException {
    ModelFormField modelFormField = dateFindField.getModelFormField();
    this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
    appendWhitespace(writer);
}
Also used : ModelFormField(org.apache.ofbiz.widget.model.ModelFormField)

Example 39 with ModelFormField

use of org.apache.ofbiz.widget.model.ModelFormField in project ofbiz-framework by apache.

the class FoFormRenderer method renderTextField.

public void renderTextField(Appendable writer, Map<String, Object> context, TextField textField) throws IOException {
    ModelFormField modelFormField = textField.getModelFormField();
    this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
    appendWhitespace(writer);
}
Also used : ModelFormField(org.apache.ofbiz.widget.model.ModelFormField)

Example 40 with ModelFormField

use of org.apache.ofbiz.widget.model.ModelFormField in project ofbiz-framework by apache.

the class ArtifactInfoGatherer method visitModelForm.

public void visitModelForm(ModelForm modelForm) throws Exception {
    if (modelForm.getActions() != null) {
        for (ModelAction action : modelForm.getActions()) {
            action.accept(this);
        }
    }
    if (modelForm.getRowActions() != null) {
        for (ModelAction action : modelForm.getRowActions()) {
            action.accept(this);
        }
    }
    for (AutoFieldsEntity autoFieldsEntity : modelForm.getAutoFieldsEntities()) {
        infoContext.addEntityName(autoFieldsEntity.entityName);
    }
    for (AutoFieldsService autoFieldsService : modelForm.getAutoFieldsServices()) {
        infoContext.addServiceName(autoFieldsService.serviceName);
    }
    if (modelForm.getAltTargets() != null) {
        for (AltTarget altTarget : modelForm.getAltTargets()) {
            String target = altTarget.targetExdr.getOriginal();
            String urlMode = "intra-app";
            try {
                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
                if (controllerLocAndRequestSet != null) {
                    for (String requestLocation : controllerLocAndRequestSet) {
                        infoContext.addTargetLocation(requestLocation);
                    }
                }
            } catch (GeneralException e) {
                throw new RuntimeException(e);
            }
        }
    }
    if (!modelForm.getTarget().isEmpty()) {
        String target = modelForm.getTarget();
        String urlMode = UtilValidate.isNotEmpty(modelForm.getTargetType()) ? modelForm.getTargetType() : "intra-app";
        if (target.indexOf("${") < 0) {
            try {
                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
                if (controllerLocAndRequestSet != null) {
                    for (String requestLocation : controllerLocAndRequestSet) {
                        infoContext.addTargetLocation(requestLocation);
                    }
                }
            } catch (GeneralException e) {
                throw new RuntimeException(e);
            }
        }
    }
    FieldInfoGatherer fieldInfoGatherer = new FieldInfoGatherer();
    for (ModelFormField modelFormField : modelForm.getFieldList()) {
        if (UtilValidate.isNotEmpty(modelFormField.getEntityName())) {
            infoContext.addEntityName(modelFormField.getEntityName());
        }
        if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) {
            infoContext.addEntityName(((ModelFormField.DisplayEntityField) modelFormField.getFieldInfo()).getEntityName());
        }
        if (modelFormField.getFieldInfo() instanceof FieldInfoWithOptions) {
            for (ModelFormField.OptionSource optionSource : ((FieldInfoWithOptions) modelFormField.getFieldInfo()).getOptionSources()) {
                if (optionSource instanceof ModelFormField.EntityOptions) {
                    infoContext.addEntityName(((ModelFormField.EntityOptions) optionSource).getEntityName());
                }
            }
        }
        if (UtilValidate.isNotEmpty(modelFormField.getServiceName())) {
            infoContext.addServiceName(modelFormField.getServiceName());
        }
        FieldInfo fieldInfo = modelFormField.getFieldInfo();
        if (fieldInfo != null) {
            fieldInfo.accept(fieldInfoGatherer);
        }
    }
}
Also used : GeneralException(org.apache.ofbiz.base.util.GeneralException) AutoFieldsService(org.apache.ofbiz.widget.model.ModelForm.AutoFieldsService) ModelFormField(org.apache.ofbiz.widget.model.ModelFormField) AltTarget(org.apache.ofbiz.widget.model.ModelForm.AltTarget) FieldInfoWithOptions(org.apache.ofbiz.widget.model.ModelFormField.FieldInfoWithOptions) AutoFieldsEntity(org.apache.ofbiz.widget.model.ModelForm.AutoFieldsEntity) ModelAction(org.apache.ofbiz.widget.model.ModelAction) DisplayEntityField(org.apache.ofbiz.widget.model.ModelFormField.DisplayEntityField) FieldInfo(org.apache.ofbiz.widget.model.FieldInfo)

Aggregations

ModelFormField (org.apache.ofbiz.widget.model.ModelFormField)40 StringWriter (java.io.StringWriter)19 FieldInfo (org.apache.ofbiz.widget.model.FieldInfo)6 LinkedList (java.util.LinkedList)5 ModelForm (org.apache.ofbiz.widget.model.ModelForm)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Locale (java.util.Locale)3 ModelSingleForm (org.apache.ofbiz.widget.model.ModelSingleForm)3 TreeMap (java.util.TreeMap)2 HttpSession (javax.servlet.http.HttpSession)2 DisplayEntityField (org.apache.ofbiz.widget.model.ModelFormField.DisplayEntityField)2 Calendar (com.ibm.icu.util.Calendar)1 Timestamp (java.sql.Timestamp)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 TreeSet (java.util.TreeSet)1 GeneralException (org.apache.ofbiz.base.util.GeneralException)1