Screen Widget refactor - changed StringBuffer arguments to Writer arguments to help make the screen widget API more consistent. Also added some parameterized data types to cut down on the unchecked warnings.
There are no functional changes to the screen widgets. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@662123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -92,7 +92,7 @@ public class ModelWidget implements Serializable {
|
||||
* Enables/disables boundary comments for this widget.
|
||||
* @param context The screen rendering context
|
||||
*/
|
||||
public void setWidgetBoundaryComments(Map context) {
|
||||
public void setWidgetBoundaryComments(Map<String, Object> context) {
|
||||
enableWidgetBoundaryComments = widgetBoundaryCommentsEnabled((Map) context.get("parameters"));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -34,80 +37,82 @@ public class WidgetWorker {
|
||||
|
||||
public WidgetWorker () {}
|
||||
|
||||
public static void buildHyperlinkUrl(StringBuffer buffer, String requestName, String targetType, HttpServletRequest request, HttpServletResponse response, Map context) {
|
||||
public static void buildHyperlinkUrl(Writer writer, String requestName, String targetType, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException {
|
||||
String localRequestName = UtilHttp.encodeAmpersands(requestName);
|
||||
|
||||
if ("intra-app".equals(targetType)) {
|
||||
appendOfbizUrl(buffer, "/" + localRequestName, request, response);
|
||||
appendOfbizUrl(writer, "/" + localRequestName, request, response);
|
||||
} else if ("inter-app".equals(targetType)) {
|
||||
String fullTarget = localRequestName;
|
||||
buffer.append(fullTarget);
|
||||
writer.write(fullTarget);
|
||||
String externalLoginKey = (String) request.getAttribute("externalLoginKey");
|
||||
if (UtilValidate.isNotEmpty(externalLoginKey)) {
|
||||
if (fullTarget.indexOf('?') == -1) {
|
||||
buffer.append('?');
|
||||
writer.write('?');
|
||||
} else {
|
||||
buffer.append("&");
|
||||
writer.write("&");
|
||||
}
|
||||
buffer.append("externalLoginKey=");
|
||||
buffer.append(externalLoginKey);
|
||||
writer.write("externalLoginKey=");
|
||||
writer.write(externalLoginKey);
|
||||
}
|
||||
} else if ("content".equals(targetType)) {
|
||||
appendContentUrl(buffer, localRequestName, request);
|
||||
appendContentUrl(writer, localRequestName, request);
|
||||
} else if ("plain".equals(targetType)) {
|
||||
buffer.append(localRequestName);
|
||||
writer.write(localRequestName);
|
||||
} else {
|
||||
buffer.append(localRequestName);
|
||||
writer.write(localRequestName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void appendOfbizUrl(StringBuffer buffer, String location, HttpServletRequest request, HttpServletResponse response) {
|
||||
public static void appendOfbizUrl(Writer writer, String location, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
|
||||
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
|
||||
// make and append the link
|
||||
buffer.append(rh.makeLink(request, response, location));
|
||||
writer.write(rh.makeLink(request, response, location));
|
||||
}
|
||||
|
||||
public static void appendContentUrl(StringBuffer buffer, String location, HttpServletRequest request) {
|
||||
public static void appendContentUrl(Writer writer, String location, HttpServletRequest request) throws IOException {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
ContentUrlTag.appendContentPrefix(request, buffer);
|
||||
buffer.append(location);
|
||||
writer.write(buffer.toString());
|
||||
writer.write(location);
|
||||
}
|
||||
|
||||
public static void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, HttpServletRequest request, HttpServletResponse response, Map context, String targetWindow, String event, String action) {
|
||||
public static void makeHyperlinkString(Writer writer, String linkStyle, String targetType, String target, String description, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow, String event, String action) throws IOException {
|
||||
if (UtilValidate.isNotEmpty(description)) {
|
||||
buffer.append("<a");
|
||||
writer.write("<a");
|
||||
|
||||
if (UtilValidate.isNotEmpty(linkStyle)) {
|
||||
buffer.append(" class=\"");
|
||||
buffer.append(linkStyle);
|
||||
buffer.append("\"");
|
||||
writer.write(" class=\"");
|
||||
writer.write(linkStyle);
|
||||
writer.write("\"");
|
||||
}
|
||||
|
||||
buffer.append(" href=\"");
|
||||
writer.write(" href=\"");
|
||||
|
||||
WidgetWorker.buildHyperlinkUrl(buffer, target, targetType, request, response, context);
|
||||
buildHyperlinkUrl(writer, target, targetType, request, response, context);
|
||||
|
||||
buffer.append("\"");
|
||||
writer.write("\"");
|
||||
|
||||
if (UtilValidate.isNotEmpty(targetWindow)) {
|
||||
buffer.append(" target=\"");
|
||||
buffer.append(targetWindow);
|
||||
buffer.append("\"");
|
||||
writer.write(" target=\"");
|
||||
writer.write(targetWindow);
|
||||
writer.write("\"");
|
||||
}
|
||||
|
||||
if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) {
|
||||
buffer.append(" ");
|
||||
buffer.append(event);
|
||||
buffer.append("=\"");
|
||||
buffer.append(action);
|
||||
buffer.append('"');
|
||||
writer.write(" ");
|
||||
writer.write(event);
|
||||
writer.write("=\"");
|
||||
writer.write(action);
|
||||
writer.write('"');
|
||||
}
|
||||
|
||||
buffer.append('>');
|
||||
writer.write('>');
|
||||
|
||||
buffer.append(description);
|
||||
buffer.append("</a>");
|
||||
writer.write(description);
|
||||
writer.write("</a>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,16 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.fo;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.widget.form.FormStringRenderer;
|
||||
import org.ofbiz.widget.form.ModelForm;
|
||||
import org.ofbiz.widget.form.ModelFormField;
|
||||
@@ -64,358 +66,355 @@ public class FoFormRenderer extends HtmlWidgetRenderer implements FormStringRend
|
||||
|
||||
public FoFormRenderer() {}
|
||||
|
||||
public FoFormRenderer(HttpServletRequest request, HttpServletResponse response) {
|
||||
public FoFormRenderer(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
private void makeBlockString(StringBuffer buffer, String widgetStyle, String text) {
|
||||
buffer.append("<fo:block");
|
||||
private void makeBlockString(Writer writer, String widgetStyle, String text) throws IOException {
|
||||
writer.write("<fo:block");
|
||||
if (UtilValidate.isNotEmpty(widgetStyle)) {
|
||||
buffer.append(" ");
|
||||
buffer.append(FoScreenRenderer.getFoStyle(widgetStyle));
|
||||
writer.write(" ");
|
||||
writer.write(FoScreenRenderer.getFoStyle(widgetStyle));
|
||||
}
|
||||
buffer.append(">");
|
||||
buffer.append(UtilFormatOut.encodeXmlValue(text));
|
||||
buffer.append("</fo:block>");
|
||||
writer.write(">");
|
||||
writer.write(UtilFormatOut.encodeXmlValue(text));
|
||||
writer.write("</fo:block>");
|
||||
}
|
||||
|
||||
public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) {
|
||||
public void renderDisplayField(Writer writer, Map<String, Object> context, DisplayField displayField) throws IOException {
|
||||
ModelFormField modelFormField = displayField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderHyperlinkField(StringBuffer buffer, Map context, HyperlinkField hyperlinkField) {
|
||||
public void renderHyperlinkField(Writer writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException {
|
||||
ModelFormField modelFormField = hyperlinkField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderTextField(StringBuffer buffer, Map context, TextField textField) {
|
||||
public void renderTextField(Writer writer, Map<String, Object> context, TextField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderTextareaField(StringBuffer buffer, Map context, TextareaField textareaField) {
|
||||
public void renderTextareaField(Writer writer, Map<String, Object> context, TextareaField textareaField) throws IOException {
|
||||
ModelFormField modelFormField = textareaField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDateTimeField(StringBuffer buffer, Map context, DateTimeField dateTimeField) {
|
||||
public void renderDateTimeField(Writer writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException {
|
||||
ModelFormField modelFormField = dateTimeField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDropDownField(StringBuffer buffer, Map context, DropDownField dropDownField) {
|
||||
public void renderDropDownField(Writer writer, Map<String, Object> context, DropDownField dropDownField) throws IOException {
|
||||
ModelFormField modelFormField = dropDownField.getModelFormField();
|
||||
ModelForm modelForm = modelFormField.getModelForm();
|
||||
String currentValue = modelFormField.getEntry(context);
|
||||
List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context));
|
||||
List<ModelFormField.OptionValue> allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context));
|
||||
// if the current value should go first, display it
|
||||
if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) {
|
||||
String explicitDescription = dropDownField.getCurrentDescription(context);
|
||||
if (UtilValidate.isNotEmpty(explicitDescription)) {
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
} else {
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
}
|
||||
} else {
|
||||
Iterator optionValueIter = allOptionValues.iterator();
|
||||
boolean optionSelected = false;
|
||||
while (optionValueIter.hasNext()) {
|
||||
ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next();
|
||||
for (ModelFormField.OptionValue optionValue : allOptionValues) {
|
||||
String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context);
|
||||
if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) ||
|
||||
(UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) {
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
optionSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!optionSelected) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
}
|
||||
appendWhitespace(buffer);
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderCheckField(StringBuffer buffer, Map context, CheckField checkField) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
public void renderCheckField(Writer writer, Map<String, Object> context, CheckField checkField) throws IOException {
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderRadioField(StringBuffer buffer, Map context, RadioField radioField) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
public void renderRadioField(Writer writer, Map<String, Object> context, RadioField radioField) throws IOException {
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderSubmitField(StringBuffer buffer, Map context, SubmitField submitField) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
public void renderSubmitField(Writer writer, Map<String, Object> context, SubmitField submitField) throws IOException {
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderResetField(StringBuffer buffer, Map context, ResetField resetField) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
public void renderResetField(Writer writer, Map<String, Object> context, ResetField resetField) throws IOException {
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, HiddenField hiddenField) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, HiddenField hiddenField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField modelFormField, String value) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String value) throws IOException {
|
||||
}
|
||||
|
||||
public void renderIgnoredField(StringBuffer buffer, Map context, IgnoredField ignoredField) {
|
||||
public void renderIgnoredField(Writer writer, Map<String, Object> context, IgnoredField ignoredField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
String tempTitleText = modelFormField.getTitle(context);
|
||||
buffer.append(tempTitleText);
|
||||
writer.write(tempTitleText);
|
||||
}
|
||||
|
||||
public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
renderFieldTitle(buffer, context, modelFormField);
|
||||
public void renderSingleFormFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
renderFieldTitle(writer, context, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
renderBeginningBoundaryComment(buffer, "Form Widget", modelForm);
|
||||
public void renderFormOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
renderBeginningBoundaryComment(writer, "Form Widget", modelForm);
|
||||
}
|
||||
|
||||
public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
renderEndingBoundaryComment(buffer, "Form Widget", modelForm);
|
||||
public void renderFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
renderEndingBoundaryComment(writer, "Form Widget", modelForm);
|
||||
}
|
||||
|
||||
public void renderMultiFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
renderEndingBoundaryComment(buffer, "Form Widget", modelForm);
|
||||
public void renderMultiFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
renderEndingBoundaryComment(writer, "Form Widget", modelForm);
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table border=\"solid black\">");
|
||||
Iterator fieldListIter = modelForm.getFieldList().iterator();
|
||||
while (fieldListIter.hasNext()) {
|
||||
ModelFormField childField = (ModelFormField)fieldListIter.next();
|
||||
public void renderFormatListWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table border=\"solid black\">");
|
||||
List<ModelFormField> childFieldList = modelForm.getFieldList();
|
||||
for (ModelFormField childField : childFieldList) {
|
||||
int childFieldType = childField.getFieldInfo().getFieldType();
|
||||
if (childFieldType == ModelFormField.FieldInfo.HIDDEN || childFieldType == ModelFormField.FieldInfo.IGNORED) {
|
||||
continue;
|
||||
}
|
||||
buffer.append("<fo:table-column");
|
||||
writer.write("<fo:table-column");
|
||||
String areaStyle = childField.getTitleAreaStyle();
|
||||
if (UtilValidate.isNotEmpty(areaStyle)) {
|
||||
buffer.append(" ");
|
||||
buffer.append(FoScreenRenderer.getFoStyle(areaStyle));
|
||||
writer.write(" ");
|
||||
writer.write(FoScreenRenderer.getFoStyle(areaStyle));
|
||||
}
|
||||
buffer.append("/>");
|
||||
appendWhitespace(buffer);
|
||||
writer.write("/>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
appendWhitespace(buffer);
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-body>");
|
||||
buffer.append("</fo:table>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatListWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-body>");
|
||||
writer.write("</fo:table>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table-header>");
|
||||
buffer.append("<fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatHeaderRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table-header>");
|
||||
writer.write("<fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-row>");
|
||||
buffer.append("</fo:table-header>");
|
||||
buffer.append("<fo:table-body>");
|
||||
public void renderFormatHeaderRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-row>");
|
||||
writer.write("</fo:table-header>");
|
||||
writer.write("<fo:table-body>");
|
||||
// FIXME: this is an hack to avoid FOP rendering errors for empty lists (fo:table-body cannot be null)
|
||||
buffer.append("<fo:table-row><fo:table-cell><fo:block/></fo:table-cell></fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
writer.write("<fo:table-row><fo:table-cell><fo:block/></fo:table-cell></fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
buffer.append("<fo:table-cell ");
|
||||
public void renderFormatHeaderRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
|
||||
writer.write("<fo:table-cell ");
|
||||
if (positionSpan > 1) {
|
||||
buffer.append("number-columns-spanned=\"");
|
||||
buffer.append(positionSpan);
|
||||
buffer.append("\" ");
|
||||
writer.write("number-columns-spanned=\"");
|
||||
writer.write(Integer.toString(positionSpan));
|
||||
writer.write("\" ");
|
||||
}
|
||||
buffer.append("font-weight=\"bold\" text-align=\"center\" border=\"solid black\" padding=\"2pt\"");
|
||||
buffer.append(">");
|
||||
buffer.append("<fo:block>");
|
||||
appendWhitespace(buffer);
|
||||
writer.write("font-weight=\"bold\" text-align=\"center\" border=\"solid black\" padding=\"2pt\"");
|
||||
writer.write(">");
|
||||
writer.write("<fo:block>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
buffer.append("</fo:block>");
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatHeaderRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
|
||||
writer.write("</fo:block>");
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatHeaderRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatHeaderRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) {
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatItemRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatItemRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
buffer.append("<fo:table-cell ");
|
||||
public void renderFormatItemRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
|
||||
writer.write("<fo:table-cell ");
|
||||
if (positionSpan > 1) {
|
||||
buffer.append("number-columns-spanned=\"");
|
||||
buffer.append(positionSpan);
|
||||
buffer.append("\" ");
|
||||
writer.write("number-columns-spanned=\"");
|
||||
writer.write(Integer.toString(positionSpan));
|
||||
writer.write("\" ");
|
||||
}
|
||||
String areaStyle = modelFormField.getWidgetAreaStyle();
|
||||
if (UtilValidate.isEmpty(areaStyle)) {
|
||||
areaStyle = "tabletext";
|
||||
}
|
||||
buffer.append(FoScreenRenderer.getFoStyle(areaStyle));
|
||||
buffer.append(">");
|
||||
appendWhitespace(buffer);
|
||||
writer.write(FoScreenRenderer.getFoStyle(areaStyle));
|
||||
writer.write(">");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatItemRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatItemRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatItemRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
// TODO: multi columns (position attribute) in single forms are still not implemented
|
||||
public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table>");
|
||||
appendWhitespace(buffer);
|
||||
buffer.append("<fo:table-column column-width=\"2in\"/>");
|
||||
appendWhitespace(buffer);
|
||||
buffer.append("<fo:table-column/>");
|
||||
appendWhitespace(buffer);
|
||||
buffer.append("<fo:table-body>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatSingleWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table>");
|
||||
appendWhitespace(writer);
|
||||
writer.write("<fo:table-column column-width=\"2in\"/>");
|
||||
appendWhitespace(writer);
|
||||
writer.write("<fo:table-column/>");
|
||||
appendWhitespace(writer);
|
||||
writer.write("<fo:table-body>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-body>");
|
||||
buffer.append("</fo:table>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatSingleWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-body>");
|
||||
writer.write("</fo:table>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</fo:table-row>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</fo:table-row>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
|
||||
public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
buffer.append("<fo:table-cell font-weight=\"bold\" text-align=\"right\" padding=\"3pt\">");
|
||||
buffer.append("<fo:block>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowTitleCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
writer.write("<fo:table-cell font-weight=\"bold\" text-align=\"right\" padding=\"3pt\">");
|
||||
writer.write("<fo:block>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowTitleCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
buffer.append("</fo:block>");
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowTitleCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
writer.write("</fo:block>");
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowSpacerCell(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowSpacerCell(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
buffer.append("<fo:table-cell text-align=\"left\" padding=\"2pt\" padding-left=\"5pt\">");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowWidgetCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException {
|
||||
writer.write("<fo:table-cell text-align=\"left\" padding=\"2pt\" padding-left=\"5pt\">");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
buffer.append("</fo:table-cell>");
|
||||
appendWhitespace(buffer);
|
||||
public void renderFormatFieldRowWidgetCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException {
|
||||
writer.write("</fo:table-cell>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatEmptySpace(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderTextFindField(StringBuffer buffer, Map context, TextFindField textFindField) {
|
||||
public void renderTextFindField(Writer writer, Map<String, Object> context, TextFindField textFindField) throws IOException {
|
||||
ModelFormField modelFormField = textFindField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderRangeFindField(StringBuffer buffer, Map context, RangeFindField rangeFindField) {
|
||||
public void renderRangeFindField(Writer writer, Map<String, Object> context, RangeFindField rangeFindField) throws IOException {
|
||||
ModelFormField modelFormField = rangeFindField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDateFindField(StringBuffer buffer, Map context, DateFindField dateFindField) {
|
||||
public void renderDateFindField(Writer writer, Map<String, Object> context, DateFindField dateFindField) throws IOException {
|
||||
ModelFormField modelFormField = dateFindField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLookupField(StringBuffer buffer, Map context, LookupField lookupField) {
|
||||
public void renderLookupField(Writer writer, Map<String, Object> context, LookupField lookupField) throws IOException {
|
||||
ModelFormField modelFormField = lookupField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderNextPrev(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderNextPrev(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFileField(StringBuffer buffer, Map context, FileField textField) {
|
||||
public void renderFileField(Writer writer, Map<String, Object> context, FileField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeBlockString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
appendWhitespace(buffer);
|
||||
this.makeBlockString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderPasswordField(StringBuffer buffer, Map context, PasswordField passwordField) {
|
||||
this.makeBlockString(buffer, null, "");
|
||||
public void renderPasswordField(Writer writer, Map<String, Object> context, PasswordField passwordField) throws IOException {
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderImageField(StringBuffer buffer, Map context, ImageField imageField) {
|
||||
public void renderImageField(Writer writer, Map<String, Object> context, ImageField imageField) throws IOException {
|
||||
// TODO
|
||||
this.makeBlockString(buffer, null, "");
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderFieldGroupOpen(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupOpen(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderFieldGroupClose(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupClose(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderBanner(StringBuffer buffer, Map context, ModelForm.Banner banner) {
|
||||
public void renderBanner(Writer writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException {
|
||||
// TODO
|
||||
this.makeBlockString(buffer, null, "");
|
||||
this.makeBlockString(writer, null, "");
|
||||
}
|
||||
|
||||
public void renderHyperlinkTitle(StringBuffer buffer, Map context, ModelFormField modelFormField, String titleText) {
|
||||
public void renderHyperlinkTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ public class FoScreenRenderer extends HtmlWidgetRenderer implements ScreenString
|
||||
return value;
|
||||
}
|
||||
|
||||
public void renderSectionBegin(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
|
||||
}
|
||||
public void renderSectionEnd(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
renderEndingBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
|
||||
}
|
||||
|
||||
public void renderContainerBegin(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
writer.write("<fo:block");
|
||||
|
||||
String style = container.getStyle(context);
|
||||
@@ -65,12 +65,12 @@ public class FoScreenRenderer extends HtmlWidgetRenderer implements ScreenString
|
||||
writer.write(">");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
public void renderContainerEnd(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
writer.write("</fo:block>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException {
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
|
||||
String labelText = label.getText(context);
|
||||
if (UtilValidate.isEmpty(labelText)) {
|
||||
// nothing to render
|
||||
@@ -92,51 +92,51 @@ public class FoScreenRenderer extends HtmlWidgetRenderer implements ScreenString
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException {
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException {
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentBegin(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentBody(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentEnd(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentBody(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentEnd(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderScreenletBegin(Writer writer, Map context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletBegin(Writer writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderScreenletSubWidget(Writer writer, Map context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
|
||||
public void renderScreenletSubWidget(Writer writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderScreenletEnd(Writer writer, Map context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,77 +18,79 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.form;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Widget Library - Form String Renderer interface
|
||||
* Widget Library - Form String Renderer interface.
|
||||
*/
|
||||
public interface FormStringRenderer {
|
||||
public void renderDisplayField(StringBuffer buffer, Map context, ModelFormField.DisplayField displayField);
|
||||
public void renderHyperlinkField(StringBuffer buffer, Map context, ModelFormField.HyperlinkField hyperlinkField);
|
||||
public void renderDisplayField(Writer writer, Map<String, Object> context, ModelFormField.DisplayField displayField) throws IOException;
|
||||
public void renderHyperlinkField(Writer writer, Map<String, Object> context, ModelFormField.HyperlinkField hyperlinkField) throws IOException;
|
||||
|
||||
public void renderTextField(StringBuffer buffer, Map context, ModelFormField.TextField textField);
|
||||
public void renderTextareaField(StringBuffer buffer, Map context, ModelFormField.TextareaField textareaField);
|
||||
public void renderDateTimeField(StringBuffer buffer, Map context, ModelFormField.DateTimeField dateTimeField);
|
||||
public void renderTextField(Writer writer, Map<String, Object> context, ModelFormField.TextField textField) throws IOException;
|
||||
public void renderTextareaField(Writer writer, Map<String, Object> context, ModelFormField.TextareaField textareaField) throws IOException;
|
||||
public void renderDateTimeField(Writer writer, Map<String, Object> context, ModelFormField.DateTimeField dateTimeField) throws IOException;
|
||||
|
||||
public void renderDropDownField(StringBuffer buffer, Map context, ModelFormField.DropDownField dropDownField);
|
||||
public void renderCheckField(StringBuffer buffer, Map context, ModelFormField.CheckField checkField);
|
||||
public void renderRadioField(StringBuffer buffer, Map context, ModelFormField.RadioField radioField);
|
||||
public void renderDropDownField(Writer writer, Map<String, Object> context, ModelFormField.DropDownField dropDownField) throws IOException;
|
||||
public void renderCheckField(Writer writer, Map<String, Object> context, ModelFormField.CheckField checkField) throws IOException;
|
||||
public void renderRadioField(Writer writer, Map<String, Object> context, ModelFormField.RadioField radioField) throws IOException;
|
||||
|
||||
public void renderSubmitField(StringBuffer buffer, Map context, ModelFormField.SubmitField submitField);
|
||||
public void renderResetField(StringBuffer buffer, Map context, ModelFormField.ResetField resetField);
|
||||
public void renderSubmitField(Writer writer, Map<String, Object> context, ModelFormField.SubmitField submitField) throws IOException;
|
||||
public void renderResetField(Writer writer, Map<String, Object> context, ModelFormField.ResetField resetField) throws IOException;
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField modelFormField, String value);
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField.HiddenField hiddenField);
|
||||
public void renderIgnoredField(StringBuffer buffer, Map context, ModelFormField.IgnoredField ignoredField);
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String value) throws IOException;
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField.HiddenField hiddenField) throws IOException;
|
||||
public void renderIgnoredField(Writer writer, Map<String, Object> context, ModelFormField.IgnoredField ignoredField) throws IOException;
|
||||
|
||||
public void renderFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField);
|
||||
public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField);
|
||||
public void renderFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
|
||||
public void renderSingleFormFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
|
||||
|
||||
public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderMultiFormClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderMultiFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
|
||||
public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatListWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatListWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
|
||||
public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan);
|
||||
public void renderFormatHeaderRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField);
|
||||
public void renderFormatHeaderRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatHeaderRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatHeaderRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException;
|
||||
public void renderFormatHeaderRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException;
|
||||
|
||||
public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatHeaderRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast);
|
||||
public void renderFormatHeaderRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatHeaderRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException;
|
||||
|
||||
public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan);
|
||||
public void renderFormatItemRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField);
|
||||
public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatItemRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatItemRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatItemRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatItemRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException;
|
||||
public void renderFormatItemRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException;
|
||||
public void renderFormatItemRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatItemRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
|
||||
public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatSingleWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatSingleWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
|
||||
public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField);
|
||||
public void renderFormatFieldRowTitleCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField);
|
||||
public void renderFormatFieldRowSpacerCell(StringBuffer buffer, Map context, ModelFormField modelFormField);
|
||||
public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow);
|
||||
public void renderFormatFieldRowWidgetCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow);
|
||||
public void renderFormatFieldRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatFieldRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
public void renderFormatFieldRowTitleCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
|
||||
public void renderFormatFieldRowTitleCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
|
||||
public void renderFormatFieldRowSpacerCell(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
|
||||
public void renderFormatFieldRowWidgetCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException;
|
||||
public void renderFormatFieldRowWidgetCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException;
|
||||
|
||||
public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm);
|
||||
public void renderFormatEmptySpace(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
|
||||
|
||||
public void renderTextFindField(StringBuffer buffer, Map context, ModelFormField.TextFindField textField);
|
||||
public void renderDateFindField(StringBuffer buffer, Map context, ModelFormField.DateFindField textField);
|
||||
public void renderRangeFindField(StringBuffer buffer, Map context, ModelFormField.RangeFindField textField);
|
||||
public void renderLookupField(StringBuffer buffer, Map context, ModelFormField.LookupField textField);
|
||||
public void renderFileField(StringBuffer buffer, Map context, ModelFormField.FileField textField);
|
||||
public void renderPasswordField(StringBuffer buffer, Map context, ModelFormField.PasswordField textField);
|
||||
public void renderImageField(StringBuffer buffer, Map context, ModelFormField.ImageField textField);
|
||||
public void renderBanner(StringBuffer buffer, Map context, ModelForm.Banner banner);
|
||||
public void renderFieldGroupOpen(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup);
|
||||
public void renderFieldGroupClose(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup);
|
||||
public void renderTextFindField(Writer writer, Map<String, Object> context, ModelFormField.TextFindField textField) throws IOException;
|
||||
public void renderDateFindField(Writer writer, Map<String, Object> context, ModelFormField.DateFindField textField) throws IOException;
|
||||
public void renderRangeFindField(Writer writer, Map<String, Object> context, ModelFormField.RangeFindField textField) throws IOException;
|
||||
public void renderLookupField(Writer writer, Map<String, Object> context, ModelFormField.LookupField textField) throws IOException;
|
||||
public void renderFileField(Writer writer, Map<String, Object> context, ModelFormField.FileField textField) throws IOException;
|
||||
public void renderPasswordField(Writer writer, Map<String, Object> context, ModelFormField.PasswordField textField) throws IOException;
|
||||
public void renderImageField(Writer writer, Map<String, Object> context, ModelFormField.ImageField textField) throws IOException;
|
||||
public void renderBanner(Writer writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException;
|
||||
public void renderFieldGroupOpen(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException;
|
||||
public void renderFieldGroupClose(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ import bsh.Interpreter;
|
||||
/**
|
||||
* Widget Library - Form model class
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ModelForm extends ModelWidget {
|
||||
|
||||
public static final String module = ModelForm.class.getName();
|
||||
@@ -751,7 +752,7 @@ public class ModelForm extends ModelWidget {
|
||||
return this.addUpdateField(newFormField);
|
||||
}
|
||||
|
||||
public void runFormActions(Map context) {
|
||||
public void runFormActions(Map<String, Object> context) {
|
||||
ModelFormAction.runSubActions(this.actions, context);
|
||||
}
|
||||
|
||||
@@ -770,7 +771,7 @@ public class ModelForm extends ModelWidget {
|
||||
* different form elements; implementing your own makes it possible to
|
||||
* use the same form definitions for many types of form UIs
|
||||
*/
|
||||
public void renderFormString(Writer writer, Map context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
public void renderFormString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
runFormActions(context);
|
||||
|
||||
setWidgetBoundaryComments(context);
|
||||
@@ -813,8 +814,7 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderSingleFormString(Writer writer, Map context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
public void renderSingleFormString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
List tempFieldList = FastList.newInstance();
|
||||
tempFieldList.addAll(this.fieldList);
|
||||
|
||||
@@ -840,15 +840,15 @@ public class ModelForm extends ModelWidget {
|
||||
Set alreadyRendered = new TreeSet();
|
||||
FieldGroup lastFieldGroup = null;
|
||||
// render form open
|
||||
if (!skipStart) formStringRenderer.renderFormOpen(buffer, context, this);
|
||||
if (!skipStart) formStringRenderer.renderFormOpen(writer, context, this);
|
||||
|
||||
// render all hidden & ignored fields
|
||||
List hiddenIgnoredFieldList = this.getHiddenIgnoredFields(context, alreadyRendered, tempFieldList, -1);
|
||||
this.renderHiddenIgnoredFields(buffer, context, formStringRenderer, hiddenIgnoredFieldList);
|
||||
this.renderHiddenIgnoredFields(writer, context, formStringRenderer, hiddenIgnoredFieldList);
|
||||
|
||||
// render formatting wrapper open
|
||||
// This should be covered by fieldGroup.renderStartString
|
||||
//formStringRenderer.renderFormatSingleWrapperOpen(buffer, context, this);
|
||||
//formStringRenderer.renderFormatSingleWrapperOpen(writer, context, this);
|
||||
|
||||
// render each field row, except hidden & ignored rows
|
||||
Iterator fieldIter = tempFieldList.iterator();
|
||||
@@ -888,15 +888,15 @@ public class ModelForm extends ModelWidget {
|
||||
while (iter.hasNext()) {
|
||||
Object obj = iter.next();
|
||||
if (obj instanceof ModelForm.Banner) {
|
||||
((ModelForm.Banner) obj).renderString(buffer, context, formStringRenderer);
|
||||
((ModelForm.Banner) obj).renderString(writer, context, formStringRenderer);
|
||||
} else {
|
||||
// no need to open and close an empty table, so skip that call
|
||||
formStringRenderer.renderFieldGroupOpen(buffer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupClose(buffer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupOpen(writer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupClose(writer, context, (FieldGroup) obj);
|
||||
}
|
||||
}
|
||||
if (currentFieldGroup != null && (lastFieldGroup == null || !lastFieldGroupName.equals(currentFieldGroupName))) {
|
||||
currentFieldGroup.renderStartString(buffer, context, formStringRenderer);
|
||||
currentFieldGroup.renderStartString(writer, context, formStringRenderer);
|
||||
lastFieldGroup = currentFieldGroup;
|
||||
}
|
||||
} else {
|
||||
@@ -929,25 +929,25 @@ public class ModelForm extends ModelWidget {
|
||||
if (lastFieldGroup != null ) {
|
||||
lastFieldGroupName = lastFieldGroup.getId();
|
||||
if (!lastFieldGroupName.equals(currentFieldGroupName)) {
|
||||
lastFieldGroup.renderEndString(buffer, context, formStringRenderer);
|
||||
lastFieldGroup.renderEndString(writer, context, formStringRenderer);
|
||||
|
||||
List inbetweenList = getInbetweenList(lastFieldGroup, currentFieldGroup);
|
||||
Iterator iter = inbetweenList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Object obj = iter.next();
|
||||
if (obj instanceof ModelForm.Banner) {
|
||||
((ModelForm.Banner) obj).renderString(buffer, context, formStringRenderer);
|
||||
((ModelForm.Banner) obj).renderString(writer, context, formStringRenderer);
|
||||
} else {
|
||||
// no need to open and close an empty table, so skip that call
|
||||
formStringRenderer.renderFieldGroupOpen(buffer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupClose(buffer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupOpen(writer, context, (FieldGroup) obj);
|
||||
formStringRenderer.renderFieldGroupClose(writer, context, (FieldGroup) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentFieldGroup != null && (lastFieldGroup == null || !lastFieldGroupName.equals(currentFieldGroupName))) {
|
||||
currentFieldGroup.renderStartString(buffer, context, formStringRenderer);
|
||||
currentFieldGroup.renderStartString(writer, context, formStringRenderer);
|
||||
lastFieldGroup = currentFieldGroup;
|
||||
}
|
||||
}
|
||||
@@ -994,116 +994,105 @@ public class ModelForm extends ModelWidget {
|
||||
|
||||
if (stayingOnRow) {
|
||||
// no spacer cell, might add later though...
|
||||
//formStringRenderer.renderFormatFieldRowSpacerCell(buffer, context, currentFormField);
|
||||
//formStringRenderer.renderFormatFieldRowSpacerCell(writer, context, currentFormField);
|
||||
} else {
|
||||
if (haveRenderedOpenFieldRow) {
|
||||
// render row formatting close
|
||||
formStringRenderer.renderFormatFieldRowClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatFieldRowClose(writer, context, this);
|
||||
haveRenderedOpenFieldRow = false;
|
||||
}
|
||||
|
||||
// render row formatting open
|
||||
formStringRenderer.renderFormatFieldRowOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatFieldRowOpen(writer, context, this);
|
||||
haveRenderedOpenFieldRow = true;
|
||||
}
|
||||
|
||||
// render title formatting open
|
||||
formStringRenderer.renderFormatFieldRowTitleCellOpen(buffer, context, currentFormField);
|
||||
formStringRenderer.renderFormatFieldRowTitleCellOpen(writer, context, currentFormField);
|
||||
|
||||
// render title (unless this is a submit or a reset field)
|
||||
if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.SUBMIT && fieldInfo.getFieldType() != ModelFormField.FieldInfo.RESET) {
|
||||
formStringRenderer.renderFieldTitle(buffer, context, currentFormField);
|
||||
formStringRenderer.renderFieldTitle(writer, context, currentFormField);
|
||||
} else {
|
||||
formStringRenderer.renderFormatEmptySpace(buffer, context, this);
|
||||
formStringRenderer.renderFormatEmptySpace(writer, context, this);
|
||||
}
|
||||
|
||||
// render title formatting close
|
||||
formStringRenderer.renderFormatFieldRowTitleCellClose(buffer, context, currentFormField);
|
||||
formStringRenderer.renderFormatFieldRowTitleCellClose(writer, context, currentFormField);
|
||||
|
||||
// render separator
|
||||
formStringRenderer.renderFormatFieldRowSpacerCell(buffer, context, currentFormField);
|
||||
formStringRenderer.renderFormatFieldRowSpacerCell(writer, context, currentFormField);
|
||||
|
||||
// render widget formatting open
|
||||
formStringRenderer.renderFormatFieldRowWidgetCellOpen(buffer, context, currentFormField, positions, positionSpan, nextPositionInRow);
|
||||
formStringRenderer.renderFormatFieldRowWidgetCellOpen(writer, context, currentFormField, positions, positionSpan, nextPositionInRow);
|
||||
|
||||
// render widget
|
||||
currentFormField.renderFieldString(buffer, context, formStringRenderer);
|
||||
currentFormField.renderFieldString(writer, context, formStringRenderer);
|
||||
|
||||
// render widget formatting close
|
||||
formStringRenderer.renderFormatFieldRowWidgetCellClose(buffer, context, currentFormField, positions, positionSpan, nextPositionInRow);
|
||||
formStringRenderer.renderFormatFieldRowWidgetCellClose(writer, context, currentFormField, positions, positionSpan, nextPositionInRow);
|
||||
|
||||
}
|
||||
// always render row formatting close after the end
|
||||
formStringRenderer.renderFormatFieldRowClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatFieldRowClose(writer, context, this);
|
||||
|
||||
if (lastFieldGroup != null) {
|
||||
lastFieldGroup.renderEndString(buffer, context, formStringRenderer);
|
||||
lastFieldGroup.renderEndString(writer, context, formStringRenderer);
|
||||
}
|
||||
// render formatting wrapper close
|
||||
// should be handled by renderEndString
|
||||
//formStringRenderer.renderFormatSingleWrapperClose(buffer, context, this);
|
||||
//formStringRenderer.renderFormatSingleWrapperClose(writer, context, this);
|
||||
|
||||
// render form close
|
||||
if (!skipEnd) formStringRenderer.renderFormClose(buffer, context, this);
|
||||
if (!skipEnd) formStringRenderer.renderFormClose(writer, context, this);
|
||||
|
||||
writer.write(buffer.toString());
|
||||
}
|
||||
|
||||
public void renderListFormString(Writer writer, Map context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
public void renderListFormString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
// render list/tabular type forms
|
||||
|
||||
// prepare the items iterator and compute the pagination parameters
|
||||
this.preparePager(context);
|
||||
|
||||
// render formatting wrapper open
|
||||
formStringRenderer.renderFormatListWrapperOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatListWrapperOpen(writer, context, this);
|
||||
|
||||
int numOfColumns = 0;
|
||||
// ===== render header row =====
|
||||
if (!getHideHeader()) {
|
||||
numOfColumns = this.renderHeaderRow(buffer, context, formStringRenderer);
|
||||
numOfColumns = this.renderHeaderRow(writer, context, formStringRenderer);
|
||||
}
|
||||
|
||||
writer.write(buffer.toString());
|
||||
buffer = new StringBuffer();
|
||||
|
||||
// ===== render the item rows =====
|
||||
this.renderItemRows(writer, context, formStringRenderer, true, numOfColumns);
|
||||
|
||||
// render formatting wrapper close
|
||||
formStringRenderer.renderFormatListWrapperClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatListWrapperClose(writer, context, this);
|
||||
|
||||
writer.write(buffer.toString());
|
||||
}
|
||||
|
||||
public void renderMultiFormString(Writer writer, Map context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
public void renderMultiFormString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer, int positions) throws IOException {
|
||||
if (!skipStart) {
|
||||
formStringRenderer.renderFormOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormOpen(writer, context, this);
|
||||
}
|
||||
|
||||
// render formatting wrapper open
|
||||
formStringRenderer.renderFormatListWrapperOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatListWrapperOpen(writer, context, this);
|
||||
|
||||
int numOfColumns = 0;
|
||||
// ===== render header row =====
|
||||
numOfColumns = this.renderHeaderRow(buffer, context, formStringRenderer);
|
||||
|
||||
writer.write(buffer.toString());
|
||||
buffer = new StringBuffer();
|
||||
numOfColumns = this.renderHeaderRow(writer, context, formStringRenderer);
|
||||
|
||||
// ===== render the item rows =====
|
||||
this.renderItemRows(writer, context, formStringRenderer, false, numOfColumns);
|
||||
|
||||
formStringRenderer.renderFormatListWrapperClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatListWrapperClose(writer, context, this);
|
||||
|
||||
formStringRenderer.renderMultiFormClose(buffer, context, this);
|
||||
formStringRenderer.renderMultiFormClose(writer, context, this);
|
||||
|
||||
writer.write(buffer.toString());
|
||||
}
|
||||
|
||||
public int renderHeaderRow(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
public int renderHeaderRow(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
int maxNumOfColumns = 0;
|
||||
|
||||
// We will render one title/column for all the fields with the same name
|
||||
@@ -1232,59 +1221,59 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
|
||||
if (numOfCells > 0) {
|
||||
formStringRenderer.renderFormatHeaderRowOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatHeaderRowOpen(writer, context, this);
|
||||
Iterator innerDisplayHyperlinkFieldsBeginIt = innerDisplayHyperlinkFieldsBegin.iterator();
|
||||
while (innerDisplayHyperlinkFieldsBeginIt.hasNext()) {
|
||||
ModelFormField modelFormField = (ModelFormField) innerDisplayHyperlinkFieldsBeginIt.next();
|
||||
// span columns only if this is the last column in the row (not just in this first list)
|
||||
if (innerDisplayHyperlinkFieldsBeginIt.hasNext() || numOfCells > innerDisplayHyperlinkFieldsBegin.size()) {
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(buffer, context, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(writer, context, this, modelFormField, 1);
|
||||
} else {
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(buffer, context, this, modelFormField, numOfColumnsToSpan);
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(writer, context, this, modelFormField, numOfColumnsToSpan);
|
||||
}
|
||||
formStringRenderer.renderFieldTitle(buffer, context, modelFormField);
|
||||
formStringRenderer.renderFormatHeaderRowCellClose(buffer, context, this, modelFormField);
|
||||
formStringRenderer.renderFieldTitle(writer, context, modelFormField);
|
||||
formStringRenderer.renderFormatHeaderRowCellClose(writer, context, this, modelFormField);
|
||||
}
|
||||
if (innerFormFields.size() > 0) {
|
||||
// TODO: manage colspan
|
||||
formStringRenderer.renderFormatHeaderRowFormCellOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatHeaderRowFormCellOpen(writer, context, this);
|
||||
Iterator innerFormFieldsIt = innerFormFields.iterator();
|
||||
while (innerFormFieldsIt.hasNext()) {
|
||||
ModelFormField modelFormField = (ModelFormField) innerFormFieldsIt.next();
|
||||
|
||||
if (separateColumns || modelFormField.getSeparateColumn()) {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, context, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, context, this, modelFormField, 1);
|
||||
}
|
||||
|
||||
// render title (unless this is a submit or a reset field)
|
||||
formStringRenderer.renderFieldTitle(buffer, context, modelFormField);
|
||||
formStringRenderer.renderFieldTitle(writer, context, modelFormField);
|
||||
|
||||
if (separateColumns || modelFormField.getSeparateColumn()) {
|
||||
formStringRenderer.renderFormatItemRowCellClose(buffer, context, this, modelFormField);
|
||||
formStringRenderer.renderFormatItemRowCellClose(writer, context, this, modelFormField);
|
||||
}
|
||||
|
||||
if (innerFormFieldsIt.hasNext()) {
|
||||
// TODO: determine somehow if this is the last one... how?
|
||||
if (!separateColumns && !modelFormField.getSeparateColumn()) {
|
||||
formStringRenderer.renderFormatHeaderRowFormCellTitleSeparator(buffer, context, this, modelFormField, false);
|
||||
formStringRenderer.renderFormatHeaderRowFormCellTitleSeparator(writer, context, this, modelFormField, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
formStringRenderer.renderFormatHeaderRowFormCellClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatHeaderRowFormCellClose(writer, context, this);
|
||||
}
|
||||
Iterator innerDisplayHyperlinkFieldsEndIt = innerDisplayHyperlinkFieldsEnd.iterator();
|
||||
while (innerDisplayHyperlinkFieldsEndIt.hasNext()) {
|
||||
ModelFormField modelFormField = (ModelFormField) innerDisplayHyperlinkFieldsEndIt.next();
|
||||
// span columns only if this is the last column in the row (not just in this first list)
|
||||
if (innerDisplayHyperlinkFieldsEndIt.hasNext() || numOfCells > innerDisplayHyperlinkFieldsEnd.size()) {
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(buffer, context, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(writer, context, this, modelFormField, 1);
|
||||
} else {
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(buffer, context, this, modelFormField, numOfColumnsToSpan);
|
||||
formStringRenderer.renderFormatHeaderRowCellOpen(writer, context, this, modelFormField, numOfColumnsToSpan);
|
||||
}
|
||||
formStringRenderer.renderFieldTitle(buffer, context, modelFormField);
|
||||
formStringRenderer.renderFormatHeaderRowCellClose(buffer, context, this, modelFormField);
|
||||
formStringRenderer.renderFieldTitle(writer, context, modelFormField);
|
||||
formStringRenderer.renderFormatHeaderRowCellClose(writer, context, this, modelFormField);
|
||||
}
|
||||
formStringRenderer.renderFormatHeaderRowClose(buffer, context, this);
|
||||
formStringRenderer.renderFormatHeaderRowClose(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1299,7 +1288,7 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void preparePager(Map context) {
|
||||
public void preparePager(Map<String, Object> context) {
|
||||
this.rowCount = 0;
|
||||
String lookupName = this.getListName();
|
||||
if (UtilValidate.isEmpty(lookupName)) {
|
||||
@@ -1365,7 +1354,7 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemRows(Writer writer, Map context, FormStringRenderer formStringRenderer, boolean formPerItem, int numOfColumns) throws IOException {
|
||||
public void renderItemRows(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer, boolean formPerItem, int numOfColumns) throws IOException {
|
||||
this.rowCount = 0;
|
||||
String lookupName = this.getListName();
|
||||
if (UtilValidate.isEmpty(lookupName)) {
|
||||
@@ -1559,9 +1548,7 @@ public class ModelForm extends ModelWidget {
|
||||
// are now rendered: this will create a visual representation
|
||||
// of one row (for the current position).
|
||||
if (innerDisplayHyperlinkFieldsBegin.size() > 0 || innerFormFields.size() > 0 || innerDisplayHyperlinkFieldsEnd.size() > 0) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
this.renderItemRow(buffer, localContext, formStringRenderer, formPerItem, hiddenIgnoredFieldList, innerDisplayHyperlinkFieldsBegin, innerFormFields, innerDisplayHyperlinkFieldsEnd, currentPosition, numOfColumns);
|
||||
writer.write(buffer.toString());
|
||||
this.renderItemRow(writer, localContext, formStringRenderer, formPerItem, hiddenIgnoredFieldList, innerDisplayHyperlinkFieldsBegin, innerFormFields, innerDisplayHyperlinkFieldsEnd, currentPosition, numOfColumns);
|
||||
}
|
||||
} // iteration on positions
|
||||
} // iteration on items
|
||||
@@ -1587,7 +1574,7 @@ public class ModelForm extends ModelWidget {
|
||||
// The fields in the three lists, usually created in the preprocessing phase
|
||||
// of the renderItemRows method are rendered: this will create a visual representation
|
||||
// of one row (corresponding to one position).
|
||||
public void renderItemRow(StringBuffer buffer, Map localContext, FormStringRenderer formStringRenderer, boolean formPerItem, List hiddenIgnoredFieldList, List innerDisplayHyperlinkFieldsBegin, List innerFormFields, List innerDisplayHyperlinkFieldsEnd, int position, int numOfColumns) {
|
||||
public void renderItemRow(Writer writer, Map localContext, FormStringRenderer formStringRenderer, boolean formPerItem, List hiddenIgnoredFieldList, List innerDisplayHyperlinkFieldsBegin, List innerFormFields, List innerDisplayHyperlinkFieldsEnd, int position, int numOfColumns) throws IOException {
|
||||
int numOfCells = innerDisplayHyperlinkFieldsBegin.size() +
|
||||
innerDisplayHyperlinkFieldsEnd.size() +
|
||||
(innerFormFields.size() > 0? 1: 0);
|
||||
@@ -1597,7 +1584,7 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
|
||||
// render row formatting open
|
||||
formStringRenderer.renderFormatItemRowOpen(buffer, localContext, this);
|
||||
formStringRenderer.renderFormatItemRowOpen(writer, localContext, this);
|
||||
|
||||
// do the first part of display and hyperlink fields
|
||||
Iterator innerDisplayHyperlinkFieldIter = innerDisplayHyperlinkFieldsBegin.iterator();
|
||||
@@ -1605,44 +1592,44 @@ public class ModelForm extends ModelWidget {
|
||||
ModelFormField modelFormField = (ModelFormField) innerDisplayHyperlinkFieldIter.next();
|
||||
// span columns only if this is the last column in the row (not just in this first list)
|
||||
if (innerDisplayHyperlinkFieldIter.hasNext() || numOfCells > innerDisplayHyperlinkFieldsBegin.size()) {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, localContext, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
|
||||
} else {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, localContext, this, modelFormField, numOfColumnsToSpan);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
|
||||
}
|
||||
modelFormField.renderFieldString(buffer, localContext, formStringRenderer);
|
||||
formStringRenderer.renderFormatItemRowCellClose(buffer, localContext, this, modelFormField);
|
||||
modelFormField.renderFieldString(writer, localContext, formStringRenderer);
|
||||
formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
|
||||
}
|
||||
|
||||
// The form cell is rendered only if there is at least an input field
|
||||
if (innerFormFields.size() > 0) {
|
||||
// render the "form" cell
|
||||
formStringRenderer.renderFormatItemRowFormCellOpen(buffer, localContext, this); // TODO: colspan
|
||||
formStringRenderer.renderFormatItemRowFormCellOpen(writer, localContext, this); // TODO: colspan
|
||||
|
||||
if (formPerItem) {
|
||||
formStringRenderer.renderFormOpen(buffer, localContext, this);
|
||||
formStringRenderer.renderFormOpen(writer, localContext, this);
|
||||
}
|
||||
|
||||
// do all of the hidden fields...
|
||||
this.renderHiddenIgnoredFields(buffer, localContext, formStringRenderer, hiddenIgnoredFieldList);
|
||||
this.renderHiddenIgnoredFields(writer, localContext, formStringRenderer, hiddenIgnoredFieldList);
|
||||
|
||||
Iterator innerFormFieldIter = innerFormFields.iterator();
|
||||
while (innerFormFieldIter.hasNext()) {
|
||||
ModelFormField modelFormField = (ModelFormField) innerFormFieldIter.next();
|
||||
if (separateColumns || modelFormField.getSeparateColumn()) {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, localContext, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
|
||||
}
|
||||
// render field widget
|
||||
modelFormField.renderFieldString(buffer, localContext, formStringRenderer);
|
||||
modelFormField.renderFieldString(writer, localContext, formStringRenderer);
|
||||
if (separateColumns || modelFormField.getSeparateColumn()) {
|
||||
formStringRenderer.renderFormatItemRowCellClose(buffer, localContext, this, modelFormField);
|
||||
formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
|
||||
}
|
||||
}
|
||||
|
||||
if (formPerItem) {
|
||||
formStringRenderer.renderFormClose(buffer, localContext, this);
|
||||
formStringRenderer.renderFormClose(writer, localContext, this);
|
||||
}
|
||||
|
||||
formStringRenderer.renderFormatItemRowFormCellClose(buffer, localContext, this);
|
||||
formStringRenderer.renderFormatItemRowFormCellClose(writer, localContext, this);
|
||||
}
|
||||
|
||||
// render the rest of the display/hyperlink fields
|
||||
@@ -1651,19 +1638,19 @@ public class ModelForm extends ModelWidget {
|
||||
ModelFormField modelFormField = (ModelFormField) innerDisplayHyperlinkFieldIter.next();
|
||||
// span columns only if this is the last column in the row
|
||||
if (innerDisplayHyperlinkFieldIter.hasNext()) {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, localContext, this, modelFormField, 1);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
|
||||
} else {
|
||||
formStringRenderer.renderFormatItemRowCellOpen(buffer, localContext, this, modelFormField, numOfColumnsToSpan);
|
||||
formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
|
||||
}
|
||||
modelFormField.renderFieldString(buffer, localContext, formStringRenderer);
|
||||
formStringRenderer.renderFormatItemRowCellClose(buffer, localContext, this, modelFormField);
|
||||
modelFormField.renderFieldString(writer, localContext, formStringRenderer);
|
||||
formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
|
||||
}
|
||||
|
||||
// render row formatting close
|
||||
formStringRenderer.renderFormatItemRowClose(buffer, localContext, this);
|
||||
formStringRenderer.renderFormatItemRowClose(writer, localContext, this);
|
||||
}
|
||||
|
||||
public List getHiddenIgnoredFields(Map context, Set alreadyRendered, List fieldList, int position) {
|
||||
public List getHiddenIgnoredFields(Map<String, Object> context, Set alreadyRendered, List fieldList, int position) {
|
||||
List hiddenIgnoredFieldList = FastList.newInstance();
|
||||
Iterator fieldIter = fieldList.iterator();
|
||||
while (fieldIter.hasNext()) {
|
||||
@@ -1705,7 +1692,7 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
return hiddenIgnoredFieldList;
|
||||
}
|
||||
public void renderHiddenIgnoredFields(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer, List fieldList) {
|
||||
public void renderHiddenIgnoredFields(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer, List fieldList) throws IOException {
|
||||
Iterator fieldIter = fieldList.iterator();
|
||||
while (fieldIter.hasNext()) {
|
||||
ModelFormField modelFormField = (ModelFormField) fieldIter.next();
|
||||
@@ -1715,13 +1702,13 @@ public class ModelForm extends ModelWidget {
|
||||
switch (fieldInfo.getFieldType()) {
|
||||
case ModelFormField.FieldInfo.HIDDEN :
|
||||
case ModelFormField.FieldInfo.IGNORED :
|
||||
modelFormField.renderFieldString(buffer, context, formStringRenderer);
|
||||
modelFormField.renderFieldString(writer, context, formStringRenderer);
|
||||
break;
|
||||
|
||||
case ModelFormField.FieldInfo.DISPLAY :
|
||||
case ModelFormField.FieldInfo.DISPLAY_ENTITY :
|
||||
case ModelFormField.FieldInfo.HYPERLINK :
|
||||
formStringRenderer.renderHiddenField(buffer, context, modelFormField, modelFormField.getEntry(context));
|
||||
formStringRenderer.renderHiddenField(writer, context, modelFormField, modelFormField.getEntry(context));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1756,12 +1743,12 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
|
||||
|
||||
public LocalDispatcher getDispatcher(Map context) {
|
||||
public LocalDispatcher getDispatcher(Map<String, Object> context) {
|
||||
LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher");
|
||||
return dispatcher;
|
||||
}
|
||||
|
||||
public GenericDelegator getDelegator(Map context) {
|
||||
public GenericDelegator getDelegator(Map<String, Object> context) {
|
||||
GenericDelegator delegator = (GenericDelegator) context.get("delegator");
|
||||
return delegator;
|
||||
}
|
||||
@@ -1795,7 +1782,7 @@ public class ModelForm extends ModelWidget {
|
||||
return this.defaultMapName.getOriginalName();
|
||||
}
|
||||
|
||||
public Map getDefaultMap(Map context) {
|
||||
public Map getDefaultMap(Map<String, Object> context) {
|
||||
return (Map) this.defaultMapName.get(context);
|
||||
}
|
||||
|
||||
@@ -1927,7 +1914,7 @@ public class ModelForm extends ModelWidget {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getCurrentFormName(Map context) {
|
||||
public String getCurrentFormName(Map<String, Object> context) {
|
||||
Integer itemIndex = (Integer) context.get("itemIndex");
|
||||
String formName = (String) context.get("formName");
|
||||
if (UtilValidate.isEmpty(formName)) {
|
||||
@@ -1944,7 +1931,7 @@ public class ModelForm extends ModelWidget {
|
||||
/** iterate through altTargets list to see if any should be used, if not return original target
|
||||
* @return The target for this Form
|
||||
*/
|
||||
public String getTarget(Map context, String targetType) {
|
||||
public String getTarget(Map<String, Object> context, String targetType) {
|
||||
try {
|
||||
// use the same Interpreter (ie with the same context setup) for all evals
|
||||
Interpreter bsh = this.getBshInterpreter(context);
|
||||
@@ -2026,11 +2013,11 @@ public class ModelForm extends ModelWidget {
|
||||
return formLocation + "#" + name;
|
||||
}
|
||||
|
||||
public void resetBshInterpreter(Map context) {
|
||||
public void resetBshInterpreter(Map<String, Object> context) {
|
||||
context.remove("bshInterpreter");
|
||||
}
|
||||
|
||||
public Interpreter getBshInterpreter(Map context) throws EvalError {
|
||||
public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
|
||||
Interpreter bsh = (Interpreter) context.get("bshInterpreter");
|
||||
if (bsh == null) {
|
||||
bsh = BshUtil.makeInterpreter(context);
|
||||
@@ -2222,7 +2209,7 @@ public class ModelForm extends ModelWidget {
|
||||
return this.onPaginateUpdateAreas;
|
||||
}
|
||||
|
||||
public String getPaginateTarget(Map context) {
|
||||
public String getPaginateTarget(Map<String, Object> context) {
|
||||
String targ = this.paginateTarget.expandString(context);
|
||||
if (UtilValidate.isEmpty(targ)) {
|
||||
Map parameters = (Map) context.get("parameters");
|
||||
@@ -2237,7 +2224,7 @@ public class ModelForm extends ModelWidget {
|
||||
return this.paginateTargetAnchor;
|
||||
}
|
||||
|
||||
public String getPaginateIndexField(Map context) {
|
||||
public String getPaginateIndexField(Map<String, Object> context) {
|
||||
String field = this.paginateIndexField.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_INDEX_FIELD;
|
||||
@@ -2245,7 +2232,7 @@ public class ModelForm extends ModelWidget {
|
||||
return field;
|
||||
}
|
||||
|
||||
public int getPaginateIndex(Map context) {
|
||||
public int getPaginateIndex(Map<String, Object> context) {
|
||||
String field = this.getPaginateIndexField(context);
|
||||
|
||||
int viewIndex = 0;
|
||||
@@ -2276,7 +2263,7 @@ public class ModelForm extends ModelWidget {
|
||||
return viewIndex;
|
||||
}
|
||||
|
||||
public String getPaginateSizeField(Map context) {
|
||||
public String getPaginateSizeField(Map<String, Object> context) {
|
||||
String field = this.paginateSizeField.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_SIZE_FIELD;
|
||||
@@ -2284,7 +2271,7 @@ public class ModelForm extends ModelWidget {
|
||||
return field;
|
||||
}
|
||||
|
||||
public int getPaginateSize(Map context) {
|
||||
public int getPaginateSize(Map<String, Object> context) {
|
||||
String field = this.getPaginateSizeField(context);
|
||||
|
||||
int viewSize = this.defaultViewSize;
|
||||
@@ -2315,7 +2302,7 @@ public class ModelForm extends ModelWidget {
|
||||
return viewSize;
|
||||
}
|
||||
|
||||
public String getPaginateFirstLabel(Map context) {
|
||||
public String getPaginateFirstLabel(Map<String, Object> context) {
|
||||
String field = this.paginateFirstLabel.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_FIRST_LABEL;
|
||||
@@ -2323,7 +2310,7 @@ public class ModelForm extends ModelWidget {
|
||||
return field;
|
||||
}
|
||||
|
||||
public String getPaginatePreviousLabel(Map context) {
|
||||
public String getPaginatePreviousLabel(Map<String, Object> context) {
|
||||
String field = this.paginatePreviousLabel.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_PREV_LABEL;
|
||||
@@ -2331,7 +2318,7 @@ public class ModelForm extends ModelWidget {
|
||||
return field;
|
||||
}
|
||||
|
||||
public String getPaginateNextLabel(Map context) {
|
||||
public String getPaginateNextLabel(Map<String, Object> context) {
|
||||
String field = this.paginateNextLabel.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_NEXT_LABEL;
|
||||
@@ -2339,7 +2326,7 @@ public class ModelForm extends ModelWidget {
|
||||
return field;
|
||||
}
|
||||
|
||||
public String getPaginateLastLabel(Map context) {
|
||||
public String getPaginateLastLabel(Map<String, Object> context) {
|
||||
String field = this.paginateLastLabel.expandString(context);
|
||||
if (UtilValidate.isEmpty(field)) {
|
||||
field = DEFAULT_PAG_LAST_LABEL;
|
||||
@@ -2367,7 +2354,7 @@ public class ModelForm extends ModelWidget {
|
||||
return DEFAULT_PAG_LAST_STYLE;
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
return this.targetWindowExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -2451,39 +2438,39 @@ public class ModelForm extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public int getListSize(Map context) {
|
||||
public int getListSize(Map<String, Object> context) {
|
||||
Integer value = (Integer) context.get("listSize");
|
||||
return value != null ? value.intValue() : 0;
|
||||
}
|
||||
|
||||
public int getViewIndex(Map context) {
|
||||
public int getViewIndex(Map<String, Object> context) {
|
||||
return getPaginateIndex(context);
|
||||
}
|
||||
|
||||
public int getViewSize(Map context) {
|
||||
public int getViewSize(Map<String, Object> context) {
|
||||
return getPaginateSize(context);
|
||||
}
|
||||
|
||||
public int getLowIndex(Map context) {
|
||||
public int getLowIndex(Map<String, Object> context) {
|
||||
Integer value = (Integer) context.get("lowIndex");
|
||||
return value != null ? value.intValue() : 0;
|
||||
}
|
||||
|
||||
public int getHighIndex(Map context) {
|
||||
public int getHighIndex(Map<String, Object> context) {
|
||||
Integer value = (Integer) context.get("highIndex");
|
||||
return value != null ? value.intValue() : 0;
|
||||
}
|
||||
|
||||
public int getActualPageSize(Map context) {
|
||||
public int getActualPageSize(Map<String, Object> context) {
|
||||
Integer value = (Integer) context.get("actualPageSize");
|
||||
return value != null ? value.intValue() : (getHighIndex(context) - getLowIndex(context));
|
||||
}
|
||||
|
||||
public List getFieldList() {
|
||||
public List<ModelFormField> getFieldList() {
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
private int getOverrideListSize(Map context) {
|
||||
private int getOverrideListSize(Map<String, Object> context) {
|
||||
int listSize = 0;
|
||||
String size = this.overrideListSize.expandString(context);
|
||||
if (!UtilValidate.isEmpty(size)) {
|
||||
@@ -2496,7 +2483,7 @@ public class ModelForm extends ModelWidget {
|
||||
return listSize;
|
||||
}
|
||||
|
||||
public void getListLimits(Map context, Object entryList) {
|
||||
public void getListLimits(Map<String, Object> context, Object entryList) {
|
||||
int listSize = 0;
|
||||
int viewIndex = 0;
|
||||
int viewSize = 0;
|
||||
@@ -2541,7 +2528,7 @@ public class ModelForm extends ModelWidget {
|
||||
context.put("highIndex", new Integer(highIndex));
|
||||
}
|
||||
|
||||
public String getPassedRowCount(Map context) {
|
||||
public String getPassedRowCount(Map<String, Object> context) {
|
||||
return rowCountExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -2750,14 +2737,14 @@ public class ModelForm extends ModelWidget {
|
||||
return this.style;
|
||||
}
|
||||
|
||||
public void renderStartString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderFieldGroupOpen(buffer, context, this);
|
||||
formStringRenderer.renderFormatSingleWrapperOpen(buffer, context, modelForm);
|
||||
public void renderStartString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderFieldGroupOpen(writer, context, this);
|
||||
formStringRenderer.renderFormatSingleWrapperOpen(writer, context, modelForm);
|
||||
}
|
||||
|
||||
public void renderEndString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderFormatSingleWrapperClose(buffer, context, modelForm);
|
||||
formStringRenderer.renderFieldGroupClose(buffer, context, this);
|
||||
public void renderEndString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderFormatSingleWrapperClose(writer, context, modelForm);
|
||||
formStringRenderer.renderFieldGroupClose(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2782,16 +2769,16 @@ public class ModelForm extends ModelWidget {
|
||||
this.rightTextStyle = new FlexibleStringExpander(sortOrderElement.getAttribute("right-text-style"));
|
||||
}
|
||||
|
||||
public String getStyle(Map context) { return this.style.expandString(context); }
|
||||
public String getText(Map context) { return this.text.expandString(context); }
|
||||
public String getTextStyle(Map context) { return this.textStyle.expandString(context); }
|
||||
public String getLeftText(Map context) { return this.leftText.expandString(context); }
|
||||
public String getLeftTextStyle(Map context) { return this.leftTextStyle.expandString(context); }
|
||||
public String getRightText(Map context) { return this.rightText.expandString(context); }
|
||||
public String getRightTextStyle(Map context) { return this.rightTextStyle.expandString(context); }
|
||||
public String getStyle(Map<String, Object> context) { return this.style.expandString(context); }
|
||||
public String getText(Map<String, Object> context) { return this.text.expandString(context); }
|
||||
public String getTextStyle(Map<String, Object> context) { return this.textStyle.expandString(context); }
|
||||
public String getLeftText(Map<String, Object> context) { return this.leftText.expandString(context); }
|
||||
public String getLeftTextStyle(Map<String, Object> context) { return this.leftTextStyle.expandString(context); }
|
||||
public String getRightText(Map<String, Object> context) { return this.rightText.expandString(context); }
|
||||
public String getRightTextStyle(Map<String, Object> context) { return this.rightTextStyle.expandString(context); }
|
||||
|
||||
public void renderString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderBanner(buffer, context, this);
|
||||
public void renderString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderBanner(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class ModelFormAction {
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
|
||||
}
|
||||
|
||||
public abstract void runAction(Map context);
|
||||
public abstract void runAction(Map<String, Object> context);
|
||||
|
||||
public static List readSubActions(ModelForm modelForm, Element parentElement) {
|
||||
List actions = new LinkedList();
|
||||
@@ -95,7 +95,7 @@ public abstract class ModelFormAction {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static void runSubActions(List actions, Map context) {
|
||||
public static void runSubActions(List actions, Map<String, Object> context) {
|
||||
if (actions == null) return;
|
||||
|
||||
Iterator actionIter = actions.iterator();
|
||||
@@ -127,7 +127,7 @@ public abstract class ModelFormAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -185,7 +185,7 @@ public abstract class ModelFormAction {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -225,7 +225,7 @@ public abstract class ModelFormAction {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
//String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
//boolean global = "true".equals(globalStr);
|
||||
@@ -268,7 +268,7 @@ public abstract class ModelFormAction {
|
||||
this.location = scriptElement.getAttribute("location");
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
if (location.endsWith(".bsh")) {
|
||||
try {
|
||||
BshUtil.runBshAtLocation(location, context);
|
||||
@@ -321,7 +321,7 @@ public abstract class ModelFormAction {
|
||||
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(serviceNameExpanded)) {
|
||||
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
|
||||
@@ -385,7 +385,7 @@ public abstract class ModelFormAction {
|
||||
finder = new PrimaryKeyFinder(entityOneElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelForm.getDelegator(context));
|
||||
} catch (GeneralException e) {
|
||||
@@ -420,7 +420,7 @@ public abstract class ModelFormAction {
|
||||
finder = new ByAndFinder(entityAndElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
// don't want to do this: context.put("defaultFormResultList", null);
|
||||
finder.runFind(context, this.modelForm.getDelegator(context));
|
||||
@@ -462,7 +462,7 @@ public abstract class ModelFormAction {
|
||||
finder = new ByConditionFinder(entityConditionElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
// don't want to do this: context.put("defaultFormResultList", null);
|
||||
finder.runFind(context, this.modelForm.getDelegator(context));
|
||||
@@ -481,3 +481,4 @@ public abstract class ModelFormAction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.form;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
@@ -49,8 +51,6 @@ import org.ofbiz.entity.GenericEntity;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.entity.condition.EntityCondition;
|
||||
import org.ofbiz.entity.condition.EntityConditionList;
|
||||
import org.ofbiz.entity.condition.EntityOperator;
|
||||
import org.ofbiz.entity.finder.EntityFinderUtil;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelField;
|
||||
@@ -576,8 +576,8 @@ public class ModelFormField {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
this.fieldInfo.renderFieldString(buffer, context, formStringRenderer);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
this.fieldInfo.renderFieldString(writer, context, formStringRenderer);
|
||||
}
|
||||
|
||||
public List<UpdateArea> getOnChangeUpdateAreas() {
|
||||
@@ -662,11 +662,11 @@ public class ModelFormField {
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public String getEntry(Map context) {
|
||||
public String getEntry(Map<String, Object> context) {
|
||||
return this.getEntry(context, "");
|
||||
}
|
||||
|
||||
public String getEntry(Map context, String defaultValue) {
|
||||
public String getEntry(Map<String, Object> context, String defaultValue) {
|
||||
Boolean isError = (Boolean) context.get("isError");
|
||||
Boolean useRequestParameters = (Boolean) context.get("useRequestParameters");
|
||||
|
||||
@@ -760,7 +760,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public Map getMap(Map context) {
|
||||
public Map getMap(Map<String, Object> context) {
|
||||
if (this.mapAcsr == null || this.mapAcsr.isEmpty()) {
|
||||
//Debug.logInfo("Getting Map from default of the form because of no mapAcsr for field " + this.getName(), module);
|
||||
return this.modelForm.getDefaultMap(context);
|
||||
@@ -814,7 +814,7 @@ public class ModelFormField {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getParameterName(Map context) {
|
||||
public String getParameterName(Map<String, Object> context) {
|
||||
String baseName;
|
||||
if (UtilValidate.isNotEmpty(this.parameterName)) {
|
||||
baseName = this.parameterName;
|
||||
@@ -859,7 +859,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAction(Map context) {
|
||||
public String getAction(Map<String, Object> context) {
|
||||
if (this.action != null && this.action.getOriginal() != null) {
|
||||
return action.expandString(context);
|
||||
} else {
|
||||
@@ -876,7 +876,7 @@ public class ModelFormField {
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBeRed(Map context) {
|
||||
public boolean shouldBeRed(Map<String, Object> context) {
|
||||
// red-when ( never | before-now | after-now | by-name ) "by-name"
|
||||
|
||||
String redCondition = this.redWhen;
|
||||
@@ -996,7 +996,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTitle(Map context) {
|
||||
public String getTitle(Map<String, Object> context) {
|
||||
if (this.title != null && this.title.getOriginal() != null) {
|
||||
return title.expandString(context);
|
||||
} else {
|
||||
@@ -1019,21 +1019,21 @@ public class ModelFormField {
|
||||
}
|
||||
|
||||
// create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
|
||||
StringBuffer autoTitleBuffer = new StringBuffer();
|
||||
StringBuffer autoTitlewriter = new StringBuffer();
|
||||
|
||||
// always use upper case first letter...
|
||||
autoTitleBuffer.append(Character.toUpperCase(this.name.charAt(0)));
|
||||
autoTitlewriter.append(Character.toUpperCase(this.name.charAt(0)));
|
||||
|
||||
// just put spaces before the upper case letters
|
||||
for (int i = 1; i < this.name.length(); i++) {
|
||||
char curChar = this.name.charAt(i);
|
||||
if (Character.isUpperCase(curChar)) {
|
||||
autoTitleBuffer.append(' ');
|
||||
autoTitlewriter.append(' ');
|
||||
}
|
||||
autoTitleBuffer.append(curChar);
|
||||
autoTitlewriter.append(curChar);
|
||||
}
|
||||
|
||||
return autoTitleBuffer.toString();
|
||||
return autoTitlewriter.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTooltip(Map context) {
|
||||
public String getTooltip(Map<String, Object> context) {
|
||||
if (tooltip != null && !tooltip.isEmpty()) {
|
||||
return tooltip.expandString(context);
|
||||
} else {
|
||||
@@ -1084,7 +1084,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getUseWhen(Map context) {
|
||||
public String getUseWhen(Map<String, Object> context) {
|
||||
if (useWhen != null && !useWhen.isEmpty()) {
|
||||
return useWhen.expandString(context);
|
||||
} else {
|
||||
@@ -1127,7 +1127,7 @@ public class ModelFormField {
|
||||
return this.useWhen.isEmpty();
|
||||
}
|
||||
|
||||
public boolean shouldUse(Map context) {
|
||||
public boolean shouldUse(Map<String, Object> context) {
|
||||
String useWhenStr = this.getUseWhen(context);
|
||||
if (UtilValidate.isEmpty(useWhenStr)) {
|
||||
return true;
|
||||
@@ -1491,7 +1491,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer);
|
||||
public abstract void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException;
|
||||
}
|
||||
|
||||
public static abstract class FieldInfoWithOptions extends FieldInfo {
|
||||
@@ -1500,7 +1500,7 @@ public class ModelFormField {
|
||||
}
|
||||
|
||||
protected FlexibleStringExpander noCurrentSelectedKey = null;
|
||||
protected List<OptionSource> optionSources = new LinkedList();
|
||||
protected List<OptionSource> optionSources = new LinkedList<OptionSource>();
|
||||
|
||||
public FieldInfoWithOptions(int fieldSource, int fieldType, ModelFormField modelFormField) {
|
||||
super(fieldSource, fieldType, modelFormField);
|
||||
@@ -1531,7 +1531,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public List getAllOptionValues(Map context, GenericDelegator delegator) {
|
||||
public List getAllOptionValues(Map<String, Object> context, GenericDelegator delegator) {
|
||||
List optionValues = new LinkedList();
|
||||
Iterator optionSourceIter = this.optionSources.iterator();
|
||||
while (optionSourceIter.hasNext()) {
|
||||
@@ -1562,7 +1562,7 @@ public class ModelFormField {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getNoCurrentSelectedKey(Map context) {
|
||||
public String getNoCurrentSelectedKey(Map<String, Object> context) {
|
||||
if (this.noCurrentSelectedKey == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1599,7 +1599,7 @@ public class ModelFormField {
|
||||
public static abstract class OptionSource {
|
||||
protected FieldInfo fieldInfo;
|
||||
|
||||
public abstract void addOptionValues(List optionValues, Map context, GenericDelegator delegator);
|
||||
public abstract void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator);
|
||||
}
|
||||
|
||||
public static class SingleOption extends OptionSource {
|
||||
@@ -1618,7 +1618,7 @@ public class ModelFormField {
|
||||
this.fieldInfo = fieldInfo;
|
||||
}
|
||||
|
||||
public void addOptionValues(List optionValues, Map context, GenericDelegator delegator) {
|
||||
public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) {
|
||||
optionValues.add(new OptionValue(key.expandString(context), description.expandString(context)));
|
||||
}
|
||||
}
|
||||
@@ -1647,7 +1647,7 @@ public class ModelFormField {
|
||||
this.fieldInfo = fieldInfo;
|
||||
}
|
||||
|
||||
public void addOptionValues(List optionValues, Map context, GenericDelegator delegator) {
|
||||
public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) {
|
||||
List dataList = (List) this.listAcsr.get(context);
|
||||
if (dataList != null && dataList.size() != 0) {
|
||||
Iterator dataIter = dataList.iterator();
|
||||
@@ -1718,7 +1718,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public void addOptionValues(List optionValues, Map context, GenericDelegator delegator) {
|
||||
public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) {
|
||||
// first expand any conditions that need expanding based on the current context
|
||||
EntityCondition findCondition = null;
|
||||
if (this.constraintList != null && this.constraintList.size() > 0) {
|
||||
@@ -1804,8 +1804,8 @@ public class ModelFormField {
|
||||
this.alsoHidden = !"false".equals(element.getAttribute("also-hidden"));
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderDisplayField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderDisplayField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1818,7 +1818,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDescription(Map context) {
|
||||
public String getDescription(Map<String, Object> context) {
|
||||
String retVal = null;
|
||||
if (this.description != null && !this.description.isEmpty()) {
|
||||
retVal = this.description.expandString(context);
|
||||
@@ -1916,7 +1916,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDescription(Map context) {
|
||||
public String getDescription(Map<String, Object> context) {
|
||||
Locale locale = UtilMisc.ensureLocale(context.get("locale"));
|
||||
|
||||
// rather than using the context to expand the string, lookup the given entity and use it to expand the string
|
||||
@@ -1998,8 +1998,8 @@ public class ModelFormField {
|
||||
this.targetWindowExdr = new FlexibleStringExpander(element.getAttribute("target-window"));
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderHyperlinkField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderHyperlinkField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2020,7 +2020,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
String targetWindow = this.targetWindowExdr.expandString(context);
|
||||
return targetWindow;
|
||||
}
|
||||
@@ -2028,14 +2028,14 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDescription(Map context) {
|
||||
public String getDescription(Map<String, Object> context) {
|
||||
return this.description.expandString(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTarget(Map context) {
|
||||
public String getTarget(Map<String, Object> context) {
|
||||
return this.target.expandString(context);
|
||||
}
|
||||
|
||||
@@ -2106,7 +2106,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDescription(Map context) {
|
||||
public String getDescription(Map<String, Object> context) {
|
||||
if (this.description != null) {
|
||||
return this.description.expandString(context);
|
||||
} else {
|
||||
@@ -2114,7 +2114,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
String targetWindow = this.targetWindowExdr.expandString(context);
|
||||
return targetWindow;
|
||||
}
|
||||
@@ -2122,7 +2122,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTarget(Map context) {
|
||||
public String getTarget(Map<String, Object> context) {
|
||||
if (this.target != null) {
|
||||
return this.target.expandString(context);
|
||||
} else {
|
||||
@@ -2133,7 +2133,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getUseWhen(Map context) {
|
||||
public String getUseWhen(Map<String, Object> context) {
|
||||
if (this.useWhen != null) {
|
||||
return this.useWhen.expandString(context);
|
||||
} else {
|
||||
@@ -2141,7 +2141,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldUse(Map context) {
|
||||
public boolean shouldUse(Map<String, Object> context) {
|
||||
boolean shouldUse = true;
|
||||
String useWhen = this.getUseWhen(context);
|
||||
if (UtilValidate.isNotEmpty(useWhen)) {
|
||||
@@ -2260,8 +2260,8 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderTextField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderTextField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2300,7 +2300,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultValue(Map context) {
|
||||
public String getDefaultValue(Map<String, Object> context) {
|
||||
if (this.defaultValue != null) {
|
||||
return this.defaultValue.expandString(context);
|
||||
} else {
|
||||
@@ -2384,8 +2384,8 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderTextareaField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderTextareaField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2405,7 +2405,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultValue(Map context) {
|
||||
public String getDefaultValue(Map<String, Object> context) {
|
||||
if (this.defaultValue != null) {
|
||||
return this.defaultValue.expandString(context);
|
||||
} else {
|
||||
@@ -2423,7 +2423,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getVisualEditorButtons(Map context) {
|
||||
public String getVisualEditorButtons(Map<String, Object> context) {
|
||||
return this.visualEditorButtons.expandString(context);
|
||||
}
|
||||
|
||||
@@ -2503,8 +2503,8 @@ public class ModelFormField {
|
||||
clock = element.getAttribute("clock");
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderDateTimeField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderDateTimeField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2517,7 +2517,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultValue(Map context) {
|
||||
public String getDefaultValue(Map<String, Object> context) {
|
||||
if (this.defaultValue != null) {
|
||||
return this.defaultValue.expandString(context);
|
||||
} else {
|
||||
@@ -2561,7 +2561,7 @@ public class ModelFormField {
|
||||
* @param context Context Map
|
||||
* @return Default value string for date-time
|
||||
*/
|
||||
public String getDefaultDateTimeString(Map context) {
|
||||
public String getDefaultDateTimeString(Map<String, Object> context) {
|
||||
if (this.defaultValue != null && !this.defaultValue.isEmpty()) {
|
||||
return this.getDefaultValue(context);
|
||||
}
|
||||
@@ -2626,8 +2626,8 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderDropDownField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderDropDownField(writer, context, this);
|
||||
}
|
||||
|
||||
public boolean isAllowEmpty() {
|
||||
@@ -2646,7 +2646,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public String getCurrentDescription(Map context) {
|
||||
public String getCurrentDescription(Map<String, Object> context) {
|
||||
if (this.currentDescription == null)
|
||||
return null;
|
||||
else
|
||||
@@ -2686,7 +2686,7 @@ public class ModelFormField {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getParameterNameOther(Map context) {
|
||||
public String getParameterNameOther(Map<String, Object> context) {
|
||||
String baseName;
|
||||
if (UtilValidate.isNotEmpty(this.modelFormField.parameterName)) {
|
||||
baseName = this.modelFormField.parameterName;
|
||||
@@ -2722,8 +2722,8 @@ public class ModelFormField {
|
||||
super(element, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderRadioField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderRadioField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2748,11 +2748,11 @@ public class ModelFormField {
|
||||
allChecked = new FlexibleStringExpander(element.getAttribute("all-checked"));
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderCheckField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderCheckField(writer, context, this);
|
||||
}
|
||||
|
||||
public Boolean isAllChecked(Map context) {
|
||||
public Boolean isAllChecked(Map<String, Object> context) {
|
||||
String allCheckedStr = this.allChecked.expandString(context);
|
||||
if (UtilValidate.isNotEmpty(allCheckedStr)) {
|
||||
return new Boolean("true".equals(allCheckedStr));
|
||||
@@ -2786,8 +2786,8 @@ public class ModelFormField {
|
||||
this.backgroundSubmitRefreshTargetExdr = new FlexibleStringExpander(element.getAttribute("background-submit-refresh-target"));
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderSubmitField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderSubmitField(writer, context, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2818,7 +2818,7 @@ public class ModelFormField {
|
||||
imageLocation = string;
|
||||
}
|
||||
|
||||
public String getBackgroundSubmitRefreshTarget(Map context) {
|
||||
public String getBackgroundSubmitRefreshTarget(Map<String, Object> context) {
|
||||
return this.backgroundSubmitRefreshTargetExdr.expandString(context);
|
||||
}
|
||||
}
|
||||
@@ -2840,8 +2840,8 @@ public class ModelFormField {
|
||||
super(element, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderResetField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderResetField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2865,11 +2865,11 @@ public class ModelFormField {
|
||||
this.setValue(element.getAttribute("value"));
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderHiddenField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderHiddenField(writer, context, this);
|
||||
}
|
||||
|
||||
public String getValue(Map context) {
|
||||
public String getValue(Map<String, Object> context) {
|
||||
if (this.value != null && !this.value.isEmpty()) {
|
||||
return this.value.expandString(context);
|
||||
} else {
|
||||
@@ -2899,8 +2899,8 @@ public class ModelFormField {
|
||||
super(element, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderIgnoredField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderIgnoredField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2940,8 +2940,8 @@ public class ModelFormField {
|
||||
return this.hideOptions;
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderTextFindField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderTextFindField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2954,8 +2954,8 @@ public class ModelFormField {
|
||||
super(fieldSource, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderDateFindField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderDateFindField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2968,8 +2968,8 @@ public class ModelFormField {
|
||||
super(fieldSource, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderRangeFindField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderRangeFindField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2989,11 +2989,11 @@ public class ModelFormField {
|
||||
super(fieldSource, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderLookupField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderLookupField(writer, context, this);
|
||||
}
|
||||
|
||||
public String getFormName(Map context) {
|
||||
public String getFormName(Map<String, Object> context) {
|
||||
return this.formName.expandString(context);
|
||||
}
|
||||
|
||||
@@ -3031,8 +3031,8 @@ public class ModelFormField {
|
||||
super(fieldSource, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderFileField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderFileField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3046,8 +3046,8 @@ public class ModelFormField {
|
||||
super(fieldSource, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderPasswordField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderPasswordField(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3114,8 +3114,8 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFieldString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) {
|
||||
formStringRenderer.renderImageField(buffer, context, this);
|
||||
public void renderFieldString(Writer writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
|
||||
formStringRenderer.renderImageField(writer, context, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -3155,7 +3155,7 @@ public class ModelFormField {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultValue(Map context) {
|
||||
public String getDefaultValue(Map<String, Object> context) {
|
||||
if (this.defaultValue != null) {
|
||||
return this.defaultValue.expandString(context);
|
||||
} else {
|
||||
@@ -3163,7 +3163,7 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(Map context) {
|
||||
public String getValue(Map<String, Object> context) {
|
||||
if (this.value != null && !this.value.isEmpty()) {
|
||||
return this.value.expandString(context);
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,7 +52,7 @@ public class HtmlFormWrapper {
|
||||
protected HttpServletResponse response;
|
||||
protected ModelForm modelForm;
|
||||
protected FormStringRenderer renderer;
|
||||
protected Map context;
|
||||
protected Map<String, Object> context;
|
||||
|
||||
protected HtmlFormWrapper() {}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.html;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,7 +29,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.StringUtil;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
@@ -60,7 +61,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public void appendOfbizUrl(StringBuffer buffer, String location) {
|
||||
public void appendOfbizUrl(Writer writer, String location) throws IOException {
|
||||
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
|
||||
if (ctx == null) {
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, ctx is null(0): buffer=" + buffer.toString() + " location:" + location, "");
|
||||
@@ -71,7 +72,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, session is null(1)", "");
|
||||
}
|
||||
if (ctx == null) {
|
||||
throw new RuntimeException("ctx is null. buffer=" + buffer.toString() + " location:" + location);
|
||||
throw new RuntimeException("ctx is null. location:" + location);
|
||||
}
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, ctx is NOT null(2)", "");
|
||||
}
|
||||
@@ -85,10 +86,10 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
if (s.indexOf("null") >= 0) {
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl(3), url: " + s, "");
|
||||
}
|
||||
buffer.append(s);
|
||||
writer.write(s);
|
||||
}
|
||||
|
||||
public void appendContentUrl(StringBuffer buffer, String location) {
|
||||
public void appendContentUrl(Writer writer, String location) throws IOException {
|
||||
ServletContext ctx = (ServletContext) this.request.getAttribute("servletContext");
|
||||
if (ctx == null) {
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is null(0): buffer=" + buffer.toString() + " location:" + location, "");
|
||||
@@ -99,7 +100,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, session is null(1)", "");
|
||||
}
|
||||
if (ctx == null) {
|
||||
throw new RuntimeException("ctx is null. buffer=" + buffer.toString() + " location:" + location);
|
||||
throw new RuntimeException("ctx is null. location:" + location);
|
||||
}
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is NOT null(2)", "");
|
||||
this.request.setAttribute("servletContext", ctx);
|
||||
@@ -108,28 +109,30 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
if (delegator == null) {
|
||||
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, delegator is null(6)", "");
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
ContentUrlTag.appendContentPrefix(this.request, buffer);
|
||||
buffer.append(location);
|
||||
writer.write(buffer.toString());
|
||||
writer.write(location);
|
||||
}
|
||||
|
||||
public void appendTooltip(StringBuffer buffer, Map context, ModelMenuItem modelMenuItem) {
|
||||
public void appendTooltip(Writer writer, Map<String, Object> context, ModelMenuItem modelMenuItem) throws IOException {
|
||||
// render the tooltip
|
||||
String tooltip = modelMenuItem.getTooltip(context);
|
||||
if (UtilValidate.isNotEmpty(tooltip)) {
|
||||
buffer.append("<span class=\"");
|
||||
writer.write("<span class=\"");
|
||||
String tooltipStyle = modelMenuItem.getTooltipStyle();
|
||||
if (UtilValidate.isNotEmpty(tooltipStyle)) {
|
||||
buffer.append(tooltipStyle);
|
||||
writer.write(tooltipStyle);
|
||||
} else {
|
||||
buffer.append("tooltip");
|
||||
writer.write("tooltip");
|
||||
}
|
||||
buffer.append("\"");
|
||||
buffer.append(tooltip);
|
||||
buffer.append("</span>");
|
||||
writer.write("\"");
|
||||
writer.write(tooltip);
|
||||
writer.write("</span>");
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFormatSimpleWrapperRows(StringBuffer buffer, Map context, Object menuObj) {
|
||||
public void renderFormatSimpleWrapperRows(Writer writer, Map<String, Object> context, Object menuObj) throws IOException {
|
||||
|
||||
List menuItemList = ((ModelMenu)menuObj).getMenuItemList();
|
||||
Iterator menuItemIter = menuItemList.iterator();
|
||||
@@ -137,11 +140,11 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
|
||||
while (menuItemIter.hasNext()) {
|
||||
currentMenuItem = (ModelMenuItem)menuItemIter.next();
|
||||
renderMenuItem(buffer, context, currentMenuItem);
|
||||
renderMenuItem(writer, context, currentMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderMenuItem(StringBuffer buffer, Map context, ModelMenuItem menuItem) {
|
||||
public void renderMenuItem(Writer writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException {
|
||||
|
||||
//Debug.logInfo("in renderMenuItem, menuItem:" + menuItem.getName() + " context:" + context ,"");
|
||||
boolean hideThisItem = isHideIfSelected(menuItem, context);
|
||||
@@ -162,32 +165,32 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
style = menuItem.getDisabledTitleStyle();
|
||||
}
|
||||
|
||||
buffer.append(" <li");
|
||||
writer.write(" <li");
|
||||
String alignStyle = menuItem.getAlignStyle();
|
||||
if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(alignStyle)) {
|
||||
buffer.append(" class=\"");
|
||||
writer.write(" class=\"");
|
||||
if (UtilValidate.isNotEmpty(style)) {
|
||||
buffer.append(style + " ");
|
||||
writer.write(style + " ");
|
||||
}
|
||||
if (UtilValidate.isNotEmpty(alignStyle)) {
|
||||
buffer.append(alignStyle);
|
||||
writer.write(alignStyle);
|
||||
}
|
||||
buffer.append("\"");
|
||||
writer.write("\"");
|
||||
}
|
||||
buffer.append(">");
|
||||
writer.write(">");
|
||||
|
||||
Link link = menuItem.getLink();
|
||||
//if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,"");
|
||||
if (link != null) {
|
||||
renderLink(buffer, context, link);
|
||||
renderLink(writer, context, link);
|
||||
}
|
||||
|
||||
buffer.append("</li>");
|
||||
writer.write("</li>");
|
||||
|
||||
appendWhitespace(buffer);
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public boolean isDisableIfEmpty(ModelMenuItem menuItem, Map context) {
|
||||
public boolean isDisableIfEmpty(ModelMenuItem menuItem, Map<String, Object> context) {
|
||||
|
||||
boolean disabled = false;
|
||||
String disableIfEmpty = menuItem.getDisableIfEmpty();
|
||||
@@ -206,64 +209,64 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
}
|
||||
|
||||
/*
|
||||
public String buildDivStr(ModelMenuItem menuItem, Map context) {
|
||||
public String buildDivStr(ModelMenuItem menuItem, Map<String, Object> context) {
|
||||
String divStr = "";
|
||||
divStr = menuItem.getTitle(context);
|
||||
return divStr;
|
||||
}
|
||||
*/
|
||||
public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {
|
||||
public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
|
||||
|
||||
if (!userLoginIdHasChanged) {
|
||||
userLoginIdHasChanged = userLoginIdHasChanged();
|
||||
}
|
||||
|
||||
//Debug.logInfo("in HtmlMenuRenderer, userLoginIdHasChanged:" + userLoginIdHasChanged,"");
|
||||
renderBeginningBoundaryComment(buffer, "Menu Widget", modelMenu);
|
||||
buffer.append("<div");
|
||||
renderBeginningBoundaryComment(writer, "Menu Widget", modelMenu);
|
||||
writer.write("<div");
|
||||
String menuId = modelMenu.getId();
|
||||
if (UtilValidate.isNotEmpty(menuId)) {
|
||||
buffer.append(" id=\"" + menuId + "\"");
|
||||
writer.write(" id=\"" + menuId + "\"");
|
||||
} else {
|
||||
// TODO: Remove else after UI refactor - allow both id and style
|
||||
String menuContainerStyle = modelMenu.getMenuContainerStyle(context);
|
||||
if (UtilValidate.isNotEmpty(menuContainerStyle)) {
|
||||
buffer.append(" class=\"" + menuContainerStyle + "\"");
|
||||
writer.write(" class=\"" + menuContainerStyle + "\"");
|
||||
}
|
||||
}
|
||||
String menuWidth = modelMenu.getMenuWidth();
|
||||
// TODO: Eliminate embedded styling after refactor
|
||||
if (UtilValidate.isNotEmpty(menuWidth)) {
|
||||
buffer.append(" style=\"width:" + menuWidth + ";\"");
|
||||
writer.write(" style=\"width:" + menuWidth + ";\"");
|
||||
}
|
||||
buffer.append(">");
|
||||
writer.write(">");
|
||||
String menuTitle = modelMenu.getTitle(context);
|
||||
if (UtilValidate.isNotEmpty(menuTitle)) {
|
||||
appendWhitespace(buffer);
|
||||
buffer.append(" <h2>" + menuTitle + "</h2>");
|
||||
appendWhitespace(writer);
|
||||
writer.write(" <h2>" + menuTitle + "</h2>");
|
||||
}
|
||||
appendWhitespace(buffer);
|
||||
buffer.append(" <ul>");
|
||||
appendWhitespace(writer);
|
||||
writer.write(" <ul>");
|
||||
|
||||
appendWhitespace(buffer);
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.menu.ModelMenu)
|
||||
* @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.io.Writer, java.util.Map, org.ofbiz.widget.menu.ModelMenu)
|
||||
*/
|
||||
public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {
|
||||
public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
|
||||
String fillStyle = modelMenu.getFillStyle();
|
||||
if (UtilValidate.isNotEmpty(fillStyle)) {
|
||||
buffer.append("<div class=\"" + fillStyle + "\"> </div>");
|
||||
writer.write("<div class=\"" + fillStyle + "\"> </div>");
|
||||
}
|
||||
//String menuContainerStyle = modelMenu.getMenuContainerStyle(context);
|
||||
buffer.append(" </ul>");
|
||||
appendWhitespace(buffer);
|
||||
buffer.append(" <br class=\"clear\"/>");
|
||||
appendWhitespace(buffer);
|
||||
buffer.append("</div>");
|
||||
appendWhitespace(buffer);
|
||||
renderEndingBoundaryComment(buffer, "Menu Widget", modelMenu);
|
||||
writer.write(" </ul>");
|
||||
appendWhitespace(writer);
|
||||
writer.write(" <br class=\"clear\"/>");
|
||||
appendWhitespace(writer);
|
||||
writer.write("</div>");
|
||||
appendWhitespace(writer);
|
||||
renderEndingBoundaryComment(writer, "Menu Widget", modelMenu);
|
||||
|
||||
userLoginIdHasChanged = userLoginIdHasChanged();
|
||||
GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin");
|
||||
@@ -277,12 +280,12 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
}
|
||||
}
|
||||
|
||||
public void renderFormatSimpleWrapperOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {
|
||||
//appendWhitespace(buffer);
|
||||
public void renderFormatSimpleWrapperOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
|
||||
//appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatSimpleWrapperClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {
|
||||
//appendWhitespace(buffer);
|
||||
public void renderFormatSimpleWrapperClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
|
||||
//appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void setRequest(HttpServletRequest request) {
|
||||
@@ -309,7 +312,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
return this.userLoginIdAtPermGrant;
|
||||
}
|
||||
|
||||
public boolean isHideIfSelected(ModelMenuItem menuItem, Map context) {
|
||||
public boolean isHideIfSelected(ModelMenuItem menuItem, Map<String, Object> context) {
|
||||
ModelMenu menu = menuItem.getModelMenu();
|
||||
String currentMenuItemName = menu.getSelectedMenuItemContextFieldName(context);
|
||||
String currentItemName = menuItem.getName();
|
||||
@@ -350,13 +353,13 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
}
|
||||
|
||||
|
||||
public String getTitle(ModelMenuItem menuItem, Map context) {
|
||||
public String getTitle(ModelMenuItem menuItem, Map<String, Object> context) {
|
||||
String title = null;
|
||||
title = menuItem.getTitle(context);
|
||||
return title;
|
||||
}
|
||||
|
||||
public void renderLink(StringBuffer buffer, Map context, ModelMenuItem.Link link) {
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException {
|
||||
ModelMenuItem menuItem = link.getLinkMenuItem();
|
||||
String target = link.getTarget(context);
|
||||
if (menuItem.getDisabled()) {
|
||||
@@ -364,12 +367,12 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
}
|
||||
if (UtilValidate.isNotEmpty(target)) {
|
||||
// open tag
|
||||
buffer.append("<a");
|
||||
writer.write("<a");
|
||||
String id = link.getId(context);
|
||||
if (UtilValidate.isNotEmpty(id)) {
|
||||
buffer.append(" id=\"");
|
||||
buffer.append(id);
|
||||
buffer.append("\"");
|
||||
writer.write(" id=\"");
|
||||
writer.write(id);
|
||||
writer.write("\"");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -392,24 +395,24 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
}
|
||||
|
||||
if (UtilValidate.isNotEmpty(style)) {
|
||||
buffer.append(" class=\"");
|
||||
buffer.append(style);
|
||||
buffer.append("\"");
|
||||
writer.write(" class=\"");
|
||||
writer.write(style);
|
||||
writer.write("\"");
|
||||
}
|
||||
*/
|
||||
String name = link.getName(context);
|
||||
if (UtilValidate.isNotEmpty(name)) {
|
||||
buffer.append(" name=\"");
|
||||
buffer.append(name);
|
||||
buffer.append("\"");
|
||||
writer.write(" name=\"");
|
||||
writer.write(name);
|
||||
writer.write("\"");
|
||||
}
|
||||
String targetWindow = link.getTargetWindow(context);
|
||||
if (UtilValidate.isNotEmpty(targetWindow)) {
|
||||
buffer.append(" target=\"");
|
||||
buffer.append(targetWindow);
|
||||
buffer.append("\"");
|
||||
writer.write(" target=\"");
|
||||
writer.write(targetWindow);
|
||||
writer.write("\"");
|
||||
}
|
||||
buffer.append(" href=\"");
|
||||
writer.write(" href=\"");
|
||||
String urlMode = link.getUrlMode();
|
||||
String prefix = link.getPrefix(context);
|
||||
boolean fullPath = link.getFullPath();
|
||||
@@ -422,17 +425,17 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
ServletContext ctx = (ServletContext) req.getAttribute("servletContext");
|
||||
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
|
||||
String urlString = rh.makeLink(req, res, target, fullPath, secure, encode);
|
||||
buffer.append(urlString);
|
||||
writer.write(urlString);
|
||||
} else if (prefix != null) {
|
||||
buffer.append(prefix + target);
|
||||
writer.write(prefix + target);
|
||||
} else {
|
||||
buffer.append(target);
|
||||
writer.write(target);
|
||||
}
|
||||
} else if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
|
||||
StringBuffer newURL = new StringBuffer();
|
||||
ContentUrlTag.appendContentPrefix(req, newURL);
|
||||
newURL.append(target);
|
||||
buffer.append(newURL.toString());
|
||||
writer.write(newURL.toString());
|
||||
} else if ("inter-app".equalsIgnoreCase(urlMode) && req != null) {
|
||||
String externalLoginKey = (String) req.getAttribute("externalLoginKey");
|
||||
if (UtilValidate.isNotEmpty(externalLoginKey)) {
|
||||
@@ -441,63 +444,63 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
} else {
|
||||
target += "?externalLoginKey=" + externalLoginKey;
|
||||
}
|
||||
buffer.append(target);
|
||||
writer.write(target);
|
||||
}
|
||||
} else {
|
||||
buffer.append(target);
|
||||
writer.write(target);
|
||||
}
|
||||
buffer.append("\">");
|
||||
writer.write("\">");
|
||||
}
|
||||
|
||||
// the text
|
||||
Image img = link.getImage();
|
||||
if (img == null)
|
||||
buffer.append(link.getText(context));
|
||||
writer.write(link.getText(context));
|
||||
else
|
||||
renderImage(buffer, context, img);
|
||||
renderImage(writer, context, img);
|
||||
|
||||
if (UtilValidate.isNotEmpty(target)) {
|
||||
// close tag
|
||||
buffer.append("</a>");
|
||||
writer.write("</a>");
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(StringBuffer buffer, Map context, ModelMenuItem.Image image) {
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException {
|
||||
// open tag
|
||||
buffer.append("<img ");
|
||||
writer.write("<img ");
|
||||
String id = image.getId(context);
|
||||
if (UtilValidate.isNotEmpty(id)) {
|
||||
buffer.append(" id=\"");
|
||||
buffer.append(id);
|
||||
buffer.append("\"");
|
||||
writer.write(" id=\"");
|
||||
writer.write(id);
|
||||
writer.write("\"");
|
||||
}
|
||||
String style = image.getStyle(context);
|
||||
if (UtilValidate.isNotEmpty(style)) {
|
||||
buffer.append(" class=\"");
|
||||
buffer.append(style);
|
||||
buffer.append("\"");
|
||||
writer.write(" class=\"");
|
||||
writer.write(style);
|
||||
writer.write("\"");
|
||||
}
|
||||
String wid = image.getWidth(context);
|
||||
if (UtilValidate.isNotEmpty(wid)) {
|
||||
buffer.append(" width=\"");
|
||||
buffer.append(wid);
|
||||
buffer.append("\"");
|
||||
writer.write(" width=\"");
|
||||
writer.write(wid);
|
||||
writer.write("\"");
|
||||
}
|
||||
String hgt = image.getHeight(context);
|
||||
if (UtilValidate.isNotEmpty(hgt)) {
|
||||
buffer.append(" height=\"");
|
||||
buffer.append(hgt);
|
||||
buffer.append("\"");
|
||||
writer.write(" height=\"");
|
||||
writer.write(hgt);
|
||||
writer.write("\"");
|
||||
}
|
||||
String border = image.getBorder(context);
|
||||
if (UtilValidate.isNotEmpty(border)) {
|
||||
buffer.append(" border=\"");
|
||||
buffer.append(border);
|
||||
buffer.append("\"");
|
||||
writer.write(" border=\"");
|
||||
writer.write(border);
|
||||
writer.write("\"");
|
||||
}
|
||||
String src = image.getSrc(context);
|
||||
if (UtilValidate.isNotEmpty(src)) {
|
||||
buffer.append(" src=\"");
|
||||
writer.write(" src=\"");
|
||||
String urlMode = image.getUrlMode();
|
||||
boolean fullPath = false;
|
||||
boolean secure = false;
|
||||
@@ -509,24 +512,25 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe
|
||||
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
|
||||
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
|
||||
String urlString = rh.makeLink(request, response, src, fullPath, secure, encode);
|
||||
buffer.append(urlString);
|
||||
writer.write(urlString);
|
||||
} else {
|
||||
buffer.append(src);
|
||||
writer.write(src);
|
||||
}
|
||||
} else if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
|
||||
if (request != null && response != null) {
|
||||
StringBuffer newURL = new StringBuffer();
|
||||
ContentUrlTag.appendContentPrefix(request, newURL);
|
||||
newURL.append(src);
|
||||
buffer.append(newURL.toString());
|
||||
writer.write(newURL.toString());
|
||||
}
|
||||
} else {
|
||||
buffer.append(src);
|
||||
writer.write(src);
|
||||
}
|
||||
|
||||
buffer.append("\"");
|
||||
writer.write("\"");
|
||||
}
|
||||
buffer.append("/>");
|
||||
writer.write("/>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.html;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.widget.WidgetContentWorker;
|
||||
import org.ofbiz.widget.menu.ModelMenuItem;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.widget.WidgetContentWorker;
|
||||
import org.ofbiz.widget.menu.ModelMenuItem;
|
||||
|
||||
/**
|
||||
* Widget Library - HTML Menu Renderer implementation
|
||||
@@ -43,7 +46,7 @@ public class HtmlMenuRendererImage extends HtmlMenuRenderer {
|
||||
}
|
||||
|
||||
|
||||
public String buildDivStr(ModelMenuItem menuItem, Map context) {
|
||||
public String buildDivStr(ModelMenuItem menuItem, Map<String, Object> context) throws IOException {
|
||||
|
||||
String imgStr = "<img src=\"";
|
||||
String contentId = menuItem.getAssociatedContentId(context);
|
||||
@@ -61,7 +64,7 @@ public class HtmlMenuRendererImage extends HtmlMenuRenderer {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
String medallionLogoStr = webSitePublishPoint.getString("medallionLogo");
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringWriter buf = new StringWriter();
|
||||
appendContentUrl(buf, medallionLogoStr);
|
||||
imgStr += buf.toString();
|
||||
//Debug.logInfo("in HtmlMenuRendererImage, imgStr:" + imgStr,"");
|
||||
|
||||
@@ -19,8 +19,11 @@
|
||||
package org.ofbiz.widget.html;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -30,11 +33,10 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.widget.menu.MenuFactory;
|
||||
import org.ofbiz.widget.menu.MenuStringRenderer;
|
||||
import org.ofbiz.widget.menu.ModelMenu;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
@@ -51,7 +53,7 @@ public class HtmlMenuWrapper {
|
||||
protected HttpServletResponse response;
|
||||
protected ModelMenu modelMenu;
|
||||
protected MenuStringRenderer renderer;
|
||||
protected Map context;
|
||||
protected Map<String, Object> context;
|
||||
|
||||
protected HtmlMenuWrapper() {}
|
||||
|
||||
@@ -99,15 +101,15 @@ public class HtmlMenuWrapper {
|
||||
return new HtmlMenuRenderer(request, response);
|
||||
}
|
||||
|
||||
public String renderMenuString() {
|
||||
public String renderMenuString() throws IOException {
|
||||
HttpServletRequest req = ((HtmlMenuRenderer)renderer).request;
|
||||
ServletContext ctx = (ServletContext) req.getAttribute("servletContext");
|
||||
if (ctx == null) {
|
||||
if (Debug.infoOn()) Debug.logInfo("in renderMenuString, ctx is null(0)" , "");
|
||||
}
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
modelMenu.renderMenuString(buffer, context, renderer);
|
||||
Writer writer = new StringWriter();
|
||||
modelMenu.renderMenuString(writer, context, renderer);
|
||||
|
||||
HttpServletRequest req2 = ((HtmlMenuRenderer)renderer).request;
|
||||
ServletContext ctx2 = (ServletContext) req2.getAttribute("servletContext");
|
||||
@@ -115,7 +117,7 @@ public class HtmlMenuWrapper {
|
||||
if (Debug.infoOn()) Debug.logInfo("in renderMenuString, ctx is null(2)" , "");
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,14 +67,14 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
return "hsr" + elementId;
|
||||
}
|
||||
|
||||
public void renderSectionBegin(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
|
||||
}
|
||||
public void renderSectionEnd(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
renderEndingBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
|
||||
}
|
||||
|
||||
public void renderContainerBegin(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
String containerId = container.getId(context);
|
||||
String autoUpdateTarget = container.getAutoUpdateTargetExdr(context);
|
||||
HttpServletRequest request = (HttpServletRequest) context.get("request");
|
||||
@@ -112,12 +112,12 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
writer.write(">");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
public void renderContainerEnd(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
writer.write("</div>");
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderScreenletBegin(Writer writer, Map context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletBegin(Writer writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
HttpServletRequest request = (HttpServletRequest) context.get("request");
|
||||
HttpServletResponse response = (HttpServletResponse) context.get("response");
|
||||
ModelScreenWidget.Menu tabMenu = screenlet.getTabMenu();
|
||||
@@ -201,7 +201,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderScreenletPaginateMenu(Writer writer, Map context, ModelScreenWidget.Form form) throws IOException {
|
||||
protected void renderScreenletPaginateMenu(Writer writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException {
|
||||
HttpServletResponse response = (HttpServletResponse) context.get("response");
|
||||
HttpServletRequest request = (HttpServletRequest) context.get("request");
|
||||
ModelForm modelForm = form.getModelForm(context);
|
||||
@@ -347,7 +347,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderScreenletSubWidget(Writer writer, Map context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
|
||||
public void renderScreenletSubWidget(Writer writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException {
|
||||
if (subWidget.equals(screenlet.getNavigationForm())) {
|
||||
HttpServletRequest request = (HttpServletRequest) context.get("request");
|
||||
HttpServletResponse response = (HttpServletResponse) context.get("response");
|
||||
@@ -364,7 +364,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderScreenletEnd(Writer writer, Map context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
if (screenlet.padded()) {
|
||||
writer.write("</div>");
|
||||
appendWhitespace(writer);
|
||||
@@ -377,11 +377,11 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
public ScreenletMenuRenderer(HttpServletRequest request, HttpServletResponse response) {
|
||||
super(request, response);
|
||||
}
|
||||
public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {}
|
||||
public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {}
|
||||
public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {}
|
||||
public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {}
|
||||
}
|
||||
|
||||
public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException {
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
|
||||
String labelText = label.getText(context);
|
||||
if (UtilValidate.isEmpty(labelText)) {
|
||||
// nothing to render
|
||||
@@ -418,7 +418,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException {
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException {
|
||||
// open tag
|
||||
writer.write("<a");
|
||||
String id = link.getId(context);
|
||||
@@ -504,7 +504,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException {
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException {
|
||||
// open tag
|
||||
writer.write("<img ");
|
||||
String id = image.getId(context);
|
||||
@@ -574,7 +574,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderContentBegin(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
String editRequest = content.getEditRequest(context);
|
||||
String editContainerStyle = content.getEditContainerStyle(context);
|
||||
String enableEditName = content.getEnableEditName(context);
|
||||
@@ -589,7 +589,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderContentBody(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
Locale locale = UtilMisc.ensureLocale(context.get("locale"));
|
||||
//Boolean nullThruDatesOnly = new Boolean(false);
|
||||
String mimeTypeId = "text/html";
|
||||
@@ -653,7 +653,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderContentEnd(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
|
||||
//Debug.logInfo("renderContentEnd, context:" + context, module);
|
||||
String expandedContentId = content.getContentId(context);
|
||||
@@ -687,7 +687,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
|
||||
String dataResourceId = content.getDataResourceId(context);
|
||||
// String urlString = "/content/control/ViewSimpleContent?dataResourceId=" + dataResourceId;
|
||||
@@ -712,7 +712,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
|
||||
}
|
||||
|
||||
public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
|
||||
String editRequest = content.getEditRequest(context);
|
||||
String editContainerStyle = content.getEditContainerStyle(context);
|
||||
@@ -726,7 +726,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderSubContentBody(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
Locale locale = Locale.getDefault();
|
||||
String mimeTypeId = "text/html";
|
||||
String expandedContentId = content.getContentId(context);
|
||||
@@ -774,7 +774,7 @@ public class HtmlScreenRenderer extends HtmlWidgetRenderer implements ScreenStri
|
||||
}
|
||||
}
|
||||
|
||||
public void renderSubContentEnd(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
|
||||
String editMode = "Edit";
|
||||
String editRequest = content.getEditRequest(context);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public void renderNodeBegin(Writer writer, Map context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException {
|
||||
public void renderNodeBegin(Writer writer, Map<String, Object> context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException {
|
||||
|
||||
String pathString = buildPathString(node.getModelTree(), depth);
|
||||
String currentNodeTrailPiped = null;
|
||||
@@ -159,7 +159,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
}
|
||||
}
|
||||
|
||||
public void renderNodeEnd(Writer writer, Map context, ModelTree.ModelNode node) throws IOException {
|
||||
public void renderNodeEnd(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
|
||||
Boolean processChildren = (Boolean) context.get("processChildren");
|
||||
if (processChildren.booleanValue()) {
|
||||
appendWhitespace(writer);
|
||||
@@ -175,7 +175,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
}
|
||||
}
|
||||
|
||||
public void renderLastElement(Writer writer, Map context, ModelTree.ModelNode node) throws IOException {
|
||||
public void renderLastElement(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
|
||||
Boolean processChildren = (Boolean) context.get("processChildren");
|
||||
if (processChildren.booleanValue()) {
|
||||
appendWhitespace(writer);
|
||||
@@ -183,7 +183,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
}
|
||||
}
|
||||
|
||||
public void renderLabel(Writer writer, Map context, ModelTree.ModelNode.Label label) throws IOException {
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException {
|
||||
// open tag
|
||||
writer.write("<span");
|
||||
String id = label.getId(context);
|
||||
@@ -210,7 +210,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
}
|
||||
|
||||
|
||||
public void renderLink(Writer writer, Map context, ModelTree.ModelNode.Link link) throws IOException {
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException {
|
||||
// open tag
|
||||
writer.write("<a");
|
||||
String id = link.getId(context);
|
||||
@@ -300,7 +300,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
// appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderImage(Writer writer, Map context, ModelTree.ModelNode.Image image) throws IOException {
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException {
|
||||
// open tag
|
||||
writer.write("<img ");
|
||||
String id = image.getId(context);
|
||||
@@ -368,7 +368,7 @@ public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRe
|
||||
|
||||
}
|
||||
|
||||
public ScreenStringRenderer getScreenStringRenderer(Map context) {
|
||||
public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {
|
||||
|
||||
ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
|
||||
if (screenRenderer != null) {
|
||||
|
||||
@@ -45,14 +45,6 @@ public class HtmlWidgetRenderer {
|
||||
writer.write(whiteSpace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method used to append whitespace characters to the end of each rendered element.
|
||||
* @param buffer The buffer to write to
|
||||
*/
|
||||
public void appendWhitespace(StringBuffer buffer) {
|
||||
buffer.append(whiteSpace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method used to build the boundary comment string.
|
||||
* @param boundaryType The boundary type: "Begin" or "End"
|
||||
@@ -67,18 +59,6 @@ public class HtmlWidgetRenderer {
|
||||
return "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + whiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the beginning boundary comment string.
|
||||
* @param buffer The buffer to write to
|
||||
* @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
|
||||
* @param modelWidget The widget
|
||||
*/
|
||||
public void renderBeginningBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) {
|
||||
if (modelWidget.boundaryCommentsEnabled()) {
|
||||
buffer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the beginning boundary comment string.
|
||||
* @param writer The writer to write to
|
||||
@@ -103,18 +83,6 @@ public class HtmlWidgetRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the ending boundary comment string.
|
||||
* @param buffer The buffer to write to
|
||||
* @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
|
||||
* @param modelWidget The widget
|
||||
*/
|
||||
public void renderEndingBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) {
|
||||
if (modelWidget.boundaryCommentsEnabled()) {
|
||||
buffer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName()));
|
||||
}
|
||||
}
|
||||
|
||||
/** Extracts parameters from a target URL string, prepares them for an Ajax
|
||||
* JavaScript call. This method is currently set to return a parameter string
|
||||
* suitable for the Prototype.js library.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* "License") throws IOException ; you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
@@ -18,6 +18,8 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.menu;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -25,13 +27,13 @@ import java.util.Map;
|
||||
* Widget Library - Form String Renderer interface
|
||||
*/
|
||||
public interface MenuStringRenderer {
|
||||
public void renderMenuItem(StringBuffer buffer, Map context, ModelMenuItem menuItem);
|
||||
public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu menu);
|
||||
public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu menu);
|
||||
public void renderFormatSimpleWrapperOpen(StringBuffer buffer, Map context, ModelMenu menu);
|
||||
public void renderFormatSimpleWrapperClose(StringBuffer buffer, Map context, ModelMenu menu);
|
||||
public void renderFormatSimpleWrapperRows(StringBuffer buffer, Map context, Object menu);
|
||||
public void setUserLoginIdHasChanged(boolean b);
|
||||
public void renderLink(StringBuffer buffer, Map context, ModelMenuItem.Link link);
|
||||
public void renderImage(StringBuffer buffer, Map context, ModelMenuItem.Image image);
|
||||
public void renderMenuItem(Writer writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException ;
|
||||
public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ;
|
||||
public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ;
|
||||
public void renderFormatSimpleWrapperOpen(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ;
|
||||
public void renderFormatSimpleWrapperClose(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ;
|
||||
public void renderFormatSimpleWrapperRows(Writer writer, Map<String, Object> context, Object menu) throws IOException ;
|
||||
public void setUserLoginIdHasChanged(boolean b) throws IOException ;
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException ;
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException ;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.menu;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
@@ -28,8 +30,8 @@ import org.ofbiz.base.util.BshUtil;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.base.util.UtilXml;
|
||||
import org.ofbiz.base.util.string.FlexibleStringExpander;
|
||||
import org.ofbiz.base.util.collections.FlexibleMapAccessor;
|
||||
import org.ofbiz.base.util.string.FlexibleStringExpander;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.service.LocalDispatcher;
|
||||
import org.ofbiz.widget.ModelWidget;
|
||||
@@ -279,7 +281,7 @@ public class ModelMenu extends ModelWidget {
|
||||
return existingMenuItem;
|
||||
}
|
||||
|
||||
public ModelMenuItem getModelMenuItemByContentId(String contentId, Map context) {
|
||||
public ModelMenuItem getModelMenuItemByContentId(String contentId, Map<String, Object> context) {
|
||||
|
||||
ModelMenuItem existingMenuItem = null;
|
||||
if (UtilValidate.isEmpty(contentId))
|
||||
@@ -300,7 +302,7 @@ public class ModelMenu extends ModelWidget {
|
||||
* Renders this menu to a String, i.e. in a text format, as defined with the
|
||||
* MenuStringRenderer implementation.
|
||||
*
|
||||
* @param buffer The StringBuffer that the menu text will be written to
|
||||
* @param writer The Writer that the menu text will be written to
|
||||
* @param context Map containing the menu context; the following are
|
||||
* reserved words in this context: parameters (Map), isError (Boolean),
|
||||
* itemIndex (Integer, for lists only, otherwise null), bshInterpreter,
|
||||
@@ -311,7 +313,7 @@ public class ModelMenu extends ModelWidget {
|
||||
* different menu elements; implementing you own makes it possible to
|
||||
* use the same menu definitions for many types of menu UIs
|
||||
*/
|
||||
public void renderMenuString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
|
||||
public void renderMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
|
||||
setWidgetBoundaryComments(context);
|
||||
|
||||
boolean passed = true;
|
||||
@@ -320,7 +322,7 @@ public class ModelMenu extends ModelWidget {
|
||||
if (passed) {
|
||||
ModelMenuAction.runSubActions(this.actions, context);
|
||||
if ("simple".equals(this.type)) {
|
||||
this.renderSimpleMenuString(buffer, context, menuStringRenderer);
|
||||
this.renderSimpleMenuString(writer, context, menuStringRenderer);
|
||||
} else {
|
||||
throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName());
|
||||
}
|
||||
@@ -328,30 +330,30 @@ public class ModelMenu extends ModelWidget {
|
||||
//Debug.logInfo("in ModelMenu, buffer:" + buffer.toString(), module);
|
||||
}
|
||||
|
||||
public void renderSimpleMenuString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
|
||||
public void renderSimpleMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
|
||||
//Iterator menuItemIter = null;
|
||||
//Set alreadyRendered = new TreeSet();
|
||||
|
||||
// render menu open
|
||||
menuStringRenderer.renderMenuOpen(buffer, context, this);
|
||||
menuStringRenderer.renderMenuOpen(writer, context, this);
|
||||
|
||||
// render formatting wrapper open
|
||||
menuStringRenderer.renderFormatSimpleWrapperOpen(buffer, context, this);
|
||||
menuStringRenderer.renderFormatSimpleWrapperOpen(writer, context, this);
|
||||
|
||||
//Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module);
|
||||
// render each menuItem row, except hidden & ignored rows
|
||||
//menuStringRenderer.renderFormatSimpleWrapperRows(buffer, context, this);
|
||||
//menuStringRenderer.renderFormatSimpleWrapperRows(writer, context, this);
|
||||
Iterator iter = menuItemList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModelMenuItem item = (ModelMenuItem)iter.next();
|
||||
item.renderMenuItemString(buffer, context, menuStringRenderer);
|
||||
item.renderMenuItemString(writer, context, menuStringRenderer);
|
||||
}
|
||||
|
||||
// render formatting wrapper close
|
||||
menuStringRenderer.renderFormatSimpleWrapperClose(buffer, context, this);
|
||||
menuStringRenderer.renderFormatSimpleWrapperClose(writer, context, this);
|
||||
|
||||
// render menu close
|
||||
menuStringRenderer.renderMenuClose(buffer, context, this);
|
||||
menuStringRenderer.renderMenuClose(writer, context, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +439,7 @@ public class ModelMenu extends ModelWidget {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getSelectedMenuItemContextFieldName(Map context) {
|
||||
public String getSelectedMenuItemContextFieldName(Map<String, Object> context) {
|
||||
String menuItemName = (String)this.selectedMenuItemContextFieldName.get(context);
|
||||
if (UtilValidate.isEmpty(menuItemName)) {
|
||||
return this.defaultMenuItemName;
|
||||
@@ -445,7 +447,7 @@ public class ModelMenu extends ModelWidget {
|
||||
return menuItemName;
|
||||
}
|
||||
|
||||
public String getCurrentMenuName(Map context) {
|
||||
public String getCurrentMenuName(Map<String, Object> context) {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -459,7 +461,7 @@ public class ModelMenu extends ModelWidget {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTitle(Map context) {
|
||||
public String getTitle(Map<String, Object> context) {
|
||||
return title.expandString(context);
|
||||
}
|
||||
|
||||
@@ -481,7 +483,7 @@ public class ModelMenu extends ModelWidget {
|
||||
return menuLocation + "#" + name;
|
||||
}
|
||||
|
||||
public Interpreter getBshInterpreter(Map context) throws EvalError {
|
||||
public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
|
||||
Interpreter bsh = (Interpreter) context.get("bshInterpreter");
|
||||
if (bsh == null) {
|
||||
bsh = BshUtil.makeInterpreter(context);
|
||||
@@ -599,13 +601,13 @@ public class ModelMenu extends ModelWidget {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultAssociatedContentId(Map context) {
|
||||
public String getDefaultAssociatedContentId(Map<String, Object> context) {
|
||||
return defaultAssociatedContentId.expandString(context);
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getMenuContainerStyle(Map context) {
|
||||
public String getMenuContainerStyle(Map<String, Object> context) {
|
||||
return menuContainerStyleExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -725,28 +727,4 @@ public class ModelMenu extends ModelWidget {
|
||||
return menuItemList;
|
||||
}
|
||||
|
||||
public void dump(StringBuffer buffer ) {
|
||||
buffer.append("ModelMenu:"
|
||||
+ "\n name=" + this.name
|
||||
+ "\n type=" + this.type
|
||||
+ "\n target=" + this.target
|
||||
+ "\n id=" + this.id
|
||||
+ "\n title=" + this.title
|
||||
+ "\n tooltip=" + this.tooltip
|
||||
+ "\n defaultEntityName=" + this.defaultEntityName
|
||||
+ "\n defaultTitleStyle=" + this.defaultTitleStyle
|
||||
+ "\n defaultWidgetStyle=" + this.defaultWidgetStyle
|
||||
+ "\n defaultTooltipStyle=" + this.defaultTooltipStyle
|
||||
+ "\n defaultSelectedStyle=" + this.defaultSelectedStyle
|
||||
+ "\n defaultMenuItemName=" + this.defaultMenuItemName
|
||||
+ "\n\n");
|
||||
|
||||
Iterator iter = menuItemList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModelMenuItem menuItem = (ModelMenuItem)iter.next();
|
||||
menuItem.dump(buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class ModelMenuAction {
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
|
||||
}
|
||||
|
||||
public abstract void runAction(Map context);
|
||||
public abstract void runAction(Map<String, Object> context);
|
||||
|
||||
public static List readSubActions(ModelMenuItem modelMenuItem, Element parentElement) {
|
||||
return readSubActions(modelMenuItem.getModelMenu(), parentElement);
|
||||
@@ -105,7 +105,7 @@ public abstract class ModelMenuAction {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static void runSubActions(List actions, Map context) {
|
||||
public static void runSubActions(List actions, Map<String, Object> context) {
|
||||
if (actions == null) return;
|
||||
|
||||
Iterator actionIter = actions.iterator();
|
||||
@@ -141,7 +141,7 @@ public abstract class ModelMenuAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -245,7 +245,7 @@ public abstract class ModelMenuAction {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -285,7 +285,7 @@ public abstract class ModelMenuAction {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
// default to false
|
||||
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
@@ -326,7 +326,7 @@ public abstract class ModelMenuAction {
|
||||
this.location = scriptElement.getAttribute("location");
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
if (location.endsWith(".bsh")) {
|
||||
try {
|
||||
BshUtil.runBshAtLocation(location, context);
|
||||
@@ -367,7 +367,7 @@ public abstract class ModelMenuAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(serviceNameExpanded)) {
|
||||
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
|
||||
@@ -417,7 +417,7 @@ public abstract class ModelMenuAction {
|
||||
finder = new PrimaryKeyFinder(entityOneElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelMenu.getDelegator());
|
||||
} catch (GeneralException e) {
|
||||
@@ -436,7 +436,7 @@ public abstract class ModelMenuAction {
|
||||
finder = new ByAndFinder(entityAndElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelMenu.getDelegator());
|
||||
} catch (GeneralException e) {
|
||||
@@ -455,7 +455,7 @@ public abstract class ModelMenuAction {
|
||||
finder = new ByConditionFinder(entityConditionElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelMenu.getDelegator());
|
||||
} catch (GeneralException e) {
|
||||
@@ -468,3 +468,4 @@ public abstract class ModelMenuAction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ModelMenuCondition {
|
||||
this.rootCondition = readCondition(modelMenuItem, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
if (rootCondition == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class ModelMenuCondition {
|
||||
this.modelMenuItem = modelMenuItem;
|
||||
}
|
||||
|
||||
public abstract boolean eval(Map context);
|
||||
public abstract boolean eval(Map<String, Object> context);
|
||||
}
|
||||
|
||||
public static List readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) {
|
||||
@@ -150,7 +150,7 @@ public class ModelMenuCondition {
|
||||
this.subConditions = readSubConditions(modelMenuItem, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return false for the first one in the list that is false, basic and algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -171,7 +171,7 @@ public class ModelMenuCondition {
|
||||
this.subConditions = readSubConditions(modelMenuItem, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
|
||||
boolean foundOneTrue = false;
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
@@ -198,7 +198,7 @@ public class ModelMenuCondition {
|
||||
this.subConditions = readSubConditions(modelMenuItem, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return true for the first one in the list that is true, basic or algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -220,7 +220,7 @@ public class ModelMenuCondition {
|
||||
this.subCondition = readCondition(modelMenuItem, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
return !this.subCondition.eval(context);
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class ModelMenuCondition {
|
||||
this.resExdr = new FlexibleStringExpander(condElement.getAttribute("resource-description"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if no user is logged in, treat as if the user does not have permission
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
if (userLogin != null) {
|
||||
@@ -306,7 +306,7 @@ public class ModelMenuCondition {
|
||||
this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if no user is logged in, treat as if the user does not have permission
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
if (userLogin != null) {
|
||||
@@ -342,7 +342,7 @@ public class ModelMenuCondition {
|
||||
this.classExdr = new FlexibleStringExpander(condElement.getAttribute("class"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String methodName = this.methodExdr.expandString(context);
|
||||
String className = this.classExdr.expandString(context);
|
||||
|
||||
@@ -408,7 +408,7 @@ public class ModelMenuCondition {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String value = this.valueExdr.expandString(context);
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
@@ -457,7 +457,7 @@ public class ModelMenuCondition {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
@@ -500,7 +500,7 @@ public class ModelMenuCondition {
|
||||
this.exprExdr = new FlexibleStringExpander(condElement.getAttribute("expr"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
String expr = this.exprExdr.expandString(context);
|
||||
Pattern pattern = null;
|
||||
@@ -533,7 +533,7 @@ public class ModelMenuCondition {
|
||||
this.fieldAcsr = new FlexibleMapAccessor(condElement.getAttribute("field-name"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
return ObjectType.isEmpty(fieldVal);
|
||||
}
|
||||
@@ -546,7 +546,7 @@ public class ModelMenuCondition {
|
||||
this.permissionChecker = new EntityPermissionChecker(condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
|
||||
boolean passed = permissionChecker.runPermissionCheck(context);
|
||||
return passed;
|
||||
@@ -555,3 +555,4 @@ public class ModelMenuCondition {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.ofbiz.widget.menu;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
@@ -245,7 +246,7 @@ public class ModelMenuItem {
|
||||
*/
|
||||
}
|
||||
|
||||
public void renderMenuItemString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
|
||||
public void renderMenuItemString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
|
||||
|
||||
boolean passed = true;
|
||||
if (this.condition != null) {
|
||||
@@ -256,7 +257,7 @@ public class ModelMenuItem {
|
||||
//Debug.logInfo("in ModelMenu, name:" + this.getName(), module);
|
||||
if (passed) {
|
||||
ModelMenuAction.runSubActions(this.actions, context);
|
||||
menuStringRenderer.renderMenuItem(buffer, context, this);
|
||||
menuStringRenderer.renderMenuItem(writer, context, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +318,7 @@ public class ModelMenuItem {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTitle(Map context) {
|
||||
public String getTitle(Map<String, Object> context) {
|
||||
return title.expandString(context);
|
||||
}
|
||||
|
||||
@@ -367,7 +368,7 @@ public class ModelMenuItem {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getTooltip(Map context) {
|
||||
public String getTooltip(Map<String, Object> context) {
|
||||
if (tooltip != null && !tooltip.isEmpty()) {
|
||||
return tooltip.expandString(context);
|
||||
} else {
|
||||
@@ -484,7 +485,7 @@ public class ModelMenuItem {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAssociatedContentId(Map context) {
|
||||
public String getAssociatedContentId(Map<String, Object> context) {
|
||||
String retStr = null;
|
||||
if (this.associatedContentId != null) {
|
||||
retStr = associatedContentId.expandString(context);
|
||||
@@ -553,23 +554,11 @@ public class ModelMenuItem {
|
||||
return this.hasPermission;
|
||||
}
|
||||
|
||||
public void dump(StringBuffer buffer ) {
|
||||
buffer.append("ModelMenuItem:" + "\n title=")
|
||||
.append(this.title).append("\n name=")
|
||||
.append(this.name).append("\n entityName=")
|
||||
.append(this.entityName).append("\n titleStyle=")
|
||||
.append(this.titleStyle).append("\n widgetStyle=")
|
||||
.append(this.widgetStyle).append("\n tooltipStyle=")
|
||||
.append(this.tooltipStyle).append("\n selectedStyle=")
|
||||
.append(this.selectedStyle)
|
||||
.append("\n\n");
|
||||
}
|
||||
|
||||
public Link getLink() {
|
||||
return this.link;
|
||||
}
|
||||
|
||||
public boolean isSelected(Map context) {
|
||||
public boolean isSelected(Map<String, Object> context) {
|
||||
return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context));
|
||||
}
|
||||
|
||||
@@ -610,22 +599,22 @@ public class ModelMenuItem {
|
||||
|
||||
}
|
||||
|
||||
public void renderLinkString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
|
||||
menuStringRenderer.renderLink(buffer, context, this);
|
||||
public void renderLinkString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
|
||||
menuStringRenderer.renderLink(writer, context, this);
|
||||
}
|
||||
|
||||
public String getText(Map context) {
|
||||
public String getText(Map<String, Object> context) {
|
||||
String txt = this.textExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(txt))
|
||||
txt = linkMenuItem.getTitle(context);
|
||||
return txt;
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
String style = this.styleExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(style)) {
|
||||
style = this.linkMenuItem.getWidgetStyle();
|
||||
@@ -633,15 +622,15 @@ public class ModelMenuItem {
|
||||
return style;
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTarget(Map context) {
|
||||
public String getTarget(Map<String, Object> context) {
|
||||
return this.targetExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
return this.targetWindowExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -649,7 +638,7 @@ public class ModelMenuItem {
|
||||
return this.urlMode;
|
||||
}
|
||||
|
||||
public String getPrefix(Map context) {
|
||||
public String getPrefix(Map<String, Object> context) {
|
||||
return this.prefixExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -759,31 +748,31 @@ public class ModelMenuItem {
|
||||
|
||||
}
|
||||
|
||||
public void renderImageString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
|
||||
menuStringRenderer.renderImage(buffer, context, this);
|
||||
public void renderImageString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
|
||||
menuStringRenderer.renderImage(writer, context, this);
|
||||
}
|
||||
|
||||
public String getSrc(Map context) {
|
||||
public String getSrc(Map<String, Object> context) {
|
||||
return this.srcExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getWidth(Map context) {
|
||||
public String getWidth(Map<String, Object> context) {
|
||||
return this.widthExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getHeight(Map context) {
|
||||
public String getHeight(Map<String, Object> context) {
|
||||
return this.heightExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getBorder(Map context) {
|
||||
public String getBorder(Map<String, Object> context) {
|
||||
return this.borderExdr.expandString(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,14 +63,14 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
for (ModelScreenWidget subWidget : subWidgets) {
|
||||
subWidget.renderWidgetString(writer, context, screenStringRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
public String rawString() {
|
||||
StringBuffer buffer = new StringBuffer("<html-widget>");
|
||||
StringBuilder buffer = new StringBuilder("<html-widget>");
|
||||
for (ModelScreenWidget subWidget : subWidgets) {
|
||||
buffer.append(subWidget.rawString());
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public static void renderHtmlTemplate(Writer writer, FlexibleStringExpander locationExdr, Map context) {
|
||||
public static void renderHtmlTemplate(Writer writer, FlexibleStringExpander locationExdr, Map<String, Object> context) {
|
||||
String location = locationExdr.expandString(context);
|
||||
//Debug.logInfo("Rendering template at location [" + location + "] with context: \n" + context, module);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
this.locationExdr = new FlexibleStringExpander(htmlTemplateElement.getAttribute("location"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
renderHtmlTemplate(writer, this.locationExdr, context);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
// isolate the scope
|
||||
if (!(context instanceof MapStack)) {
|
||||
context = MapStack.create(context);
|
||||
@@ -199,7 +199,7 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
this.subWidgets = ModelScreenWidget.readSubWidgets(this.modelScreen, subElementList);
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
// render sub-widgets
|
||||
renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
|
||||
boolean isEntrySet = false;
|
||||
if (!(context instanceof MapStack)) {
|
||||
@@ -162,7 +162,7 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
/*
|
||||
* @return
|
||||
*/
|
||||
public String getPaginateTarget(Map context) {
|
||||
public String getPaginateTarget(Map<String, Object> context) {
|
||||
return this.paginateTarget.expandString(context);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
return actualPageSize;
|
||||
}
|
||||
|
||||
public void getListLimits(Map context, List items) {
|
||||
public void getListLimits(Map<String, Object> context, List items) {
|
||||
listSize = items.size();
|
||||
|
||||
if (paginate) {
|
||||
@@ -265,7 +265,7 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
}
|
||||
|
||||
|
||||
public void renderNextPrev(Writer writer, Map context) throws IOException {
|
||||
public void renderNextPrev(Writer writer, Map<String, Object> context) throws IOException {
|
||||
String targetService = this.getPaginateTarget(context);
|
||||
if (targetService == null) {
|
||||
targetService = "${targetService}";
|
||||
@@ -372,3 +372,4 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ public class ModelScreen extends ModelWidget implements Serializable {
|
||||
* different screen elements; implementing your own makes it possible to
|
||||
* use the same screen definitions for many types of screen UIs
|
||||
*/
|
||||
public void renderScreenString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws ScreenRenderException {
|
||||
public void renderScreenString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws ScreenRenderException {
|
||||
// make sure the "null" object is in there for entity ops
|
||||
context.put("null", GenericEntity.NULL_FIELD);
|
||||
|
||||
@@ -435,14 +435,15 @@ public class ModelScreen extends ModelWidget implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public LocalDispatcher getDispatcher(Map context) {
|
||||
public LocalDispatcher getDispatcher(Map<String, Object> context) {
|
||||
LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher");
|
||||
return dispatcher;
|
||||
}
|
||||
|
||||
public GenericDelegator getDelegator(Map context) {
|
||||
public GenericDelegator getDelegator(Map<String, Object> context) {
|
||||
GenericDelegator delegator = (GenericDelegator) context.get("delegator");
|
||||
return delegator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
|
||||
}
|
||||
|
||||
public abstract void runAction(Map context) throws GeneralException;
|
||||
public abstract void runAction(Map<String, Object> context) throws GeneralException;
|
||||
|
||||
public static List readSubActions(ModelScreen modelScreen, Element parentElement) {
|
||||
List actions = FastList.newInstance();
|
||||
@@ -112,7 +112,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static void runSubActions(List actions, Map context) throws GeneralException {
|
||||
public static void runSubActions(List actions, Map<String, Object> context) throws GeneralException {
|
||||
if (actions == null) return;
|
||||
|
||||
Iterator actionIter = actions.iterator();
|
||||
@@ -148,7 +148,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -248,7 +248,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public Object getInMemoryPersistedFromField(Object storeAgent, Map context) {
|
||||
public Object getInMemoryPersistedFromField(Object storeAgent, Map<String, Object> context) {
|
||||
Object newValue = null;
|
||||
String originalName = this.fromField.getOriginalName();
|
||||
List currentWidgetTrail = (List)context.get("_WIDGETTRAIL_");
|
||||
@@ -290,7 +290,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -343,7 +343,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
//String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
//boolean global = "true".equals(globalStr);
|
||||
@@ -386,7 +386,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.location = scriptElement.getAttribute("location");
|
||||
}
|
||||
|
||||
public void runAction(Map context) throws GeneralException {
|
||||
public void runAction(Map<String, Object> context) throws GeneralException {
|
||||
if (location.endsWith(".bsh")) {
|
||||
try {
|
||||
BshUtil.runBshAtLocation(location, context);
|
||||
@@ -432,7 +432,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(serviceNameExpanded)) {
|
||||
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
|
||||
@@ -501,7 +501,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
finder = new PrimaryKeyFinder(entityOneElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelScreen.getDelegator(context));
|
||||
} catch (GeneralException e) {
|
||||
@@ -520,7 +520,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
finder = new ByAndFinder(entityAndElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelScreen.getDelegator(context));
|
||||
} catch (GeneralException e) {
|
||||
@@ -539,7 +539,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
finder = new ByConditionFinder(entityConditionElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelScreen.getDelegator(context));
|
||||
} catch (GeneralException e) {
|
||||
@@ -564,7 +564,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.useCache = "true".equals(getRelatedOneElement.getAttribute("use-cache"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
Object valueObject = valueNameAcsr.get(context);
|
||||
if (valueObject == null) {
|
||||
Debug.logVerbose("Value not found with name: " + valueNameAcsr + ", not getting related...", module);
|
||||
@@ -609,7 +609,7 @@ public abstract class ModelScreenAction implements Serializable {
|
||||
this.useCache = "true".equals(getRelatedElement.getAttribute("use-cache"));
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
Object valueObject = valueNameAcsr.get(context);
|
||||
if (valueObject == null) {
|
||||
Debug.logVerbose("Value not found with name: " + valueNameAcsr + ", not getting related...", module);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.rootCondition = readCondition(modelScreen, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
if (rootCondition == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.modelScreen = modelScreen;
|
||||
}
|
||||
|
||||
public abstract boolean eval(Map context);
|
||||
public abstract boolean eval(Map<String, Object> context);
|
||||
}
|
||||
|
||||
public static List readSubConditions(ModelScreen modelScreen, Element conditionElement) {
|
||||
@@ -129,7 +129,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.subConditions = readSubConditions(modelScreen, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return false for the first one in the list that is false, basic and algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -150,7 +150,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.subConditions = readSubConditions(modelScreen, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
|
||||
boolean foundOneTrue = false;
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
@@ -177,7 +177,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.subConditions = readSubConditions(modelScreen, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return true for the first one in the list that is true, basic or algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -199,7 +199,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.subCondition = readCondition(modelScreen, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
return !this.subCondition.eval(context);
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.resExdr = new FlexibleStringExpander(condElement.getAttribute("resource-description"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if no user is logged in, treat as if the user does not have permission
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
if (userLogin != null) {
|
||||
@@ -300,7 +300,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if no user is logged in, treat as if the user does not have permission
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
if (userLogin != null) {
|
||||
@@ -336,7 +336,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.classExdr = new FlexibleStringExpander(condElement.getAttribute("class"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String methodName = this.methodExdr.expandString(context);
|
||||
String className = this.classExdr.expandString(context);
|
||||
|
||||
@@ -402,7 +402,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String value = this.valueExdr.expandString(context);
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
@@ -451,7 +451,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
@@ -494,7 +494,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.exprExdr = new FlexibleStringExpander(condElement.getAttribute("expr"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
String expr = this.exprExdr.expandString(context);
|
||||
Pattern pattern;
|
||||
@@ -527,7 +527,7 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.fieldAcsr = new FlexibleMapAccessor(condElement.getAttribute("field-name"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
return ObjectType.isEmpty(fieldVal);
|
||||
}
|
||||
@@ -540,10 +540,11 @@ public class ModelScreenCondition implements Serializable {
|
||||
this.permissionChecker = new EntityPermissionChecker(condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
return permissionChecker.runPermissionCheck(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -37,11 +36,14 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.base.util.UtilXml;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.collections.MapStack;
|
||||
import org.ofbiz.base.util.string.FlexibleStringExpander;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.widget.ModelWidget;
|
||||
import org.ofbiz.widget.fo.FoScreenRenderer;
|
||||
import org.ofbiz.widget.form.FormFactory;
|
||||
@@ -57,9 +59,6 @@ import org.ofbiz.widget.tree.ModelTree;
|
||||
import org.ofbiz.widget.tree.TreeFactory;
|
||||
import org.ofbiz.widget.tree.TreeStringRenderer;
|
||||
import org.ofbiz.widget.xml.XmlFormRenderer;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@@ -77,7 +76,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen sub-widget with name: " + widgetElement.getNodeName(), module);
|
||||
}
|
||||
|
||||
public abstract void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException;
|
||||
public abstract void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException;
|
||||
|
||||
public abstract String rawString();
|
||||
|
||||
@@ -127,7 +126,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
return subWidgets;
|
||||
}
|
||||
|
||||
public static void renderSubWidgetsString(List subWidgets, Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public static void renderSubWidgetsString(List subWidgets, Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
if (subWidgets == null) {
|
||||
return;
|
||||
}
|
||||
@@ -148,10 +147,10 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
public static class SectionsRenderer {
|
||||
protected Map sectionMap;
|
||||
protected ScreenStringRenderer screenStringRenderer;
|
||||
protected Map context;
|
||||
protected Map<String, Object> context;
|
||||
protected Writer writer;
|
||||
|
||||
public SectionsRenderer(Map sectionMap, Map context, Writer writer, ScreenStringRenderer screenStringRenderer) {
|
||||
public SectionsRenderer(Map sectionMap, Map<String, Object> context, Writer writer, ScreenStringRenderer screenStringRenderer) {
|
||||
this.sectionMap = sectionMap;
|
||||
this.context = context;
|
||||
this.writer = writer;
|
||||
@@ -159,7 +158,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
|
||||
/** This is a lot like the ScreenRenderer class and returns an empty String so it can be used more easily with FreeMarker */
|
||||
public String render(String sectionName) throws GeneralException {
|
||||
public String render(String sectionName) throws GeneralException, IOException {
|
||||
ModelScreenWidget section = (ModelScreenWidget) this.sectionMap.get(sectionName);
|
||||
// if no section by that name, write nothing
|
||||
if (section != null) {
|
||||
@@ -204,7 +203,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
// check the condition, if there is one
|
||||
boolean condTrue = true;
|
||||
if (this.condition != null) {
|
||||
@@ -283,7 +282,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.subWidgets = ModelScreenWidget.readSubWidgets(this.modelScreen, subElementList);
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
try {
|
||||
screenStringRenderer.renderContainerBegin(writer, context, this);
|
||||
|
||||
@@ -298,15 +297,15 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getAutoUpdateTargetExdr(Map context) {
|
||||
public String getAutoUpdateTargetExdr(Map<String, Object> context) {
|
||||
return this.autoUpdateTargetExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -377,7 +376,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
boolean collapsed = initiallyCollapsed;
|
||||
if (this.collapsible) {
|
||||
String preferenceKey = getPreferenceKey(context) + "_collapsed";
|
||||
@@ -416,7 +415,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
return this.padded;
|
||||
}
|
||||
|
||||
public String getPreferenceKey(Map context) {
|
||||
public String getPreferenceKey(Map<String, Object> context) {
|
||||
String name = this.modelScreen.getName();
|
||||
if (UtilValidate.isEmpty(name)) {
|
||||
name = this.idExdr.expandString(context);
|
||||
@@ -461,7 +460,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.shareScopeExdr = new FlexibleStringExpander(includeScreenElement.getAttribute("share-scope"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
// if we are not sharing the scope, protect it using the MapStack
|
||||
boolean protectScope = !shareScope(context);
|
||||
if (protectScope) {
|
||||
@@ -528,15 +527,15 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getLocation(Map context) {
|
||||
public String getLocation(Map<String, Object> context) {
|
||||
return this.locationExdr.expandString(context);
|
||||
}
|
||||
|
||||
public boolean shareScope(Map context) {
|
||||
public boolean shareScope(Map<String, Object> context) {
|
||||
String shareScopeString = this.shareScopeExdr.expandString(context);
|
||||
// defaults to false, so anything but true is false
|
||||
return "true".equals(shareScopeString);
|
||||
@@ -566,7 +565,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
// isolate the scope
|
||||
if (!(context instanceof MapStack)) {
|
||||
context = MapStack.create(context);
|
||||
@@ -621,11 +620,11 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
contextMs.pop();
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getLocation(Map context) {
|
||||
public String getLocation(Map<String, Object> context) {
|
||||
return this.locationExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -644,7 +643,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.subWidgets = ModelScreenWidget.readSubWidgets(this.modelScreen, subElementList);
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
// render sub-widgets
|
||||
renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer);
|
||||
}
|
||||
@@ -660,7 +659,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
super(modelScreen, decoratorSectionElement);
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
Map preRenderedContent = (Map) context.get("preRenderedContent");
|
||||
if (preRenderedContent != null && preRenderedContent.containsKey(this.name)) {
|
||||
try {
|
||||
@@ -704,7 +703,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.styleExdr = new FlexibleStringExpander(labelElement.getAttribute("style"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
try {
|
||||
screenStringRenderer.renderLabel(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -714,15 +713,15 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(Map context) {
|
||||
public String getText(Map<String, Object> context) {
|
||||
return this.textExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -745,7 +744,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.shareScopeExdr = new FlexibleStringExpander(formElement.getAttribute("share-scope"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
boolean protectScope = !shareScope(context);
|
||||
if (protectScope) {
|
||||
if (!(context instanceof MapStack)) {
|
||||
@@ -784,7 +783,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public ModelForm getModelForm(Map context) {
|
||||
public ModelForm getModelForm(Map<String, Object> context) {
|
||||
ModelForm modelForm = null;
|
||||
String name = this.getName(context);
|
||||
String location = this.getLocation(context);
|
||||
@@ -798,15 +797,15 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
return modelForm;
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getLocation(Map context) {
|
||||
public String getLocation(Map<String, Object> context) {
|
||||
return this.locationExdr.expandString(context);
|
||||
}
|
||||
|
||||
public boolean shareScope(Map context) {
|
||||
public boolean shareScope(Map<String, Object> context) {
|
||||
String shareScopeString = this.shareScopeExdr.expandString(context);
|
||||
// defaults to false, so anything but true is false
|
||||
return "true".equals(shareScopeString);
|
||||
@@ -830,7 +829,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.shareScopeExdr = new FlexibleStringExpander(treeElement.getAttribute("share-scope"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
boolean protectScope = !shareScope(context);
|
||||
if (protectScope) {
|
||||
if (!(context instanceof MapStack)) {
|
||||
@@ -891,15 +890,15 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getLocation(Map context) {
|
||||
public String getLocation(Map<String, Object> context) {
|
||||
return this.locationExdr.expandString(context);
|
||||
}
|
||||
|
||||
public boolean shareScope(Map context) {
|
||||
public boolean shareScope(Map<String, Object> context) {
|
||||
String shareScopeString = this.shareScopeExdr.expandString(context);
|
||||
// defaults to false, so anything but true is false
|
||||
return "true".equals(shareScopeString);
|
||||
@@ -934,7 +933,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
|
||||
ModelScreenWidget subWidget = null;
|
||||
if (screenStringRenderer instanceof FoScreenRenderer) {
|
||||
subWidget = (ModelScreenWidget)subWidgets.get("xsl-fo");
|
||||
@@ -995,7 +994,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.border = subContentElement.getAttribute("border");
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
try {
|
||||
// pushing the contentId on the context as "contentId" is done
|
||||
// because many times there will be embedded "subcontent" elements
|
||||
@@ -1064,23 +1063,23 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
|
||||
}
|
||||
|
||||
public String getContentId(Map context) {
|
||||
public String getContentId(Map<String, Object> context) {
|
||||
return this.contentId.expandString(context);
|
||||
}
|
||||
|
||||
public String getDataResourceId(Map context) {
|
||||
public String getDataResourceId(Map<String, Object> context) {
|
||||
return this.dataResourceId.expandString(context);
|
||||
}
|
||||
|
||||
public String getEditRequest(Map context) {
|
||||
public String getEditRequest(Map<String, Object> context) {
|
||||
return this.editRequest.expandString(context);
|
||||
}
|
||||
|
||||
public String getEditContainerStyle(Map context) {
|
||||
public String getEditContainerStyle(Map<String, Object> context) {
|
||||
return this.editContainerStyle.expandString(context);
|
||||
}
|
||||
|
||||
public String getEnableEditName(Map context) {
|
||||
public String getEnableEditName(Map<String, Object> context) {
|
||||
return this.enableEditName.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1129,7 +1128,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.xmlEscape = "true".equals(subContentElement.getAttribute("xml-escape"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
try {
|
||||
screenStringRenderer.renderSubContentBegin(writer, context, this);
|
||||
screenStringRenderer.renderSubContentBody(writer, context, this);
|
||||
@@ -1141,23 +1140,23 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentId(Map context) {
|
||||
public String getContentId(Map<String, Object> context) {
|
||||
return this.contentId.expandString(context);
|
||||
}
|
||||
|
||||
public String getMapKey(Map context) {
|
||||
public String getMapKey(Map<String, Object> context) {
|
||||
return this.mapKey.expandString(context);
|
||||
}
|
||||
|
||||
public String getEditRequest(Map context) {
|
||||
public String getEditRequest(Map<String, Object> context) {
|
||||
return this.editRequest.expandString(context);
|
||||
}
|
||||
|
||||
public String getEditContainerStyle(Map context) {
|
||||
public String getEditContainerStyle(Map<String, Object> context) {
|
||||
return this.editContainerStyle.expandString(context);
|
||||
}
|
||||
|
||||
public String getEnableEditName(Map context) {
|
||||
public String getEnableEditName(Map<String, Object> context) {
|
||||
return this.enableEditName.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1182,7 +1181,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
this.locationExdr = new FlexibleStringExpander(menuElement.getAttribute("location"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws IOException {
|
||||
// try finding the menuStringRenderer by name in the context in case one was prepared and put there
|
||||
MenuStringRenderer menuStringRenderer = (MenuStringRenderer) context.get("menuStringRenderer");
|
||||
// if there was no menuStringRenderer put in place, now try finding the request/response in the context and creating a new one
|
||||
@@ -1206,19 +1205,11 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer renderBuffer = new StringBuffer();
|
||||
ModelMenu modelMenu = getModelMenu(context);
|
||||
modelMenu.renderMenuString(renderBuffer, context, menuStringRenderer);
|
||||
try {
|
||||
writer.write(renderBuffer.toString());
|
||||
} catch (IOException e) {
|
||||
String errMsg = "Error rendering included menu named [" + name + "] at location [" + this.getLocation(context) + "]: " + e.toString();
|
||||
Debug.logError(e, errMsg, module);
|
||||
throw new RuntimeException(errMsg);
|
||||
}
|
||||
modelMenu.renderMenuString(writer, context, menuStringRenderer);
|
||||
}
|
||||
|
||||
public ModelMenu getModelMenu(Map context) {
|
||||
public ModelMenu getModelMenu(Map<String, Object> context) {
|
||||
String name = this.getName(context);
|
||||
String location = this.getLocation(context);
|
||||
ModelMenu modelMenu = null;
|
||||
@@ -1232,11 +1223,11 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
return modelMenu;
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getLocation(Map context) {
|
||||
public String getLocation(Map<String, Object> context) {
|
||||
return this.locationExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1281,7 +1272,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
try {
|
||||
screenStringRenderer.renderLink(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -1291,27 +1282,27 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(Map context) {
|
||||
public String getText(Map<String, Object> context) {
|
||||
return this.textExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTarget(Map context) {
|
||||
public String getTarget(Map<String, Object> context) {
|
||||
return this.targetExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
return this.targetWindowExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1319,7 +1310,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
return this.urlMode;
|
||||
}
|
||||
|
||||
public String getPrefix(Map context) {
|
||||
public String getPrefix(Map<String, Object> context) {
|
||||
return this.prefixExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1419,7 +1410,7 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
setUrlMode(UtilFormatOut.checkEmpty(imageElement.getAttribute("url-mode"), "content"));
|
||||
}
|
||||
|
||||
public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
|
||||
public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
|
||||
try {
|
||||
screenStringRenderer.renderImage(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -1429,27 +1420,27 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
}
|
||||
}
|
||||
|
||||
public String getSrc(Map context) {
|
||||
public String getSrc(Map<String, Object> context) {
|
||||
return this.srcExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getWidth(Map context) {
|
||||
public String getWidth(Map<String, Object> context) {
|
||||
return this.widthExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getHeight(Map context) {
|
||||
public String getHeight(Map<String, Object> context) {
|
||||
return this.heightExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getBorder(Map context) {
|
||||
public String getBorder(Map<String, Object> context) {
|
||||
return this.borderExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1501,3 +1492,4 @@ public abstract class ModelScreenWidget extends ModelWidget implements Serializa
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,27 +25,28 @@ import java.util.Map;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
|
||||
/**
|
||||
* Widget Library - Screen String Renderer interface
|
||||
* Widget Library - Screen String Renderer interface.
|
||||
*/
|
||||
public interface ScreenStringRenderer {
|
||||
public void renderSectionBegin(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException;
|
||||
public void renderSectionEnd(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException;
|
||||
public void renderContainerBegin(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException;
|
||||
public void renderContainerEnd(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException;
|
||||
public void renderContentBegin(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderContentBody(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderContentEnd(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
public void renderSubContentBody(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
public void renderSubContentEnd(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException;
|
||||
public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException;
|
||||
public void renderContainerBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException;
|
||||
public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException;
|
||||
public void renderContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException;
|
||||
|
||||
public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException;
|
||||
public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException;
|
||||
public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException;
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException;
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException;
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException;
|
||||
|
||||
public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderScreenletBegin(Writer writer, Map context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException;
|
||||
public void renderScreenletSubWidget(Writer writer, Map context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException;
|
||||
public void renderScreenletEnd(Writer writer, Map context, ModelScreenWidget.Screenlet screenlet) throws IOException;
|
||||
public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException;
|
||||
public void renderScreenletBegin(Writer writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException;
|
||||
public void renderScreenletSubWidget(Writer writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException;
|
||||
public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.text;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -67,43 +70,43 @@ public class TextFormRenderer implements FormStringRenderer {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public void appendWhitespace(StringBuffer buffer) {
|
||||
public void appendWhitespace(Writer writer) throws IOException {
|
||||
// appending line ends for now, but this could be replaced with a simple space or something
|
||||
buffer.append("\r\n");
|
||||
//buffer.append(' ');
|
||||
writer.write("\r\n");
|
||||
//writer.write(' ');
|
||||
}
|
||||
|
||||
private void makeTextString(StringBuffer buffer, String widgetStyle, String text) {
|
||||
private void makeTextString(Writer writer, String widgetStyle, String text) throws IOException {
|
||||
// TODO: escape characters here
|
||||
buffer.append(text);
|
||||
writer.write(text);
|
||||
}
|
||||
|
||||
public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) {
|
||||
public void renderDisplayField(Writer writer, Map<String, Object> context, DisplayField displayField) throws IOException {
|
||||
ModelFormField modelFormField = displayField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
}
|
||||
|
||||
public void renderHyperlinkField(StringBuffer buffer, Map context, HyperlinkField hyperlinkField) {
|
||||
public void renderHyperlinkField(Writer writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException {
|
||||
ModelFormField modelFormField = hyperlinkField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
}
|
||||
|
||||
public void renderTextField(StringBuffer buffer, Map context, TextField textField) {
|
||||
public void renderTextField(Writer writer, Map<String, Object> context, TextField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderTextareaField(StringBuffer buffer, Map context, TextareaField textareaField) {
|
||||
public void renderTextareaField(Writer writer, Map<String, Object> context, TextareaField textareaField) throws IOException {
|
||||
ModelFormField modelFormField = textareaField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderDateTimeField(StringBuffer buffer, Map context, DateTimeField dateTimeField) {
|
||||
public void renderDateTimeField(Writer writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException {
|
||||
ModelFormField modelFormField = dateTimeField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderDropDownField(StringBuffer buffer, Map context, DropDownField dropDownField) {
|
||||
public void renderDropDownField(Writer writer, Map<String, Object> context, DropDownField dropDownField) throws IOException {
|
||||
ModelFormField modelFormField = dropDownField.getModelFormField();
|
||||
ModelForm modelForm = modelFormField.getModelForm();
|
||||
String currentValue = modelFormField.getEntry(context);
|
||||
@@ -112,9 +115,9 @@ public class TextFormRenderer implements FormStringRenderer {
|
||||
if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) {
|
||||
String explicitDescription = dropDownField.getCurrentDescription(context);
|
||||
if (UtilValidate.isNotEmpty(explicitDescription)) {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
} else {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
}
|
||||
} else {
|
||||
Iterator optionValueIter = allOptionValues.iterator();
|
||||
@@ -123,176 +126,176 @@ public class TextFormRenderer implements FormStringRenderer {
|
||||
String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context);
|
||||
if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) ||
|
||||
(UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderCheckField(StringBuffer buffer, Map context, CheckField checkField) {
|
||||
public void renderCheckField(Writer writer, Map<String, Object> context, CheckField checkField) {
|
||||
}
|
||||
|
||||
public void renderRadioField(StringBuffer buffer, Map context, RadioField radioField) {
|
||||
public void renderRadioField(Writer writer, Map<String, Object> context, RadioField radioField) {
|
||||
}
|
||||
|
||||
public void renderSubmitField(StringBuffer buffer, Map context, SubmitField submitField) {
|
||||
public void renderSubmitField(Writer writer, Map<String, Object> context, SubmitField submitField) {
|
||||
}
|
||||
|
||||
public void renderResetField(StringBuffer buffer, Map context, ResetField resetField) {
|
||||
public void renderResetField(Writer writer, Map<String, Object> context, ResetField resetField) {
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, HiddenField hiddenField) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, HiddenField hiddenField) {
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField modelFormField, String value) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String value) {
|
||||
}
|
||||
|
||||
public void renderIgnoredField(StringBuffer buffer, Map context, IgnoredField ignoredField) {
|
||||
public void renderIgnoredField(Writer writer, Map<String, Object> context, IgnoredField ignoredField) {
|
||||
}
|
||||
|
||||
public void renderFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getTitle(context));
|
||||
public void renderFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getTitle(context));
|
||||
}
|
||||
|
||||
public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
renderFieldTitle(buffer, context, modelFormField);
|
||||
public void renderSingleFormFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
renderFieldTitle(writer, context, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderMultiFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderMultiFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatListWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatListWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatHeaderRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
public void renderFormatHeaderRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
public void renderFormatHeaderRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) {
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatItemRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatItemRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
public void renderFormatItemRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
public void renderFormatItemRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatItemRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatItemRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatSingleWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatSingleWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatFieldRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatFieldRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowTitleCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowTitleCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowTitleCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowSpacerCell(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowSpacerCell(Writer writer, Map<String, Object> context, ModelFormField modelFormField) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
public void renderFormatFieldRowWidgetCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
public void renderFormatFieldRowWidgetCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
}
|
||||
|
||||
public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatEmptySpace(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderTextFindField(StringBuffer buffer, Map context, TextFindField textFindField) {
|
||||
public void renderTextFindField(Writer writer, Map<String, Object> context, TextFindField textFindField) throws IOException {
|
||||
ModelFormField modelFormField = textFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderRangeFindField(StringBuffer buffer, Map context, RangeFindField rangeFindField) {
|
||||
public void renderRangeFindField(Writer writer, Map<String, Object> context, RangeFindField rangeFindField) throws IOException {
|
||||
ModelFormField modelFormField = rangeFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderDateFindField(StringBuffer buffer, Map context, DateFindField dateFindField) {
|
||||
public void renderDateFindField(Writer writer, Map<String, Object> context, DateFindField dateFindField) throws IOException {
|
||||
ModelFormField modelFormField = dateFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderLookupField(StringBuffer buffer, Map context, LookupField lookupField) {
|
||||
public void renderLookupField(Writer writer, Map<String, Object> context, LookupField lookupField) throws IOException {
|
||||
ModelFormField modelFormField = lookupField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderNextPrev(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderNextPrev(Writer writer, Map<String, Object> context, ModelForm modelForm) {
|
||||
}
|
||||
|
||||
public void renderFileField(StringBuffer buffer, Map context, FileField textField) {
|
||||
public void renderFileField(Writer writer, Map<String, Object> context, FileField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
}
|
||||
|
||||
public void renderPasswordField(StringBuffer buffer, Map context, PasswordField passwordField) {
|
||||
public void renderPasswordField(Writer writer, Map<String, Object> context, PasswordField passwordField) {
|
||||
}
|
||||
|
||||
public void renderImageField(StringBuffer buffer, Map context, ImageField imageField) {
|
||||
public void renderImageField(Writer writer, Map<String, Object> context, ImageField imageField) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderFieldGroupOpen(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupOpen(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderFieldGroupClose(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupClose(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderBanner(StringBuffer buffer, Map context, ModelForm.Banner banner) {
|
||||
public void renderBanner(Writer writer, Map<String, Object> context, ModelForm.Banner banner) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderHyperlinkTitle(StringBuffer buffer, Map context, ModelFormField modelFormField, String titleText) {
|
||||
public void renderHyperlinkTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,20 +53,20 @@ public class TextScreenRenderer implements ScreenStringRenderer {
|
||||
|
||||
public TextScreenRenderer() {}
|
||||
|
||||
public void renderSectionBegin(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
// do nothing, this is just a place holder container for HTML
|
||||
}
|
||||
public void renderSectionEnd(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
|
||||
public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
|
||||
// do nothing, this is just a place holder container for HTML
|
||||
}
|
||||
|
||||
public void renderContainerBegin(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
}
|
||||
public void renderContainerEnd(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
|
||||
public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException {
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
|
||||
String labelText = label.getText(context);
|
||||
if (UtilValidate.isEmpty(labelText)) {
|
||||
// nothing to render
|
||||
@@ -76,39 +76,39 @@ public class TextScreenRenderer implements ScreenStringRenderer {
|
||||
appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException {
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException {
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentBegin(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentBody(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentEnd(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
|
||||
public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentBody(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
public void renderSubContentEnd(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ public class TextScreenRenderer implements ScreenStringRenderer {
|
||||
// appending line ends for now, but this could be replaced with a simple space or something
|
||||
writer.write("\r\n");
|
||||
}
|
||||
public void renderScreenletBegin(Writer writer, Map context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletBegin(Writer writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
public void renderScreenletSubWidget(Writer writer, Map context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
|
||||
public void renderScreenletSubWidget(Writer writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
public void renderScreenletEnd(Writer writer, Map context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException {
|
||||
// TODO: not implemented
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class ModelTree extends ModelWidget {
|
||||
return rootNodeName;
|
||||
}
|
||||
|
||||
public String getWrapStyle(Map context) {
|
||||
public String getWrapStyle(Map<String, Object> context) {
|
||||
return this.defaultWrapStyleExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ModelTree extends ModelWidget {
|
||||
nodeIndices[i] = val;
|
||||
}
|
||||
|
||||
public String getExpandCollapseRequest(Map context) {
|
||||
public String getExpandCollapseRequest(Map<String, Object> context) {
|
||||
String expColReq = this.expandCollapseRequestExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(expColReq)) {
|
||||
HttpServletRequest request = (HttpServletRequest)context.get("request");
|
||||
@@ -193,7 +193,7 @@ public class ModelTree extends ModelWidget {
|
||||
return expColReq;
|
||||
}
|
||||
|
||||
public String getTrailName(Map context) {
|
||||
public String getTrailName(Map<String, Object> context) {
|
||||
return this.trailNameExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class ModelTree extends ModelWidget {
|
||||
* different tree elements; implementing your own makes it possible to
|
||||
* use the same tree definitions for many types of tree UIs
|
||||
*/
|
||||
public void renderTreeString(StringBuffer buf, Map context, TreeStringRenderer treeStringRenderer) throws GeneralException {
|
||||
public void renderTreeString(StringBuffer buf, Map<String, Object> context, TreeStringRenderer treeStringRenderer) throws GeneralException {
|
||||
Map parameters = (Map) context.get("parameters");
|
||||
setWidgetBoundaryComments(context);
|
||||
|
||||
@@ -389,7 +389,7 @@ public class ModelTree extends ModelWidget {
|
||||
|
||||
}
|
||||
|
||||
public void renderNodeString(Writer writer, Map context,
|
||||
public void renderNodeString(Writer writer, Map<String, Object> context,
|
||||
TreeStringRenderer treeStringRenderer, int depth, boolean isLast)
|
||||
throws IOException, GeneralException {
|
||||
boolean passed = true;
|
||||
@@ -507,7 +507,7 @@ public class ModelTree extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasChildren(Map context) {
|
||||
public boolean hasChildren(Map<String, Object> context) {
|
||||
|
||||
boolean hasChildren = false;
|
||||
Long nodeCount = null;
|
||||
@@ -585,7 +585,7 @@ public class ModelTree extends ModelWidget {
|
||||
return hasChildren;
|
||||
}
|
||||
|
||||
public void getChildren(Map context) {
|
||||
public void getChildren(Map<String, Object> context) {
|
||||
this.subNodeValues = new ArrayList();
|
||||
Iterator nodeIter = subNodeList.iterator();
|
||||
while (nodeIter.hasNext()) {
|
||||
@@ -687,7 +687,7 @@ public class ModelTree extends ModelWidget {
|
||||
return expandCollapseStyle;
|
||||
}
|
||||
|
||||
public String getWrapStyle(Map context) {
|
||||
public String getWrapStyle(Map<String, Object> context) {
|
||||
String val = this.wrapStyleExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(val)) {
|
||||
val = this.modelTree.getWrapStyle(context);
|
||||
@@ -773,7 +773,7 @@ public class ModelTree extends ModelWidget {
|
||||
return this.rootNode;
|
||||
}
|
||||
|
||||
public String getNodeName(Map context) {
|
||||
public String getNodeName(Map<String, Object> context) {
|
||||
return this.nodeNameExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ public class ModelTree extends ModelWidget {
|
||||
this.styleExdr = new FlexibleStringExpander(labelElement.getAttribute("style"));
|
||||
}
|
||||
|
||||
public void renderLabelString(Writer writer, Map context, TreeStringRenderer treeStringRenderer) {
|
||||
public void renderLabelString(Writer writer, Map<String, Object> context, TreeStringRenderer treeStringRenderer) {
|
||||
try {
|
||||
treeStringRenderer.renderLabel(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -817,15 +817,15 @@ public class ModelTree extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(Map context) {
|
||||
public String getText(Map<String, Object> context) {
|
||||
return this.textExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
}
|
||||
@@ -882,7 +882,7 @@ public class ModelTree extends ModelWidget {
|
||||
|
||||
}
|
||||
|
||||
public void renderLinkString(Writer writer, Map context, TreeStringRenderer treeStringRenderer) {
|
||||
public void renderLinkString(Writer writer, Map<String, Object> context, TreeStringRenderer treeStringRenderer) {
|
||||
try {
|
||||
treeStringRenderer.renderLink(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -892,30 +892,30 @@ public class ModelTree extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(Map context) {
|
||||
public String getText(Map<String, Object> context) {
|
||||
return this.textExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getName(Map context) {
|
||||
public String getName(Map<String, Object> context) {
|
||||
return this.nameExdr.expandString(context);
|
||||
}
|
||||
public String getTitle(Map context) {
|
||||
public String getTitle(Map<String, Object> context) {
|
||||
return this.titleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTarget(Map context) {
|
||||
public String getTarget(Map<String, Object> context) {
|
||||
return this.targetExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getTargetWindow(Map context) {
|
||||
public String getTargetWindow(Map<String, Object> context) {
|
||||
return this.targetWindowExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ public class ModelTree extends ModelWidget {
|
||||
return this.urlMode;
|
||||
}
|
||||
|
||||
public String getPrefix(Map context) {
|
||||
public String getPrefix(Map<String, Object> context) {
|
||||
return this.prefixExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1034,7 +1034,7 @@ public class ModelTree extends ModelWidget {
|
||||
|
||||
}
|
||||
|
||||
public void renderImageString(Writer writer, Map context, TreeStringRenderer treeStringRenderer) {
|
||||
public void renderImageString(Writer writer, Map<String, Object> context, TreeStringRenderer treeStringRenderer) {
|
||||
try {
|
||||
treeStringRenderer.renderImage(writer, context, this);
|
||||
} catch (IOException e) {
|
||||
@@ -1044,27 +1044,27 @@ public class ModelTree extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public String getSrc(Map context) {
|
||||
public String getSrc(Map<String, Object> context) {
|
||||
return this.srcExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getId(Map context) {
|
||||
public String getId(Map<String, Object> context) {
|
||||
return this.idExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getStyle(Map context) {
|
||||
public String getStyle(Map<String, Object> context) {
|
||||
return this.styleExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getWidth(Map context) {
|
||||
public String getWidth(Map<String, Object> context) {
|
||||
return this.widthExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getHeight(Map context) {
|
||||
public String getHeight(Map<String, Object> context) {
|
||||
return this.heightExdr.expandString(context);
|
||||
}
|
||||
|
||||
public String getBorder(Map context) {
|
||||
public String getBorder(Map<String, Object> context) {
|
||||
return this.borderExdr.expandString(context);
|
||||
}
|
||||
|
||||
@@ -1103,3 +1103,4 @@ public class ModelTree extends ModelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class ModelTreeAction {
|
||||
this.modelTree = this.modelNode.getModelTree();
|
||||
}
|
||||
|
||||
public abstract void runAction(Map context);
|
||||
public abstract void runAction(Map<String, Object> context);
|
||||
|
||||
/*
|
||||
public static List readSubActions(ModelTree.ModelNode modelNode, Element parentElement) {
|
||||
@@ -101,7 +101,7 @@ public abstract class ModelTreeAction {
|
||||
}
|
||||
*/
|
||||
|
||||
public static void runSubActions(List actions, Map context) {
|
||||
public static void runSubActions(List actions, Map<String, Object> context) {
|
||||
Iterator actionIter = actions.iterator();
|
||||
while (actionIter.hasNext()) {
|
||||
ModelTreeAction action = (ModelTreeAction) actionIter.next();
|
||||
@@ -129,7 +129,7 @@ public abstract class ModelTreeAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String globalStr = this.globalExdr.expandString(context);
|
||||
// default to false
|
||||
boolean global = "true".equals(globalStr);
|
||||
@@ -180,7 +180,7 @@ public abstract class ModelTreeAction {
|
||||
this.location = scriptElement.getAttribute("location");
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
if (location.endsWith(".bsh")) {
|
||||
try {
|
||||
context.put("_LIST_ITERATOR_", null);
|
||||
@@ -237,7 +237,7 @@ public abstract class ModelTreeAction {
|
||||
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
|
||||
if (UtilValidate.isEmpty(serviceNameExpanded)) {
|
||||
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
|
||||
@@ -319,7 +319,7 @@ public abstract class ModelTreeAction {
|
||||
finder = new PrimaryKeyFinder(entityOneElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
finder.runFind(context, this.modelTree.getDelegator());
|
||||
} catch (GeneralException e) {
|
||||
@@ -345,7 +345,7 @@ public abstract class ModelTreeAction {
|
||||
finder = new ByAndFinder(entityAndElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
context.put(this.listName, null);
|
||||
finder.runFind(context, this.modelTree.getDelegator());
|
||||
@@ -379,7 +379,7 @@ public abstract class ModelTreeAction {
|
||||
finder = new ByConditionFinder(entityConditionElement);
|
||||
}
|
||||
|
||||
public void runAction(Map context) {
|
||||
public void runAction(Map<String, Object> context) {
|
||||
try {
|
||||
context.put(this.listName, null);
|
||||
finder.runFind(context, this.modelTree.getDelegator());
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ModelTreeCondition {
|
||||
this.rootCondition = readCondition(modelTree, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
if (rootCondition == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class ModelTreeCondition {
|
||||
this.modelTree = modelTree;
|
||||
}
|
||||
|
||||
public abstract boolean eval(Map context);
|
||||
public abstract boolean eval(Map<String, Object> context);
|
||||
}
|
||||
|
||||
public static List readSubConditions(ModelTree modelTree, Element conditionElement) {
|
||||
@@ -128,7 +128,7 @@ public class ModelTreeCondition {
|
||||
this.subConditions = readSubConditions(modelTree, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return false for the first one in the list that is false, basic and algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -149,7 +149,7 @@ public class ModelTreeCondition {
|
||||
this.subConditions = readSubConditions(modelTree, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
|
||||
boolean foundOneTrue = false;
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
@@ -176,7 +176,7 @@ public class ModelTreeCondition {
|
||||
this.subConditions = readSubConditions(modelTree, condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// return true for the first one in the list that is true, basic or algo
|
||||
Iterator subConditionIter = this.subConditions.iterator();
|
||||
while (subConditionIter.hasNext()) {
|
||||
@@ -198,7 +198,7 @@ public class ModelTreeCondition {
|
||||
this.subCondition = readCondition(modelTree, firstChildElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
return !this.subCondition.eval(context);
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class ModelTreeCondition {
|
||||
this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
// if no user is logged in, treat as if the user does not have permission
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
if (userLogin != null) {
|
||||
@@ -249,7 +249,7 @@ public class ModelTreeCondition {
|
||||
this.classExdr = new FlexibleStringExpander(condElement.getAttribute("class"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String methodName = this.methodExdr.expandString(context);
|
||||
String className = this.classExdr.expandString(context);
|
||||
|
||||
@@ -315,7 +315,7 @@ public class ModelTreeCondition {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String value = this.valueExdr.expandString(context);
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
@@ -364,7 +364,7 @@ public class ModelTreeCondition {
|
||||
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
String format = this.formatExdr.expandString(context);
|
||||
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
@@ -407,7 +407,7 @@ public class ModelTreeCondition {
|
||||
this.exprExdr = new FlexibleStringExpander(condElement.getAttribute("expr"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
String expr = this.exprExdr.expandString(context);
|
||||
Pattern pattern = null;
|
||||
@@ -440,7 +440,7 @@ public class ModelTreeCondition {
|
||||
this.fieldAcsr = new FlexibleMapAccessor(condElement.getAttribute("field-name"));
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
Object fieldVal = this.fieldAcsr.get(context);
|
||||
return ObjectType.isEmpty(fieldVal);
|
||||
}
|
||||
@@ -453,7 +453,7 @@ public class ModelTreeCondition {
|
||||
this.permissionChecker = new EntityPermissionChecker(condElement);
|
||||
}
|
||||
|
||||
public boolean eval(Map context) {
|
||||
public boolean eval(Map<String, Object> context) {
|
||||
|
||||
boolean passed = permissionChecker.runPermissionCheck(context);
|
||||
return passed;
|
||||
@@ -462,3 +462,4 @@ public class ModelTreeCondition {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ import org.ofbiz.widget.screen.ScreenStringRenderer;
|
||||
*/
|
||||
public interface TreeStringRenderer {
|
||||
|
||||
public void renderNodeBegin(Writer writer, Map context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException;
|
||||
public void renderNodeEnd(Writer writer, Map context, ModelTree.ModelNode node) throws IOException;
|
||||
public void renderLabel(Writer writer, Map context, ModelTree.ModelNode.Label label) throws IOException;
|
||||
public void renderLink(Writer writer, Map context, ModelTree.ModelNode.Link link) throws IOException;
|
||||
public void renderImage(Writer writer, Map context, ModelTree.ModelNode.Image image) throws IOException;
|
||||
public void renderLastElement(Writer writer, Map context, ModelTree.ModelNode node) throws IOException;
|
||||
public ScreenStringRenderer getScreenStringRenderer( Map context);
|
||||
public void renderNodeBegin(Writer writer, Map<String, Object> context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException;
|
||||
public void renderNodeEnd(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException;
|
||||
public void renderLabel(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException;
|
||||
public void renderLink(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException;
|
||||
public void renderImage(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException;
|
||||
public void renderLastElement(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException;
|
||||
public ScreenStringRenderer getScreenStringRenderer( Map<String, Object> context);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.widget.xml;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -60,280 +62,278 @@ public class XmlFormRenderer implements FormStringRenderer {
|
||||
HttpServletRequest request;
|
||||
HttpServletResponse response;
|
||||
|
||||
protected XmlFormRenderer() {}
|
||||
protected XmlFormRenderer() throws IOException {}
|
||||
|
||||
public XmlFormRenderer(HttpServletRequest request, HttpServletResponse response) {
|
||||
public XmlFormRenderer(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public void appendWhitespace(StringBuffer buffer) {
|
||||
public void appendWhitespace(Writer writer) throws IOException {
|
||||
// appending line ends for now, but this could be replaced with a simple space or something
|
||||
buffer.append("\r\n");
|
||||
//buffer.append(' ');
|
||||
writer.write("\r\n");
|
||||
//writer.write(' ');
|
||||
}
|
||||
|
||||
private void makeTextString(StringBuffer buffer, String widgetStyle, String text) {
|
||||
private void makeTextString(Writer writer, String widgetStyle, String text) throws IOException {
|
||||
// TODO: escape characters here
|
||||
buffer.append(text);
|
||||
writer.write(text);
|
||||
}
|
||||
|
||||
public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) {
|
||||
public void renderDisplayField(Writer writer, Map<String, Object> context, DisplayField displayField) throws IOException {
|
||||
ModelFormField modelFormField = displayField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), displayField.getDescription(context));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderHyperlinkField(StringBuffer buffer, Map context, HyperlinkField hyperlinkField) {
|
||||
public void renderHyperlinkField(Writer writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException {
|
||||
ModelFormField modelFormField = hyperlinkField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderTextField(StringBuffer buffer, Map context, TextField textField) {
|
||||
public void renderTextField(Writer writer, Map<String, Object> context, TextField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderTextareaField(StringBuffer buffer, Map context, TextareaField textareaField) {
|
||||
public void renderTextareaField(Writer writer, Map<String, Object> context, TextareaField textareaField) throws IOException {
|
||||
ModelFormField modelFormField = textareaField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDateTimeField(StringBuffer buffer, Map context, DateTimeField dateTimeField) {
|
||||
public void renderDateTimeField(Writer writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException {
|
||||
ModelFormField modelFormField = dateTimeField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDropDownField(StringBuffer buffer, Map context, DropDownField dropDownField) {
|
||||
public void renderDropDownField(Writer writer, Map<String, Object> context, DropDownField dropDownField) throws IOException {
|
||||
ModelFormField modelFormField = dropDownField.getModelFormField();
|
||||
ModelForm modelForm = modelFormField.getModelForm();
|
||||
String currentValue = modelFormField.getEntry(context);
|
||||
List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context));
|
||||
List<ModelFormField.OptionValue> allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context));
|
||||
// if the current value should go first, display it
|
||||
if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) {
|
||||
String explicitDescription = dropDownField.getCurrentDescription(context);
|
||||
if (UtilValidate.isNotEmpty(explicitDescription)) {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), explicitDescription);
|
||||
} else {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
|
||||
}
|
||||
} else {
|
||||
Iterator optionValueIter = allOptionValues.iterator();
|
||||
while (optionValueIter.hasNext()) {
|
||||
ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next();
|
||||
for (ModelFormField.OptionValue optionValue : allOptionValues) {
|
||||
String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context);
|
||||
if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) ||
|
||||
(UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) {
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.appendWhitespace(buffer);
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderCheckField(StringBuffer buffer, Map context, CheckField checkField) {
|
||||
public void renderCheckField(Writer writer, Map<String, Object> context, CheckField checkField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderRadioField(StringBuffer buffer, Map context, RadioField radioField) {
|
||||
public void renderRadioField(Writer writer, Map<String, Object> context, RadioField radioField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderSubmitField(StringBuffer buffer, Map context, SubmitField submitField) {
|
||||
public void renderSubmitField(Writer writer, Map<String, Object> context, SubmitField submitField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderResetField(StringBuffer buffer, Map context, ResetField resetField) {
|
||||
public void renderResetField(Writer writer, Map<String, Object> context, ResetField resetField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, HiddenField hiddenField) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, HiddenField hiddenField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField modelFormField, String value) {
|
||||
public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String value) throws IOException {
|
||||
}
|
||||
|
||||
public void renderIgnoredField(StringBuffer buffer, Map context, IgnoredField ignoredField) {
|
||||
public void renderIgnoredField(Writer writer, Map<String, Object> context, IgnoredField ignoredField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
renderFieldTitle(buffer, context, modelFormField);
|
||||
public void renderSingleFormFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
renderFieldTitle(writer, context, modelFormField);
|
||||
}
|
||||
|
||||
public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderMultiFormClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderMultiFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append("Export>");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatListWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write("Export>");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append("Export>");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatListWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write("Export>");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
public void renderFormatHeaderRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
public void renderFormatHeaderRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatHeaderRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) {
|
||||
public void renderFormatHeaderRowFormCellTitleSeparator(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append(">");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatItemRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write(">");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append(">");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatItemRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write(">");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) {
|
||||
buffer.append("<");
|
||||
buffer.append(modelFormField.getName());
|
||||
buffer.append(">");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatItemRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
|
||||
writer.write("<");
|
||||
writer.write(modelFormField.getName());
|
||||
writer.write(">");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) {
|
||||
buffer.append("</");
|
||||
buffer.append(modelFormField.getName());
|
||||
buffer.append(">");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatItemRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
|
||||
writer.write("</");
|
||||
writer.write(modelFormField.getName());
|
||||
writer.write(">");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatItemRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatItemRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatItemRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("<");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append("Export>");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatSingleWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("<");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write("Export>");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
buffer.append("</");
|
||||
buffer.append(modelForm.getName());
|
||||
buffer.append("Export>");
|
||||
this.appendWhitespace(buffer);
|
||||
public void renderFormatSingleWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
writer.write("</");
|
||||
writer.write(modelForm.getName());
|
||||
writer.write("Export>");
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatFieldRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatFieldRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
|
||||
public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowTitleCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowTitleCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowTitleCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowSpacerCell(StringBuffer buffer, Map context, ModelFormField modelFormField) {
|
||||
public void renderFormatFieldRowSpacerCell(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
public void renderFormatFieldRowWidgetCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatFieldRowWidgetCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) {
|
||||
public void renderFormatFieldRowWidgetCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderFormatEmptySpace(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderTextFindField(StringBuffer buffer, Map context, TextFindField textFindField) {
|
||||
public void renderTextFindField(Writer writer, Map<String, Object> context, TextFindField textFindField) throws IOException {
|
||||
ModelFormField modelFormField = textFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderRangeFindField(StringBuffer buffer, Map context, RangeFindField rangeFindField) {
|
||||
public void renderRangeFindField(Writer writer, Map<String, Object> context, RangeFindField rangeFindField) throws IOException {
|
||||
ModelFormField modelFormField = rangeFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderDateFindField(StringBuffer buffer, Map context, DateFindField dateFindField) {
|
||||
public void renderDateFindField(Writer writer, Map<String, Object> context, DateFindField dateFindField) throws IOException {
|
||||
ModelFormField modelFormField = dateFindField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderLookupField(StringBuffer buffer, Map context, LookupField lookupField) {
|
||||
public void renderLookupField(Writer writer, Map<String, Object> context, LookupField lookupField) throws IOException {
|
||||
ModelFormField modelFormField = lookupField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderNextPrev(StringBuffer buffer, Map context, ModelForm modelForm) {
|
||||
public void renderNextPrev(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
|
||||
}
|
||||
|
||||
public void renderFileField(StringBuffer buffer, Map context, FileField textField) {
|
||||
public void renderFileField(Writer writer, Map<String, Object> context, FileField textField) throws IOException {
|
||||
ModelFormField modelFormField = textField.getModelFormField();
|
||||
this.makeTextString(buffer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.appendWhitespace(buffer);
|
||||
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context)));
|
||||
this.appendWhitespace(writer);
|
||||
}
|
||||
|
||||
public void renderPasswordField(StringBuffer buffer, Map context, PasswordField passwordField) {
|
||||
public void renderPasswordField(Writer writer, Map<String, Object> context, PasswordField passwordField) throws IOException {
|
||||
}
|
||||
|
||||
public void renderImageField(StringBuffer buffer, Map context, ImageField imageField) {
|
||||
public void renderImageField(Writer writer, Map<String, Object> context, ImageField imageField) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderFieldGroupOpen(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupOpen(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderFieldGroupClose(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) {
|
||||
public void renderFieldGroupClose(Writer writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderBanner(StringBuffer buffer, Map context, ModelForm.Banner banner) {
|
||||
public void renderBanner(Writer writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void renderHyperlinkTitle(StringBuffer buffer, Map context, ModelFormField modelFormField, String titleText) {
|
||||
public void renderHyperlinkTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user