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);
}
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);
}
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);
}
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);
}
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);
}
}
}
Aggregations