📄 htmlformrenderer.java
字号:
buffer.append('"');
buffer.append(" maxlength=\"");
buffer.append(maxlength);
buffer.append('"');
buffer.append("/>");
// add calendar pop-up button and seed data
buffer.append("<a href=\"javascript:call_cal(document.");
buffer.append(modelFormField.getModelForm().getCurrentFormName(context));
buffer.append('.');
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld0_value, '");
buffer.append(modelFormField.getEntry(context, dateFindField.getDefaultDateTimeString(context)));
buffer.append("');\">");
buffer.append("<img src=\"");
this.appendContentUrl(buffer, "/images/cal.gif");
buffer.append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Calendar\"></a>");
buffer.append(" <span");
if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
buffer.append(" class=\"");
buffer.append(modelFormField.getTitleStyle());
buffer.append('"');
}
buffer.append('>');
buffer.append(" " + opEquals + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld0_op\" value=\"equals\" checked/>");
buffer.append(" " + opSameDay + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld0_op\" value=\"sameDay\" checked/>");
buffer.append(" " + opGreaterThanFromDayStart + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld0_op\" value=\"greaterThanFromDayStart\"/>");
buffer.append(" " + opGreaterThan + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld0_op\" value=\"greaterThan\"/>");
buffer.append(" <span");
buffer.append(" <br/> ");
buffer.append("<input type=\"text\"");
className = modelFormField.getWidgetStyle();
if (UtilValidate.isNotEmpty(className)) {
buffer.append(" class=\"");
buffer.append(className);
buffer.append('"');
}
// add a style of red if this is a date/time field and redWhen is true
if (modelFormField.shouldBeRed(context)) {
buffer.append(" style=\"color: red;\"");
}
buffer.append(" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld1_value\"");
value = modelFormField.getEntry(context);
if (UtilValidate.isNotEmpty(value)) {
buffer.append(" value=\"");
buffer.append(value);
buffer.append('"');
}
buffer.append(" size=\"");
buffer.append(size);
buffer.append('"');
buffer.append(" maxlength=\"");
buffer.append(maxlength);
buffer.append('"');
buffer.append("/>");
// add calendar pop-up button and seed data
buffer.append("<a href=\"javascript:call_cal(document.");
buffer.append(modelFormField.getModelForm().getCurrentFormName(context));
buffer.append('.');
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld1_value, '");
buffer.append(modelFormField.getEntry(context, dateFindField.getDefaultDateTimeString(context)));
buffer.append("');\">");
buffer.append("<img src=\"");
this.appendContentUrl(buffer, "/images/cal.gif");
buffer.append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Calendar\"></a>");
buffer.append(" <span");
if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
buffer.append(" class=\"");
buffer.append(modelFormField.getTitleStyle());
buffer.append('"');
}
buffer.append('>');
buffer.append(" " + opLessThan + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld1_op\" value=\"lessThan\"/>");
buffer.append(" " + opUpToDay + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld1_op\" value=\"upToDay\"/>");
buffer.append(" " + opUpThruDay + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_fld1_op\" value=\"upThruDay\"/>");
buffer.append(" " + opIsEmpty + " <input type=\"radio\" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append("_op\" value=\"empty\"/>");
buffer.append("</span>");
this.appendTooltip(buffer, context, modelFormField);
this.appendWhitespace(buffer);
}
/* (non-Javadoc)
* @see org.ofbiz.content.widget.form.FormStringRenderer#renderLookupField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.LookupField)
*/
public void renderLookupField(StringBuffer buffer, Map context, LookupField lookupField) {
ModelFormField modelFormField = lookupField.getModelFormField();
buffer.append("<input type=\"text\"");
String className = modelFormField.getWidgetStyle();
if (UtilValidate.isNotEmpty(className)) {
buffer.append(" class=\"");
buffer.append(className);
buffer.append('"');
}
// add a style of red if this is a date/time field and redWhen is true
if (modelFormField.shouldBeRed(context)) {
buffer.append(" style=\"color: red;\"");
}
buffer.append(" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append('"');
String value = modelFormField.getEntry(context);
if (UtilValidate.isNotEmpty(value)) {
buffer.append(" value=\"");
buffer.append(value);
buffer.append('"');
}
buffer.append(" size=\"");
buffer.append(lookupField.getSize());
buffer.append('"');
Integer maxlength = lookupField.getMaxlength();
if (maxlength != null) {
buffer.append(" maxlength=\"");
buffer.append(maxlength.intValue());
buffer.append('"');
}
buffer.append("/>");
// add lookup pop-up button
buffer.append("<a href=\"javascript:call_fieldlookup2(document.");
buffer.append(modelFormField.getModelForm().getCurrentFormName(context));
buffer.append('.');
buffer.append(modelFormField.getParameterName(context));
buffer.append(", '");
buffer.append(lookupField.getFormName());
buffer.append("');\">");
buffer.append("<img src=\"");
this.appendContentUrl(buffer, "/images/fieldlookup.gif");
buffer.append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Lookup\"></a>");
this.makeHyperlinkString(buffer, lookupField.getSubHyperlink(), context);
this.appendTooltip(buffer, context, modelFormField);
this.appendWhitespace(buffer);
}
public void renderNextPrev(StringBuffer buffer, Map context, ModelForm modelForm) {
String targetService = modelForm.getPaginateTarget();
if (targetService == null) {
targetService = "${targetService}";
}
int viewIndex = -1;
try {
viewIndex = ((Integer) context.get("viewIndex")).intValue();
} catch (Exception e) {
viewIndex = 0;
}
int viewSize = -1;
try {
viewSize = ((Integer) context.get("viewSize")).intValue();
} catch (Exception e) {
viewSize = 0;
}
int listSize = -1;
try {
listSize = ((Integer) context.get("listSize")).intValue();
} catch (Exception e) {
listSize = 0;
}
int highIndex = -1;
try {
highIndex = ((Integer) context.get("highIndex")).intValue();
} catch (Exception e) {
highIndex = 0;
}
int lowIndex = -1;
try {
lowIndex = ((Integer) context.get("lowIndex")).intValue();
} catch (Exception e) {
lowIndex = 0;
}
String queryString = (String) context.get("queryString");
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
buffer.append("<table border=\"0\" width=\"100%\" cellpadding=\"2\">\n");
buffer.append(" <tr>\n");
buffer.append(" <td align=right>\n");
buffer.append(" <b>\n");
if (viewIndex > 0) {
buffer.append(" <a href=\"");
String linkText = targetService + "?" + queryString + "&VIEW_SIZE=" + viewSize + "&VIEW_INDEX=" + (viewIndex - 1) + "\"";
// make the link
buffer.append(rh.makeLink(request, response, linkText, false, false, false));
buffer.append(" class=\"buttontext\">[Previous]</a>\n");
}
if (listSize > 0) {
buffer.append(" <span class=\"tabletext\">" + lowIndex + " - " + highIndex + " of " + listSize + "</span> \n");
}
if (highIndex < listSize) {
buffer.append(" <a href=\"");
String linkText = "" + targetService + "?" + queryString + "&VIEW_SIZE=" + viewSize + "&VIEW_INDEX=" + (viewIndex + 1) + "\"";
// make the link
buffer.append(rh.makeLink(request, response, linkText, false, false, false));
buffer.append(" class=\"buttontext\">[Next]</a>\n");
}
buffer.append(" </b>\n");
buffer.append(" </td>\n");
buffer.append(" </tr>\n");
buffer.append("</table>\n");
this.appendWhitespace(buffer);
}
/* (non-Javadoc)
* @see org.ofbiz.content.widget.form.FormStringRenderer#renderFileField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.FileField)
*/
public void renderFileField(StringBuffer buffer, Map context, FileField textField) {
ModelFormField modelFormField = textField.getModelFormField();
buffer.append("<input type=\"file\"");
String className = modelFormField.getWidgetStyle();
if (UtilValidate.isNotEmpty(className)) {
buffer.append(" class=\"");
buffer.append(className);
buffer.append('"');
}
// add a style of red if this is a date/time field and redWhen is true
if (modelFormField.shouldBeRed(context)) {
buffer.append(" style=\"color: red;\"");
}
buffer.append(" name=\"");
buffer.append(modelFormField.getParameterName(context));
buffer.append('"');
String value = modelFormField.getEntry(context, textField.getDefaultValue(context));
if (UtilValidate.isNotEmpty(value)) {
buffer.append(" value=\"");
buffer.append(value);
buffer.append('"');
}
buffer.append(" size=\"");
buffer.append(textField.getSize());
buffer.append('"');
Integer maxlength = textField.getMaxlength();
if (maxlength != null) {
buffer.append(" maxlength=\"");
buffer.append(maxlength.intValue());
buffer.append('"');
}
buffer.append("/>");
this.makeHyperlinkString(buffer, textField.getSubHyperlink(), context);
this.appendTooltip(buffer, context, modelFormField);
this.appendWhitespace(buffer);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -