@Test public void displayFieldMacroRendered(@Mocked ModelFormField.DisplayField displayField) throws IOException { new Expectations() { { displayField.getType(); result = "TYPE"; displayField.getDescription(withNotNull()); result = "DESCRIPTION"; modelFormField.getTooltip(withNotNull()); result = "TOOLTIP"; } }; macroFormRenderer.renderDisplayField(appendable, ImmutableMap.of(), displayField); assertAndGetMacroString("renderDisplayField", ImmutableMap.of("type", "TYPE")); }
@Override public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); String idName = modelFormField.getCurrentContainerId(context); String description = displayField.getDescription(context); String type = displayField.getType(); String imageLocation = displayField.getImageLocation(context); Integer size = Integer.valueOf("0"); String title = ""; if (UtilValidate.isNotEmpty(displayField.getSize())) { try { size = Integer.parseInt(displayField.getSize()); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Error reading size of a field fieldName=" + displayField.getModelFormField().getFieldName() + " FormName= " + displayField.getModelFormField().getModelForm().getName(), MODULE); } } ModelFormField.InPlaceEditor inPlaceEditor = displayField.getInPlaceEditor(); boolean ajaxEnabled = inPlaceEditor != null && this.javaScriptEnabled; if (UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { title = description; description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); } StringWriter sr = new StringWriter(); sr.append("<@renderDisplayField "); sr.append("type=\""); sr.append(type); sr.append("\" imageLocation=\""); sr.append(imageLocation); sr.append("\" idName=\""); sr.append(idName); sr.append("\" description=\""); sr.append(encodeDoubleQuotes(description)); sr.append("\" title=\""); sr.append(title); sr.append("\" class=\""); sr.append(modelFormField.getWidgetStyle()); sr.append("\" alert=\""); sr.append(modelFormField.shouldBeRed(context) ? "true" : "false"); if (ajaxEnabled) { String url = inPlaceEditor.getUrl(context); StringBuffer extraParameterBuffer = new StringBuffer(); String extraParameter; Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context); Set<Entry<String, Object>> fieldSet = fieldMap.entrySet(); Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator(); int count = 0; extraParameterBuffer.append("{"); while (fieldIterator.hasNext()) { count++; Entry<String, Object> field = fieldIterator.next(); extraParameterBuffer.append(field.getKey() + ":'" + (String) field.getValue() + "'"); if (count < fieldSet.size()) { extraParameterBuffer.append(','); } } extraParameterBuffer.append("}"); extraParameter = extraParameterBuffer.toString(); sr.append("\" inPlaceEditorUrl=\""); sr.append(url); sr.append("\" inPlaceEditorParams=\""); StringWriter inPlaceEditorParams = new StringWriter(); inPlaceEditorParams.append("{name: '"); if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) { inPlaceEditorParams.append(inPlaceEditor.getParamName()); } else { inPlaceEditorParams.append(modelFormField.getFieldName()); } inPlaceEditorParams.append("'"); inPlaceEditorParams.append(", method: 'POST'"); inPlaceEditorParams.append(", submitdata: " + extraParameter); inPlaceEditorParams.append(", type: 'textarea'"); inPlaceEditorParams.append(", select: 'true'"); inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}"); if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) { inPlaceEditorParams.append(", cancel: '" + inPlaceEditor.getCancelText() + "'"); } else { inPlaceEditorParams.append(", cancel: 'Cancel'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) { inPlaceEditorParams.append(", tooltip: '" + inPlaceEditor.getClickToEditText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) { inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName() + "'"); } else { inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) { inPlaceEditorParams.append(", indicator: '" + inPlaceEditor.getLoadingText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append(", submit: "); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } inPlaceEditorParams.append(inPlaceEditor.getOkControl()); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } } else { inPlaceEditorParams.append(", submit: 'OK'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) { inPlaceEditorParams.append(", rows: '" + inPlaceEditor.getRows() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getCols())) { inPlaceEditorParams.append(", cols: '" + inPlaceEditor.getCols() + "'"); } inPlaceEditorParams.append("}"); sr.append(inPlaceEditorParams.toString()); } sr.append("\" />"); executeMacro(writer, sr.toString()); if (displayField instanceof DisplayEntityField) { makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } this.appendTooltip(writer, context, modelFormField); }
MacroFormRenderer implements FormStringRenderer { @Override public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); String idName = modelFormField.getCurrentContainerId(context); String description = displayField.getDescription(context); String type = displayField.getType(); String imageLocation = displayField.getImageLocation(context); Integer size = Integer.valueOf("0"); String title = ""; if (UtilValidate.isNotEmpty(displayField.getSize())) { try { size = Integer.parseInt(displayField.getSize()); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Error reading size of a field fieldName=" + displayField.getModelFormField().getFieldName() + " FormName= " + displayField.getModelFormField().getModelForm().getName(), MODULE); } } ModelFormField.InPlaceEditor inPlaceEditor = displayField.getInPlaceEditor(); boolean ajaxEnabled = inPlaceEditor != null && this.javaScriptEnabled; if (UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { title = description; description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); } StringWriter sr = new StringWriter(); sr.append("<@renderDisplayField "); sr.append("type=\""); sr.append(type); sr.append("\" imageLocation=\""); sr.append(imageLocation); sr.append("\" idName=\""); sr.append(idName); sr.append("\" description=\""); sr.append(encodeDoubleQuotes(description)); sr.append("\" title=\""); sr.append(title); sr.append("\" class=\""); sr.append(modelFormField.getWidgetStyle()); sr.append("\" alert=\""); sr.append(modelFormField.shouldBeRed(context) ? "true" : "false"); if (ajaxEnabled) { String url = inPlaceEditor.getUrl(context); StringBuffer extraParameterBuffer = new StringBuffer(); String extraParameter; Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context); Set<Entry<String, Object>> fieldSet = fieldMap.entrySet(); Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator(); int count = 0; extraParameterBuffer.append("{"); while (fieldIterator.hasNext()) { count++; Entry<String, Object> field = fieldIterator.next(); extraParameterBuffer.append(field.getKey() + ":'" + (String) field.getValue() + "'"); if (count < fieldSet.size()) { extraParameterBuffer.append(','); } } extraParameterBuffer.append("}"); extraParameter = extraParameterBuffer.toString(); sr.append("\" inPlaceEditorUrl=\""); sr.append(url); sr.append("\" inPlaceEditorParams=\""); StringWriter inPlaceEditorParams = new StringWriter(); inPlaceEditorParams.append("{name: '"); if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) { inPlaceEditorParams.append(inPlaceEditor.getParamName()); } else { inPlaceEditorParams.append(modelFormField.getFieldName()); } inPlaceEditorParams.append("'"); inPlaceEditorParams.append(", method: 'POST'"); inPlaceEditorParams.append(", submitdata: " + extraParameter); inPlaceEditorParams.append(", type: 'textarea'"); inPlaceEditorParams.append(", select: 'true'"); inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}"); if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) { inPlaceEditorParams.append(", cancel: '" + inPlaceEditor.getCancelText() + "'"); } else { inPlaceEditorParams.append(", cancel: 'Cancel'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) { inPlaceEditorParams.append(", tooltip: '" + inPlaceEditor.getClickToEditText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) { inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName() + "'"); } else { inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) { inPlaceEditorParams.append(", indicator: '" + inPlaceEditor.getLoadingText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append(", submit: "); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } inPlaceEditorParams.append(inPlaceEditor.getOkControl()); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } } else { inPlaceEditorParams.append(", submit: 'OK'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) { inPlaceEditorParams.append(", rows: '" + inPlaceEditor.getRows() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getCols())) { inPlaceEditorParams.append(", cols: '" + inPlaceEditor.getCols() + "'"); } inPlaceEditorParams.append("}"); sr.append(inPlaceEditorParams.toString()); } sr.append("\" />"); executeMacro(writer, sr.toString()); if (displayField instanceof DisplayEntityField) { makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } this.appendTooltip(writer, context, modelFormField); } }
MacroFormRenderer implements FormStringRenderer { @Override public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); String idName = modelFormField.getCurrentContainerId(context); String description = displayField.getDescription(context); String type = displayField.getType(); String imageLocation = displayField.getImageLocation(context); Integer size = Integer.valueOf("0"); String title = ""; if (UtilValidate.isNotEmpty(displayField.getSize())) { try { size = Integer.parseInt(displayField.getSize()); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Error reading size of a field fieldName=" + displayField.getModelFormField().getFieldName() + " FormName= " + displayField.getModelFormField().getModelForm().getName(), MODULE); } } ModelFormField.InPlaceEditor inPlaceEditor = displayField.getInPlaceEditor(); boolean ajaxEnabled = inPlaceEditor != null && this.javaScriptEnabled; if (UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { title = description; description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); } StringWriter sr = new StringWriter(); sr.append("<@renderDisplayField "); sr.append("type=\""); sr.append(type); sr.append("\" imageLocation=\""); sr.append(imageLocation); sr.append("\" idName=\""); sr.append(idName); sr.append("\" description=\""); sr.append(encodeDoubleQuotes(description)); sr.append("\" title=\""); sr.append(title); sr.append("\" class=\""); sr.append(modelFormField.getWidgetStyle()); sr.append("\" alert=\""); sr.append(modelFormField.shouldBeRed(context) ? "true" : "false"); if (ajaxEnabled) { String url = inPlaceEditor.getUrl(context); StringBuffer extraParameterBuffer = new StringBuffer(); String extraParameter; Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context); Set<Entry<String, Object>> fieldSet = fieldMap.entrySet(); Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator(); int count = 0; extraParameterBuffer.append("{"); while (fieldIterator.hasNext()) { count++; Entry<String, Object> field = fieldIterator.next(); extraParameterBuffer.append(field.getKey() + ":'" + (String) field.getValue() + "'"); if (count < fieldSet.size()) { extraParameterBuffer.append(','); } } extraParameterBuffer.append("}"); extraParameter = extraParameterBuffer.toString(); sr.append("\" inPlaceEditorUrl=\""); sr.append(url); sr.append("\" inPlaceEditorParams=\""); StringWriter inPlaceEditorParams = new StringWriter(); inPlaceEditorParams.append("{name: '"); if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) { inPlaceEditorParams.append(inPlaceEditor.getParamName()); } else { inPlaceEditorParams.append(modelFormField.getFieldName()); } inPlaceEditorParams.append("'"); inPlaceEditorParams.append(", method: 'POST'"); inPlaceEditorParams.append(", submitdata: " + extraParameter); inPlaceEditorParams.append(", type: 'textarea'"); inPlaceEditorParams.append(", select: 'true'"); inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}"); if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) { inPlaceEditorParams.append(", cancel: '" + inPlaceEditor.getCancelText() + "'"); } else { inPlaceEditorParams.append(", cancel: 'Cancel'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) { inPlaceEditorParams.append(", tooltip: '" + inPlaceEditor.getClickToEditText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) { inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName() + "'"); } else { inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) { inPlaceEditorParams.append(", indicator: '" + inPlaceEditor.getLoadingText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append(", submit: "); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } inPlaceEditorParams.append(inPlaceEditor.getOkControl()); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } } else { inPlaceEditorParams.append(", submit: 'OK'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) { inPlaceEditorParams.append(", rows: '" + inPlaceEditor.getRows() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getCols())) { inPlaceEditorParams.append(", cols: '" + inPlaceEditor.getCols() + "'"); } inPlaceEditorParams.append("}"); sr.append(inPlaceEditorParams.toString()); } sr.append("\" />"); executeMacro(writer, sr.toString()); if (displayField instanceof DisplayEntityField) { makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } this.appendTooltip(writer, context, modelFormField); } MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response);  MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response,
                             FtlWriter ftlWriter); @Deprecated  MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response); }
MacroFormRenderer implements FormStringRenderer { @Override public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); String idName = modelFormField.getCurrentContainerId(context); String description = displayField.getDescription(context); String type = displayField.getType(); String imageLocation = displayField.getImageLocation(context); Integer size = Integer.valueOf("0"); String title = ""; if (UtilValidate.isNotEmpty(displayField.getSize())) { try { size = Integer.parseInt(displayField.getSize()); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Error reading size of a field fieldName=" + displayField.getModelFormField().getFieldName() + " FormName= " + displayField.getModelFormField().getModelForm().getName(), MODULE); } } ModelFormField.InPlaceEditor inPlaceEditor = displayField.getInPlaceEditor(); boolean ajaxEnabled = inPlaceEditor != null && this.javaScriptEnabled; if (UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { title = description; description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); } StringWriter sr = new StringWriter(); sr.append("<@renderDisplayField "); sr.append("type=\""); sr.append(type); sr.append("\" imageLocation=\""); sr.append(imageLocation); sr.append("\" idName=\""); sr.append(idName); sr.append("\" description=\""); sr.append(encodeDoubleQuotes(description)); sr.append("\" title=\""); sr.append(title); sr.append("\" class=\""); sr.append(modelFormField.getWidgetStyle()); sr.append("\" alert=\""); sr.append(modelFormField.shouldBeRed(context) ? "true" : "false"); if (ajaxEnabled) { String url = inPlaceEditor.getUrl(context); StringBuffer extraParameterBuffer = new StringBuffer(); String extraParameter; Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context); Set<Entry<String, Object>> fieldSet = fieldMap.entrySet(); Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator(); int count = 0; extraParameterBuffer.append("{"); while (fieldIterator.hasNext()) { count++; Entry<String, Object> field = fieldIterator.next(); extraParameterBuffer.append(field.getKey() + ":'" + (String) field.getValue() + "'"); if (count < fieldSet.size()) { extraParameterBuffer.append(','); } } extraParameterBuffer.append("}"); extraParameter = extraParameterBuffer.toString(); sr.append("\" inPlaceEditorUrl=\""); sr.append(url); sr.append("\" inPlaceEditorParams=\""); StringWriter inPlaceEditorParams = new StringWriter(); inPlaceEditorParams.append("{name: '"); if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) { inPlaceEditorParams.append(inPlaceEditor.getParamName()); } else { inPlaceEditorParams.append(modelFormField.getFieldName()); } inPlaceEditorParams.append("'"); inPlaceEditorParams.append(", method: 'POST'"); inPlaceEditorParams.append(", submitdata: " + extraParameter); inPlaceEditorParams.append(", type: 'textarea'"); inPlaceEditorParams.append(", select: 'true'"); inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}"); if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) { inPlaceEditorParams.append(", cancel: '" + inPlaceEditor.getCancelText() + "'"); } else { inPlaceEditorParams.append(", cancel: 'Cancel'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) { inPlaceEditorParams.append(", tooltip: '" + inPlaceEditor.getClickToEditText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) { inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName() + "'"); } else { inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) { inPlaceEditorParams.append(", indicator: '" + inPlaceEditor.getLoadingText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append(", submit: "); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } inPlaceEditorParams.append(inPlaceEditor.getOkControl()); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } } else { inPlaceEditorParams.append(", submit: 'OK'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) { inPlaceEditorParams.append(", rows: '" + inPlaceEditor.getRows() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getCols())) { inPlaceEditorParams.append(", cols: '" + inPlaceEditor.getCols() + "'"); } inPlaceEditorParams.append("}"); sr.append(inPlaceEditorParams.toString()); } sr.append("\" />"); executeMacro(writer, sr.toString()); if (displayField instanceof DisplayEntityField) { makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } this.appendTooltip(writer, context, modelFormField); } MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response);  MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response,
                             FtlWriter ftlWriter); @Deprecated  MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response); static String getAjaxParamsFromTarget(String target); boolean getRenderPagination(); void setRenderPagination(boolean renderPagination); void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label); @Override void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField); @Override void renderHyperlinkField(Appendable writer, Map<String, Object> context, HyperlinkField hyperlinkField); @Override void renderMenuField(Appendable writer, Map<String, Object> context, MenuField menuField); @Override void renderTextField(Appendable writer, Map<String, Object> context, TextField textField); @Override void renderTextareaField(Appendable writer, Map<String, Object> context, TextareaField textareaField); @Override void renderDateTimeField(Appendable writer, Map<String, Object> context, DateTimeField dateTimeField); @Override void renderDropDownField(Appendable writer, Map<String, Object> context, DropDownField dropDownField); @Override void renderCheckField(Appendable writer, Map<String, Object> context, CheckField checkField); @Override void renderRadioField(Appendable writer, Map<String, Object> context, RadioField radioField); @Override void renderSubmitField(Appendable writer, Map<String, Object> context, SubmitField submitField); @Override void renderResetField(Appendable writer, Map<String, Object> context, ResetField resetField); @Override void renderHiddenField(Appendable writer, Map<String, Object> context, HiddenField hiddenField); @Override void renderHiddenField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String value); @Override void renderIgnoredField(Appendable writer, Map<String, Object> context, IgnoredField ignoredField); @Override void renderFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderSingleFormFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderMultiFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatListWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderEmptyFormDataMessage(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatListWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField,
                                              int positionSpan); @Override void renderFormatHeaderRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField); @Override void renderFormatHeaderRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowFormCellTitleSeparator(Appendable writer, Map<String, Object> context, ModelForm modelForm,
                                                            ModelFormField modelFormField, boolean isLast); @Override void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField,
                                            int positionSpan); @Override void renderFormatItemRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField); @Override void renderFormatItemRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatSingleWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatSingleWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowTitleCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowTitleCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowSpacerCell(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowWidgetCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions,
                                                   int positionSpan, Integer nextPositionInRow); @Override void renderFormatFieldRowWidgetCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions,
                                                    int positionSpan, Integer nextPositionInRow); @Override void renderFormatEmptySpace(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField); @Override void renderRangeFindField(Appendable writer, Map<String, Object> context, RangeFindField rangeFindField); @Override void renderDateFindField(Appendable writer, Map<String, Object> context, DateFindField dateFindField); @Override void renderLookupField(Appendable writer, Map<String, Object> context, LookupField lookupField); void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFileField(Appendable writer, Map<String, Object> context, FileField textField); @Override void renderPasswordField(Appendable writer, Map<String, Object> context, PasswordField passwordField); @Override void renderImageField(Appendable writer, Map<String, Object> context, ImageField imageField); @Override void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup); @Override void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup); @Override void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner); void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget); void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget); void renderSortField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText); String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context); void appendTooltip(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); void makeHyperlinkString(Appendable writer, ModelFormField.SubHyperlink subHyperlink, Map<String, Object> context); void addAsterisks(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); void appendContentUrl(Appendable writer, String location); void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, Map<String,
            String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField,
            HttpServletRequest request, HttpServletResponse response, Map<String, Object> context); void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap,
                                    String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request,
                                    HttpServletResponse response, Map<String, Object> context, String targetWindow); void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation, ModelFormField modelFormField,
                                         HttpServletRequest request, HttpServletResponse response, Map<String, Object> context); @Override void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField); }
MacroFormRenderer implements FormStringRenderer { @Override public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); String idName = modelFormField.getCurrentContainerId(context); String description = displayField.getDescription(context); String type = displayField.getType(); String imageLocation = displayField.getImageLocation(context); Integer size = Integer.valueOf("0"); String title = ""; if (UtilValidate.isNotEmpty(displayField.getSize())) { try { size = Integer.parseInt(displayField.getSize()); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Error reading size of a field fieldName=" + displayField.getModelFormField().getFieldName() + " FormName= " + displayField.getModelFormField().getModelForm().getName(), MODULE); } } ModelFormField.InPlaceEditor inPlaceEditor = displayField.getInPlaceEditor(); boolean ajaxEnabled = inPlaceEditor != null && this.javaScriptEnabled; if (UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { title = description; description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); } StringWriter sr = new StringWriter(); sr.append("<@renderDisplayField "); sr.append("type=\""); sr.append(type); sr.append("\" imageLocation=\""); sr.append(imageLocation); sr.append("\" idName=\""); sr.append(idName); sr.append("\" description=\""); sr.append(encodeDoubleQuotes(description)); sr.append("\" title=\""); sr.append(title); sr.append("\" class=\""); sr.append(modelFormField.getWidgetStyle()); sr.append("\" alert=\""); sr.append(modelFormField.shouldBeRed(context) ? "true" : "false"); if (ajaxEnabled) { String url = inPlaceEditor.getUrl(context); StringBuffer extraParameterBuffer = new StringBuffer(); String extraParameter; Map<String, Object> fieldMap = inPlaceEditor.getFieldMap(context); Set<Entry<String, Object>> fieldSet = fieldMap.entrySet(); Iterator<Entry<String, Object>> fieldIterator = fieldSet.iterator(); int count = 0; extraParameterBuffer.append("{"); while (fieldIterator.hasNext()) { count++; Entry<String, Object> field = fieldIterator.next(); extraParameterBuffer.append(field.getKey() + ":'" + (String) field.getValue() + "'"); if (count < fieldSet.size()) { extraParameterBuffer.append(','); } } extraParameterBuffer.append("}"); extraParameter = extraParameterBuffer.toString(); sr.append("\" inPlaceEditorUrl=\""); sr.append(url); sr.append("\" inPlaceEditorParams=\""); StringWriter inPlaceEditorParams = new StringWriter(); inPlaceEditorParams.append("{name: '"); if (UtilValidate.isNotEmpty(inPlaceEditor.getParamName())) { inPlaceEditorParams.append(inPlaceEditor.getParamName()); } else { inPlaceEditorParams.append(modelFormField.getFieldName()); } inPlaceEditorParams.append("'"); inPlaceEditorParams.append(", method: 'POST'"); inPlaceEditorParams.append(", submitdata: " + extraParameter); inPlaceEditorParams.append(", type: 'textarea'"); inPlaceEditorParams.append(", select: 'true'"); inPlaceEditorParams.append(", onreset: function(){jQuery('#cc_" + idName + "').css('background-color', 'transparent');}"); if (UtilValidate.isNotEmpty(inPlaceEditor.getCancelText())) { inPlaceEditorParams.append(", cancel: '" + inPlaceEditor.getCancelText() + "'"); } else { inPlaceEditorParams.append(", cancel: 'Cancel'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getClickToEditText())) { inPlaceEditorParams.append(", tooltip: '" + inPlaceEditor.getClickToEditText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getFormClassName())) { inPlaceEditorParams.append(", cssclass: '" + inPlaceEditor.getFormClassName() + "'"); } else { inPlaceEditorParams.append(", cssclass: 'inplaceeditor-form'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getLoadingText())) { inPlaceEditorParams.append(", indicator: '" + inPlaceEditor.getLoadingText() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append(", submit: "); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } inPlaceEditorParams.append(inPlaceEditor.getOkControl()); if (!"false".equals(inPlaceEditor.getOkControl())) { inPlaceEditorParams.append("'"); } } else { inPlaceEditorParams.append(", submit: 'OK'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getRows())) { inPlaceEditorParams.append(", rows: '" + inPlaceEditor.getRows() + "'"); } if (UtilValidate.isNotEmpty(inPlaceEditor.getCols())) { inPlaceEditorParams.append(", cols: '" + inPlaceEditor.getCols() + "'"); } inPlaceEditorParams.append("}"); sr.append(inPlaceEditorParams.toString()); } sr.append("\" />"); executeMacro(writer, sr.toString()); if (displayField instanceof DisplayEntityField) { makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } this.appendTooltip(writer, context, modelFormField); } MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response);  MacroFormRenderer(String macroLibraryPath, HttpServletRequest request, HttpServletResponse response,
                             FtlWriter ftlWriter); @Deprecated  MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response); static String getAjaxParamsFromTarget(String target); boolean getRenderPagination(); void setRenderPagination(boolean renderPagination); void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label); @Override void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField); @Override void renderHyperlinkField(Appendable writer, Map<String, Object> context, HyperlinkField hyperlinkField); @Override void renderMenuField(Appendable writer, Map<String, Object> context, MenuField menuField); @Override void renderTextField(Appendable writer, Map<String, Object> context, TextField textField); @Override void renderTextareaField(Appendable writer, Map<String, Object> context, TextareaField textareaField); @Override void renderDateTimeField(Appendable writer, Map<String, Object> context, DateTimeField dateTimeField); @Override void renderDropDownField(Appendable writer, Map<String, Object> context, DropDownField dropDownField); @Override void renderCheckField(Appendable writer, Map<String, Object> context, CheckField checkField); @Override void renderRadioField(Appendable writer, Map<String, Object> context, RadioField radioField); @Override void renderSubmitField(Appendable writer, Map<String, Object> context, SubmitField submitField); @Override void renderResetField(Appendable writer, Map<String, Object> context, ResetField resetField); @Override void renderHiddenField(Appendable writer, Map<String, Object> context, HiddenField hiddenField); @Override void renderHiddenField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String value); @Override void renderIgnoredField(Appendable writer, Map<String, Object> context, IgnoredField ignoredField); @Override void renderFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderSingleFormFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderMultiFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatListWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderEmptyFormDataMessage(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatListWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField,
                                              int positionSpan); @Override void renderFormatHeaderRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField); @Override void renderFormatHeaderRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatHeaderRowFormCellTitleSeparator(Appendable writer, Map<String, Object> context, ModelForm modelForm,
                                                            ModelFormField modelFormField, boolean isLast); @Override void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField,
                                            int positionSpan); @Override void renderFormatItemRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField); @Override void renderFormatItemRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatItemRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatSingleWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatSingleWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFormatFieldRowTitleCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowTitleCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowSpacerCell(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); @Override void renderFormatFieldRowWidgetCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions,
                                                   int positionSpan, Integer nextPositionInRow); @Override void renderFormatFieldRowWidgetCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions,
                                                    int positionSpan, Integer nextPositionInRow); @Override void renderFormatEmptySpace(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField); @Override void renderRangeFindField(Appendable writer, Map<String, Object> context, RangeFindField rangeFindField); @Override void renderDateFindField(Appendable writer, Map<String, Object> context, DateFindField dateFindField); @Override void renderLookupField(Appendable writer, Map<String, Object> context, LookupField lookupField); void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm); @Override void renderFileField(Appendable writer, Map<String, Object> context, FileField textField); @Override void renderPasswordField(Appendable writer, Map<String, Object> context, PasswordField passwordField); @Override void renderImageField(Appendable writer, Map<String, Object> context, ImageField imageField); @Override void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup); @Override void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup); @Override void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner); void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget); void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget); void renderSortField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText); String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context); void appendTooltip(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); void makeHyperlinkString(Appendable writer, ModelFormField.SubHyperlink subHyperlink, Map<String, Object> context); void addAsterisks(Appendable writer, Map<String, Object> context, ModelFormField modelFormField); void appendContentUrl(Appendable writer, String location); void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, Map<String,
            String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField,
            HttpServletRequest request, HttpServletResponse response, Map<String, Object> context); void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap,
                                    String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request,
                                    HttpServletResponse response, Map<String, Object> context, String targetWindow); void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation, ModelFormField modelFormField,
                                         HttpServletRequest request, HttpServletResponse response, Map<String, Object> context); @Override void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField);  }