Source Code Cross Referenced for HtmlFormRenderer.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » content » widget » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » SourceTap CRM » org.ofbiz.content.widget.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $Id: HtmlFormRenderer.java,v 1.6 2003/12/05 20:42:51 byersa Exp $
0003:         *
0004:         * Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
0005:         *
0006:         * Permission is hereby granted, free of charge, to any person obtaining a
0007:         * copy of this software and associated documentation files (the "Software"),
0008:         * to deal in the Software without restriction, including without limitation
0009:         * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0010:         * and/or sell copies of the Software, and to permit persons to whom the
0011:         * Software is furnished to do so, subject to the following conditions:
0012:         *
0013:         * The above copyright notice and this permission notice shall be included
0014:         * in all copies or substantial portions of the Software.
0015:         *
0016:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0017:         * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0018:         * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0019:         * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0020:         * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
0021:         * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
0022:         * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0023:         */
0024:        package org.ofbiz.content.widget.html;
0025:
0026:        import java.util.Iterator;
0027:        import java.util.List;
0028:        import java.util.Map;
0029:        import java.util.Locale;
0030:
0031:        import javax.servlet.ServletContext;
0032:        import javax.servlet.http.HttpServletRequest;
0033:        import javax.servlet.http.HttpServletResponse;
0034:
0035:        import org.ofbiz.base.util.UtilValidate;
0036:        import org.ofbiz.base.util.UtilProperties;
0037:        import org.ofbiz.content.webapp.control.RequestHandler;
0038:        import org.ofbiz.content.webapp.taglib.ContentUrlTag;
0039:        import org.ofbiz.content.widget.form.FormStringRenderer;
0040:        import org.ofbiz.content.widget.form.ModelForm;
0041:        import org.ofbiz.content.widget.form.ModelFormField;
0042:        import org.ofbiz.content.widget.form.ModelFormField.CheckField;
0043:        import org.ofbiz.content.widget.form.ModelFormField.DateFindField;
0044:        import org.ofbiz.content.widget.form.ModelFormField.DateTimeField;
0045:        import org.ofbiz.content.widget.form.ModelFormField.DisplayField;
0046:        import org.ofbiz.content.widget.form.ModelFormField.DropDownField;
0047:        import org.ofbiz.content.widget.form.ModelFormField.HiddenField;
0048:        import org.ofbiz.content.widget.form.ModelFormField.HyperlinkField;
0049:        import org.ofbiz.content.widget.form.ModelFormField.IgnoredField;
0050:        import org.ofbiz.content.widget.form.ModelFormField.LookupField;
0051:        import org.ofbiz.content.widget.form.ModelFormField.FileField;
0052:        import org.ofbiz.content.widget.form.ModelFormField.RadioField;
0053:        import org.ofbiz.content.widget.form.ModelFormField.RangeFindField;
0054:        import org.ofbiz.content.widget.form.ModelFormField.ResetField;
0055:        import org.ofbiz.content.widget.form.ModelFormField.SubmitField;
0056:        import org.ofbiz.content.widget.form.ModelFormField.TextField;
0057:        import org.ofbiz.content.widget.form.ModelFormField.TextFindField;
0058:        import org.ofbiz.content.widget.form.ModelFormField.TextareaField;
0059:
0060:        /**
0061:         * Widget Library - HTML Form Renderer implementation
0062:         *
0063:         * @author     <a href="mailto:jonesde@ofbiz.org">David E. Jones</a>
0064:         * @author     <a href="mailto:byersa@automationgroups.com">Al Byers</a>
0065:         * @version    $Revision: 1.6 $
0066:         * @since      2.2
0067:         */
0068:        public class HtmlFormRenderer implements  FormStringRenderer {
0069:
0070:            HttpServletRequest request;
0071:            HttpServletResponse response;
0072:
0073:            protected HtmlFormRenderer() {
0074:            }
0075:
0076:            public HtmlFormRenderer(HttpServletRequest request,
0077:                    HttpServletResponse response) {
0078:                this .request = request;
0079:                this .response = response;
0080:            }
0081:
0082:            public void appendWhitespace(StringBuffer buffer) {
0083:                // appending line ends for now, but this could be replaced with a simple space or something
0084:                buffer.append("\r\n");
0085:                //buffer.append(' ');
0086:            }
0087:
0088:            public void appendOfbizUrl(StringBuffer buffer, String location) {
0089:                ServletContext ctx = (ServletContext) this .request
0090:                        .getAttribute("servletContext");
0091:                RequestHandler rh = (RequestHandler) ctx
0092:                        .getAttribute("_REQUEST_HANDLER_");
0093:                // make and append the link
0094:                buffer.append(rh
0095:                        .makeLink(this .request, this .response, location));
0096:            }
0097:
0098:            public void appendContentUrl(StringBuffer buffer, String location) {
0099:                ContentUrlTag.appendContentPrefix(this .request, buffer);
0100:                buffer.append(location);
0101:            }
0102:
0103:            public void appendTooltip(StringBuffer buffer, Map context,
0104:                    ModelFormField modelFormField) {
0105:                // render the tooltip, in other methods too
0106:                String tooltip = modelFormField.getTooltip(context);
0107:                if (UtilValidate.isNotEmpty(tooltip)) {
0108:                    buffer.append("<span");
0109:                    String tooltipStyle = modelFormField.getTooltipStyle();
0110:                    if (UtilValidate.isNotEmpty(tooltipStyle)) {
0111:                        buffer.append(" class=\"");
0112:                        buffer.append(tooltipStyle);
0113:                        buffer.append("\"");
0114:                    }
0115:                    buffer.append("> -[");
0116:                    buffer.append(tooltip);
0117:                    buffer.append("]- </span>");
0118:                }
0119:            }
0120:
0121:            /* (non-Javadoc)
0122:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderDisplayField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.DisplayField)
0123:             */
0124:            public void renderDisplayField(StringBuffer buffer, Map context,
0125:                    DisplayField displayField) {
0126:                ModelFormField modelFormField = displayField
0127:                        .getModelFormField();
0128:
0129:                buffer.append("<span");
0130:
0131:                if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) {
0132:                    buffer.append(" class=\"");
0133:                    buffer.append(modelFormField.getWidgetStyle());
0134:                    buffer.append("\"");
0135:                }
0136:
0137:                // add a style of red if this is a date/time field and redWhen is true
0138:                if (modelFormField.shouldBeRed(context)) {
0139:                    buffer.append(" style=\"color: red;\"");
0140:                }
0141:
0142:                buffer.append(">");
0143:                buffer.append(displayField.getDescription(context));
0144:                buffer.append("</span>");
0145:
0146:                this .appendTooltip(buffer, context, modelFormField);
0147:
0148:                this .appendWhitespace(buffer);
0149:            }
0150:
0151:            /* (non-Javadoc)
0152:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderHyperlinkField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.HyperlinkField)
0153:             */
0154:            public void renderHyperlinkField(StringBuffer buffer, Map context,
0155:                    HyperlinkField hyperlinkField) {
0156:                ModelFormField modelFormField = hyperlinkField
0157:                        .getModelFormField();
0158:                this .makeHyperlinkString(buffer, modelFormField
0159:                        .getWidgetStyle(), hyperlinkField.getTargetType(),
0160:                        hyperlinkField.getTarget(context), hyperlinkField
0161:                                .getDescription(context));
0162:                this .appendTooltip(buffer, context, modelFormField);
0163:                this .appendWhitespace(buffer);
0164:            }
0165:
0166:            public void makeHyperlinkString(StringBuffer buffer,
0167:                    ModelFormField.SubHyperlink subHyperlink, Map context) {
0168:                if (subHyperlink == null) {
0169:                    return;
0170:                }
0171:                if (subHyperlink.shouldUse(context)) {
0172:                    buffer.append(' ');
0173:                    this .makeHyperlinkString(buffer, subHyperlink
0174:                            .getLinkStyle(), subHyperlink.getTargetType(),
0175:                            subHyperlink.getTarget(context), subHyperlink
0176:                                    .getDescription(context));
0177:                }
0178:            }
0179:
0180:            public void makeHyperlinkString(StringBuffer buffer,
0181:                    String linkStyle, String targetType, String target,
0182:                    String description) {
0183:                buffer.append("<a");
0184:
0185:                if (UtilValidate.isNotEmpty(linkStyle)) {
0186:                    buffer.append(" class=\"");
0187:                    buffer.append(linkStyle);
0188:                    buffer.append("\"");
0189:                }
0190:
0191:                buffer.append(" href=\"");
0192:                if ("intra-app".equals(targetType)) {
0193:                    this .appendOfbizUrl(buffer, "/" + target);
0194:                } else if ("inter-app".equals(targetType)) {
0195:                    String fullTarget = target;
0196:                    buffer.append(fullTarget);
0197:                    String externalLoginKey = (String) this .request
0198:                            .getAttribute("externalLoginKey");
0199:                    if (UtilValidate.isNotEmpty(externalLoginKey)) {
0200:                        if (fullTarget.indexOf('?') == -1) {
0201:                            buffer.append('?');
0202:                        } else {
0203:                            buffer.append('&');
0204:                        }
0205:                        buffer.append("externalLoginKey=");
0206:                        buffer.append(externalLoginKey);
0207:                    }
0208:                } else if ("content".equals(targetType)) {
0209:                    this .appendContentUrl(buffer, target);
0210:                } else if ("plain".equals(targetType)) {
0211:                    buffer.append(target);
0212:                } else {
0213:                    buffer.append(target);
0214:                }
0215:                buffer.append("\"");
0216:
0217:                buffer.append('>');
0218:
0219:                buffer.append(description);
0220:                buffer.append("</a>");
0221:            }
0222:
0223:            /* (non-Javadoc)
0224:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderTextField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.TextField)
0225:             */
0226:            public void renderTextField(StringBuffer buffer, Map context,
0227:                    TextField textField) {
0228:                ModelFormField modelFormField = textField.getModelFormField();
0229:
0230:                buffer.append("<input type=\"text\"");
0231:
0232:                String className = modelFormField.getWidgetStyle();
0233:                if (UtilValidate.isNotEmpty(className)) {
0234:                    buffer.append(" class=\"");
0235:                    buffer.append(className);
0236:                    buffer.append('"');
0237:                }
0238:
0239:                // add a style of red if this is a date/time field and redWhen is true
0240:                if (modelFormField.shouldBeRed(context)) {
0241:                    buffer.append(" style=\"color: red;\"");
0242:                }
0243:
0244:                buffer.append(" name=\"");
0245:                buffer.append(modelFormField.getParameterName(context));
0246:                buffer.append('"');
0247:
0248:                String value = modelFormField.getEntry(context, textField
0249:                        .getDefaultValue(context));
0250:                if (UtilValidate.isNotEmpty(value)) {
0251:                    buffer.append(" value=\"");
0252:                    buffer.append(value);
0253:                    buffer.append('"');
0254:                }
0255:
0256:                buffer.append(" size=\"");
0257:                buffer.append(textField.getSize());
0258:                buffer.append('"');
0259:
0260:                Integer maxlength = textField.getMaxlength();
0261:                if (maxlength != null) {
0262:                    buffer.append(" maxlength=\"");
0263:                    buffer.append(maxlength.intValue());
0264:                    buffer.append('"');
0265:                }
0266:
0267:                String idName = modelFormField.getIdName();
0268:                if (UtilValidate.isNotEmpty(idName)) {
0269:                    buffer.append(" id=\"");
0270:                    buffer.append(idName);
0271:                    buffer.append('"');
0272:                }
0273:
0274:                buffer.append("/>");
0275:
0276:                this .makeHyperlinkString(buffer, textField.getSubHyperlink(),
0277:                        context);
0278:
0279:                this .appendTooltip(buffer, context, modelFormField);
0280:
0281:                this .appendWhitespace(buffer);
0282:            }
0283:
0284:            /* (non-Javadoc)
0285:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderTextareaField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.TextareaField)
0286:             */
0287:            public void renderTextareaField(StringBuffer buffer, Map context,
0288:                    TextareaField textareaField) {
0289:                ModelFormField modelFormField = textareaField
0290:                        .getModelFormField();
0291:
0292:                buffer.append("<textarea class=\"textAreaBox\"");
0293:
0294:                String className = modelFormField.getWidgetStyle();
0295:                if (UtilValidate.isNotEmpty(className)) {
0296:                    buffer.append(" class=\"");
0297:                    buffer.append(className);
0298:                    buffer.append('"');
0299:                }
0300:
0301:                buffer.append(" name=\"");
0302:                buffer.append(modelFormField.getParameterName(context));
0303:                buffer.append('"');
0304:
0305:                buffer.append(" cols=\"");
0306:                buffer.append(textareaField.getCols());
0307:                buffer.append('"');
0308:
0309:                buffer.append(" rows=\"");
0310:                buffer.append(textareaField.getRows());
0311:                buffer.append('"');
0312:
0313:                String idName = modelFormField.getIdName();
0314:                if (UtilValidate.isNotEmpty(idName)) {
0315:                    buffer.append(" id=\"");
0316:                    buffer.append(idName);
0317:                    buffer.append('"');
0318:                }
0319:
0320:                buffer.append('>');
0321:
0322:                String value = modelFormField.getEntry(context, textareaField
0323:                        .getDefaultValue(context));
0324:                if (UtilValidate.isNotEmpty(value)) {
0325:                    buffer.append(value);
0326:                }
0327:
0328:                buffer.append("</textarea>");
0329:
0330:                this .appendTooltip(buffer, context, modelFormField);
0331:
0332:                this .appendWhitespace(buffer);
0333:            }
0334:
0335:            /* (non-Javadoc)
0336:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderDateTimeField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.DateTimeField)
0337:             */
0338:            public void renderDateTimeField(StringBuffer buffer, Map context,
0339:                    DateTimeField dateTimeField) {
0340:                ModelFormField modelFormField = dateTimeField
0341:                        .getModelFormField();
0342:
0343:                buffer.append("<input type=\"text\"");
0344:
0345:                String className = modelFormField.getWidgetStyle();
0346:                if (UtilValidate.isNotEmpty(className)) {
0347:                    buffer.append(" class=\"");
0348:                    buffer.append(className);
0349:                    buffer.append('"');
0350:                }
0351:
0352:                // add a style of red if this is a date/time field and redWhen is true
0353:                if (modelFormField.shouldBeRed(context)) {
0354:                    buffer.append(" style=\"color: red;\"");
0355:                }
0356:
0357:                buffer.append(" name=\"");
0358:                buffer.append(modelFormField.getParameterName(context));
0359:                buffer.append('"');
0360:
0361:                String value = modelFormField.getEntry(context);
0362:                if (UtilValidate.isNotEmpty(value)) {
0363:                    buffer.append(" value=\"");
0364:                    buffer.append(value);
0365:                    buffer.append('"');
0366:                }
0367:
0368:                // the default values for a timestamp
0369:                int size = 25;
0370:                int maxlength = 30;
0371:
0372:                if ("date".equals(dateTimeField.getType())) {
0373:                    size = 10;
0374:                    maxlength = 12;
0375:                } else if ("time".equals(dateTimeField.getType())) {
0376:                    size = 12;
0377:                    maxlength = 15;
0378:                }
0379:
0380:                buffer.append(" size=\"");
0381:                buffer.append(size);
0382:                buffer.append('"');
0383:
0384:                buffer.append(" maxlength=\"");
0385:                buffer.append(maxlength);
0386:                buffer.append('"');
0387:
0388:                String idName = modelFormField.getIdName();
0389:                if (UtilValidate.isNotEmpty(idName)) {
0390:                    buffer.append(" id=\"");
0391:                    buffer.append(idName);
0392:                    buffer.append('"');
0393:                }
0394:
0395:                buffer.append("/>");
0396:
0397:                // add calendar pop-up button and seed data IF this is not a "time" type date-time
0398:                if (!"time".equals(dateTimeField.getType())) {
0399:                    buffer.append("<a href=\"javascript:call_cal(document.");
0400:                    buffer.append(modelFormField.getModelForm()
0401:                            .getCurrentFormName(context));
0402:                    buffer.append('.');
0403:                    buffer.append(modelFormField.getParameterName(context));
0404:                    buffer.append(", '");
0405:                    buffer.append(modelFormField.getEntry(context,
0406:                            dateTimeField.getDefaultDateTimeString(context)));
0407:                    buffer.append("');\">");
0408:                    buffer.append("<img src=\"");
0409:                    this .appendContentUrl(buffer, "/images/cal.gif");
0410:                    buffer
0411:                            .append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Calendar\"></a>");
0412:                }
0413:
0414:                this .appendTooltip(buffer, context, modelFormField);
0415:
0416:                this .appendWhitespace(buffer);
0417:            }
0418:
0419:            /* (non-Javadoc)
0420:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderDropDownField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.DropDownField)
0421:             */
0422:            public void renderDropDownField(StringBuffer buffer, Map context,
0423:                    DropDownField dropDownField) {
0424:                ModelFormField modelFormField = dropDownField
0425:                        .getModelFormField();
0426:                ModelForm modelForm = modelFormField.getModelForm();
0427:
0428:                buffer.append("<select");
0429:
0430:                String className = modelFormField.getWidgetStyle();
0431:                if (UtilValidate.isNotEmpty(className)) {
0432:                    buffer.append(" class=\"");
0433:                    buffer.append(className);
0434:                    buffer.append('"');
0435:                }
0436:
0437:                buffer.append(" name=\"");
0438:                buffer.append(modelFormField.getParameterName(context));
0439:                buffer.append('"');
0440:
0441:                String idName = modelFormField.getIdName();
0442:                if (UtilValidate.isNotEmpty(idName)) {
0443:                    buffer.append(" id=\"");
0444:                    buffer.append(idName);
0445:                    buffer.append('"');
0446:                }
0447:
0448:                buffer.append(" size=\"1\">");
0449:
0450:                String currentValue = modelFormField.getEntry(context);
0451:                List allOptionValues = dropDownField.getAllOptionValues(
0452:                        context, modelForm.getDelegator());
0453:
0454:                // if the current value should go first, stick it in
0455:                if (UtilValidate.isNotEmpty(currentValue)
0456:                        && "first-in-list".equals(dropDownField.getCurrent())) {
0457:                    buffer.append("<option");
0458:                    buffer.append(" selected");
0459:                    buffer.append(" value=\"");
0460:                    buffer.append(currentValue);
0461:                    buffer.append("\">");
0462:                    String explicitDescription = dropDownField
0463:                            .getCurrentDescription(context);
0464:                    if (UtilValidate.isNotEmpty(explicitDescription)) {
0465:                        buffer.append(explicitDescription);
0466:                    } else {
0467:                        buffer.append(ModelFormField.FieldInfoWithOptions
0468:                                .getDescriptionForOptionKey(currentValue,
0469:                                        allOptionValues));
0470:                    }
0471:                    buffer.append("</option>");
0472:
0473:                    // add a "separator" option
0474:                    buffer.append("<option value=\"");
0475:                    buffer.append(currentValue);
0476:                    buffer.append("\">---</option>");
0477:                }
0478:
0479:                // if allow empty is true, add an empty option
0480:                if (dropDownField.isAllowEmpty()) {
0481:                    buffer.append("<option value=\"\">&nbsp;</option>");
0482:                }
0483:
0484:                // list out all options according to the option list
0485:                Iterator optionValueIter = allOptionValues.iterator();
0486:                while (optionValueIter.hasNext()) {
0487:                    ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter
0488:                            .next();
0489:                    buffer.append("<option");
0490:                    // if current value should be selected in the list, select it
0491:                    if (UtilValidate.isNotEmpty(currentValue)
0492:                            && currentValue.equals(optionValue.getKey())
0493:                            && "selected".equals(dropDownField.getCurrent())) {
0494:                        buffer.append(" selected");
0495:                    } else if (UtilValidate.isEmpty(currentValue)
0496:                            && dropDownField.getNoCurrentSelectedKey() != null
0497:                            && dropDownField.getNoCurrentSelectedKey().equals(
0498:                                    optionValue.getKey())) {
0499:                        buffer.append(" selected");
0500:                    }
0501:                    buffer.append(" value=\"");
0502:                    buffer.append(optionValue.getKey());
0503:                    buffer.append("\">");
0504:                    buffer.append(optionValue.getDescription());
0505:                    buffer.append("</option>");
0506:                }
0507:
0508:                buffer.append("</select>");
0509:
0510:                this .makeHyperlinkString(buffer, dropDownField
0511:                        .getSubHyperlink(), context);
0512:
0513:                this .appendTooltip(buffer, context, modelFormField);
0514:
0515:                this .appendWhitespace(buffer);
0516:            }
0517:
0518:            /* (non-Javadoc)
0519:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderCheckField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.CheckField)
0520:             */
0521:            public void renderCheckField(StringBuffer buffer, Map context,
0522:                    CheckField checkField) {
0523:                // well, I don't know if this will be very useful... but here it is
0524:
0525:                ModelFormField modelFormField = checkField.getModelFormField();
0526:                // never used: ModelForm modelForm = modelFormField.getModelForm();
0527:                String currentValue = modelFormField.getEntry(context);
0528:
0529:                buffer.append("<span");
0530:                String className = modelFormField.getWidgetStyle();
0531:                if (UtilValidate.isNotEmpty(className)) {
0532:                    buffer.append(" class=\"");
0533:                    buffer.append(className);
0534:                    buffer.append('"');
0535:                }
0536:                buffer.append(">");
0537:
0538:                buffer.append("<input type=\"");
0539:                buffer.append("checkbox");
0540:                buffer.append('"');
0541:
0542:                // if current value should be selected in the list, select it
0543:                if ("Y".equals(currentValue) || "T".equals(currentValue)) {
0544:                    buffer.append(" checked");
0545:                }
0546:                buffer.append(" name=\"");
0547:                buffer.append(modelFormField.getParameterName(context));
0548:                buffer.append('"');
0549:                buffer.append(" value=\"Y\"/>");
0550:                // any description by it?
0551:                buffer.append("</span>");
0552:
0553:                this .appendTooltip(buffer, context, modelFormField);
0554:
0555:                this .appendWhitespace(buffer);
0556:            }
0557:
0558:            /* (non-Javadoc)
0559:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderRadioField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.RadioField)
0560:             */
0561:            public void renderRadioField(StringBuffer buffer, Map context,
0562:                    RadioField radioField) {
0563:                ModelFormField modelFormField = radioField.getModelFormField();
0564:                ModelForm modelForm = modelFormField.getModelForm();
0565:                List allOptionValues = radioField.getAllOptionValues(context,
0566:                        modelForm.getDelegator());
0567:                String currentValue = modelFormField.getEntry(context);
0568:
0569:                // list out all options according to the option list
0570:                Iterator optionValueIter = allOptionValues.iterator();
0571:                while (optionValueIter.hasNext()) {
0572:                    ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter
0573:                            .next();
0574:                    String className = modelFormField.getWidgetStyle();
0575:                    buffer.append("<div");
0576:                    if (UtilValidate.isNotEmpty(className)) {
0577:                        buffer.append(" class=\"");
0578:                        buffer.append(className);
0579:                        buffer.append('"');
0580:                    }
0581:                    buffer.append(">");
0582:
0583:                    buffer.append("<input type=\"");
0584:                    buffer.append("radio");
0585:                    buffer.append('"');
0586:
0587:                    // if current value should be selected in the list, select it
0588:                    if (UtilValidate.isNotEmpty(currentValue)
0589:                            && currentValue.equals(optionValue.getKey())) {
0590:                        buffer.append(" checked");
0591:                    }
0592:                    buffer.append(" name=\"");
0593:                    buffer.append(modelFormField.getParameterName(context));
0594:                    buffer.append('"');
0595:                    buffer.append(" value=\"");
0596:                    buffer.append(optionValue.getKey());
0597:                    buffer.append("\"/>");
0598:
0599:                    buffer.append(optionValue.getDescription());
0600:                    buffer.append("</div>");
0601:                }
0602:
0603:                this .appendTooltip(buffer, context, modelFormField);
0604:
0605:                this .appendWhitespace(buffer);
0606:            }
0607:
0608:            /* (non-Javadoc)
0609:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderSubmitField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.SubmitField)
0610:             */
0611:            public void renderSubmitField(StringBuffer buffer, Map context,
0612:                    SubmitField submitField) {
0613:                ModelFormField modelFormField = submitField.getModelFormField();
0614:                ModelForm modelForm = modelFormField.getModelForm();
0615:
0616:                if ("text-link".equals(submitField.getButtonType())) {
0617:                    buffer.append("<a");
0618:
0619:                    String className = modelFormField.getWidgetStyle();
0620:                    if (UtilValidate.isNotEmpty(className)) {
0621:                        buffer.append(" class=\"");
0622:                        buffer.append(className);
0623:                        buffer.append('"');
0624:                    }
0625:
0626:                    buffer.append(" href=\"javascript:document.");
0627:                    buffer.append(modelForm.getCurrentFormName(context));
0628:                    buffer.append(".submit()\">");
0629:
0630:                    buffer.append(modelFormField.getTitle(context));
0631:
0632:                    buffer.append("</a>");
0633:                } else if ("image".equals(submitField.getButtonType())) {
0634:                    buffer.append("<input type=\"image\"");
0635:
0636:                    String className = modelFormField.getWidgetStyle();
0637:                    if (UtilValidate.isNotEmpty(className)) {
0638:                        buffer.append(" class=\"");
0639:                        buffer.append(className);
0640:                        buffer.append('"');
0641:                    }
0642:
0643:                    buffer.append(" name=\"");
0644:                    buffer.append(modelFormField.getParameterName(context));
0645:                    buffer.append('"');
0646:
0647:                    String title = modelFormField.getTitle(context);
0648:                    if (UtilValidate.isNotEmpty(title)) {
0649:                        buffer.append(" alt=\"");
0650:                        buffer.append(title);
0651:                        buffer.append('"');
0652:                    }
0653:
0654:                    buffer.append(" src=\"");
0655:                    this .appendContentUrl(buffer, submitField
0656:                            .getImageLocation());
0657:                    buffer.append('"');
0658:
0659:                    buffer.append("/>");
0660:                } else {
0661:                    // default to "button"
0662:
0663:                    buffer.append("<input type=\"submit\"");
0664:
0665:                    String className = modelFormField.getWidgetStyle();
0666:                    if (UtilValidate.isNotEmpty(className)) {
0667:                        buffer.append(" class=\"");
0668:                        buffer.append(className);
0669:                        buffer.append('"');
0670:                    }
0671:
0672:                    buffer.append(" name=\"");
0673:                    buffer.append(modelFormField.getParameterName(context));
0674:                    buffer.append('"');
0675:
0676:                    String title = modelFormField.getTitle(context);
0677:                    if (UtilValidate.isNotEmpty(title)) {
0678:                        buffer.append(" value=\"");
0679:                        buffer.append(title);
0680:                        buffer.append('"');
0681:                    }
0682:
0683:                    buffer.append("/>");
0684:                }
0685:
0686:                this .appendTooltip(buffer, context, modelFormField);
0687:
0688:                this .appendWhitespace(buffer);
0689:            }
0690:
0691:            /* (non-Javadoc)
0692:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderResetField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.ResetField)
0693:             */
0694:            public void renderResetField(StringBuffer buffer, Map context,
0695:                    ResetField resetField) {
0696:                ModelFormField modelFormField = resetField.getModelFormField();
0697:
0698:                buffer.append("<input type=\"reset\"");
0699:
0700:                String className = modelFormField.getWidgetStyle();
0701:                if (UtilValidate.isNotEmpty(className)) {
0702:                    buffer.append(" class=\"");
0703:                    buffer.append(className);
0704:                    buffer.append('"');
0705:                }
0706:
0707:                buffer.append(" name=\"");
0708:                buffer.append(modelFormField.getParameterName(context));
0709:                buffer.append('"');
0710:
0711:                String title = modelFormField.getTitle(context);
0712:                if (UtilValidate.isNotEmpty(title)) {
0713:                    buffer.append(" value=\"");
0714:                    buffer.append(title);
0715:                    buffer.append('"');
0716:                }
0717:
0718:                buffer.append("/>");
0719:
0720:                this .appendTooltip(buffer, context, modelFormField);
0721:
0722:                this .appendWhitespace(buffer);
0723:            }
0724:
0725:            /* (non-Javadoc)
0726:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderHiddenField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.HiddenField)
0727:             */
0728:            public void renderHiddenField(StringBuffer buffer, Map context,
0729:                    HiddenField hiddenField) {
0730:                ModelFormField modelFormField = hiddenField.getModelFormField();
0731:                String value = hiddenField.getValue(context);
0732:                this .renderHiddenField(buffer, context, modelFormField, value);
0733:            }
0734:
0735:            public void renderHiddenField(StringBuffer buffer, Map context,
0736:                    ModelFormField modelFormField, String value) {
0737:                buffer.append("<input type=\"hidden\"");
0738:
0739:                buffer.append(" name=\"");
0740:                buffer.append(modelFormField.getParameterName(context));
0741:                buffer.append('"');
0742:
0743:                if (UtilValidate.isNotEmpty(value)) {
0744:                    buffer.append(" value=\"");
0745:                    buffer.append(value);
0746:                    buffer.append('"');
0747:                }
0748:
0749:                buffer.append("/>");
0750:
0751:                this .appendWhitespace(buffer);
0752:            }
0753:
0754:            /* (non-Javadoc)
0755:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderIgnoredField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.IgnoredField)
0756:             */
0757:            public void renderIgnoredField(StringBuffer buffer, Map context,
0758:                    IgnoredField ignoredField) {
0759:                // do nothing, it's an ignored field; could add a comment or something if we wanted to
0760:            }
0761:
0762:            /* (non-Javadoc)
0763:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFieldTitle(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField)
0764:             */
0765:            public void renderFieldTitle(StringBuffer buffer, Map context,
0766:                    ModelFormField modelFormField) {
0767:                buffer.append("<span");
0768:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
0769:                    buffer.append(" class=\"");
0770:                    buffer.append(modelFormField.getTitleStyle());
0771:                    buffer.append("\"");
0772:                }
0773:                buffer.append(">");
0774:                buffer.append(modelFormField.getTitle(context));
0775:                buffer.append("</span>");
0776:
0777:                this .appendWhitespace(buffer);
0778:            }
0779:
0780:            /* (non-Javadoc)
0781:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0782:             */
0783:            public void renderFormOpen(StringBuffer buffer, Map context,
0784:                    ModelForm modelForm) {
0785:                buffer.append("<form method=\"POST\" ");
0786:                String targ = modelForm.getTarget(context);
0787:                if (targ != null && targ.length() > 0) {
0788:                    buffer.append(" action=\"");
0789:                    this .appendOfbizUrl(buffer, "/" + targ);
0790:                    buffer.append("\" ");
0791:                }
0792:
0793:                String formType = modelForm.getType();
0794:                if (formType.equals("upload")) {
0795:                    buffer.append(" enctype=\"multipart/form-data\"");
0796:                }
0797:
0798:                buffer.append(" name=\"");
0799:                buffer.append(modelForm.getCurrentFormName(context));
0800:                buffer.append("\" style=\"margin: 0;\">");
0801:
0802:                this .appendWhitespace(buffer);
0803:            }
0804:
0805:            /* (non-Javadoc)
0806:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0807:             */
0808:            public void renderFormClose(StringBuffer buffer, Map context,
0809:                    ModelForm modelForm) {
0810:                buffer.append("</form>");
0811:
0812:                this .appendWhitespace(buffer);
0813:            }
0814:
0815:            public void renderFormatListWrapperOpen(StringBuffer buffer,
0816:                    Map context, ModelForm modelForm) {
0817:                buffer
0818:                        .append("<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">");
0819:
0820:                this .appendWhitespace(buffer);
0821:            }
0822:
0823:            public void renderFormatListWrapperClose(StringBuffer buffer,
0824:                    Map context, ModelForm modelForm) {
0825:                buffer.append("</table>");
0826:
0827:                this .appendWhitespace(buffer);
0828:
0829:                this .renderNextPrev(buffer, context, modelForm);
0830:            }
0831:
0832:            /* (non-Javadoc)
0833:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0834:             */
0835:            public void renderFormatHeaderRowOpen(StringBuffer buffer,
0836:                    Map context, ModelForm modelForm) {
0837:                buffer.append("<tr>");
0838:
0839:                this .appendWhitespace(buffer);
0840:            }
0841:
0842:            /* (non-Javadoc)
0843:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0844:             */
0845:            public void renderFormatHeaderRowClose(StringBuffer buffer,
0846:                    Map context, ModelForm modelForm) {
0847:                buffer.append("</tr>");
0848:
0849:                this .appendWhitespace(buffer);
0850:            }
0851:
0852:            /* (non-Javadoc)
0853:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm, org.ofbiz.content.widget.form.ModelFormField)
0854:             */
0855:            public void renderFormatHeaderRowCellOpen(StringBuffer buffer,
0856:                    Map context, ModelForm modelForm,
0857:                    ModelFormField modelFormField) {
0858:                buffer.append("<td>");
0859:
0860:                this .appendWhitespace(buffer);
0861:            }
0862:
0863:            /* (non-Javadoc)
0864:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm, org.ofbiz.content.widget.form.ModelFormField)
0865:             */
0866:            public void renderFormatHeaderRowCellClose(StringBuffer buffer,
0867:                    Map context, ModelForm modelForm,
0868:                    ModelFormField modelFormField) {
0869:                buffer.append("</td>");
0870:
0871:                this .appendWhitespace(buffer);
0872:            }
0873:
0874:            public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer,
0875:                    Map context, ModelForm modelForm) {
0876:                buffer.append("<td align=\"center\">");
0877:
0878:                this .appendWhitespace(buffer);
0879:            }
0880:
0881:            /* (non-Javadoc)
0882:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0883:             */
0884:            public void renderFormatHeaderRowFormCellClose(StringBuffer buffer,
0885:                    Map context, ModelForm modelForm) {
0886:                buffer.append("</td>");
0887:
0888:                this .appendWhitespace(buffer);
0889:            }
0890:
0891:            /* (non-Javadoc)
0892:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellTitleSeparator(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm, boolean)
0893:             */
0894:            public void renderFormatHeaderRowFormCellTitleSeparator(
0895:                    StringBuffer buffer, Map context, ModelForm modelForm,
0896:                    ModelFormField modelFormField, boolean isLast) {
0897:                buffer.append("<span");
0898:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
0899:                    buffer.append(" class=\"");
0900:                    buffer.append(modelFormField.getTitleStyle());
0901:                    buffer.append("\"");
0902:                }
0903:                buffer.append(">");
0904:                if (isLast) {
0905:                    buffer.append(" - ");
0906:                } else {
0907:                    buffer.append(" - ");
0908:                }
0909:                buffer.append("</span>");
0910:            }
0911:
0912:            /* (non-Javadoc)
0913:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0914:             */
0915:            public void renderFormatItemRowOpen(StringBuffer buffer,
0916:                    Map context, ModelForm modelForm) {
0917:                buffer.append("<tr>");
0918:
0919:                this .appendWhitespace(buffer);
0920:            }
0921:
0922:            /* (non-Javadoc)
0923:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0924:             */
0925:            public void renderFormatItemRowClose(StringBuffer buffer,
0926:                    Map context, ModelForm modelForm) {
0927:                buffer.append("</tr>");
0928:
0929:                this .appendWhitespace(buffer);
0930:            }
0931:
0932:            /* (non-Javadoc)
0933:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm, org.ofbiz.content.widget.form.ModelFormField)
0934:             */
0935:            public void renderFormatItemRowCellOpen(StringBuffer buffer,
0936:                    Map context, ModelForm modelForm,
0937:                    ModelFormField modelFormField) {
0938:                buffer.append("<td>");
0939:
0940:                this .appendWhitespace(buffer);
0941:            }
0942:
0943:            /* (non-Javadoc)
0944:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm, org.ofbiz.content.widget.form.ModelFormField)
0945:             */
0946:            public void renderFormatItemRowCellClose(StringBuffer buffer,
0947:                    Map context, ModelForm modelForm,
0948:                    ModelFormField modelFormField) {
0949:                buffer.append("</td>");
0950:
0951:                this .appendWhitespace(buffer);
0952:            }
0953:
0954:            /* (non-Javadoc)
0955:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowFormCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0956:             */
0957:            public void renderFormatItemRowFormCellOpen(StringBuffer buffer,
0958:                    Map context, ModelForm modelForm) {
0959:                buffer.append("<td align=\"center\">");
0960:
0961:                this .appendWhitespace(buffer);
0962:            }
0963:
0964:            /* (non-Javadoc)
0965:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatItemRowFormCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0966:             */
0967:            public void renderFormatItemRowFormCellClose(StringBuffer buffer,
0968:                    Map context, ModelForm modelForm) {
0969:                buffer.append("</td>");
0970:
0971:                this .appendWhitespace(buffer);
0972:            }
0973:
0974:            public void renderFormatSingleWrapperOpen(StringBuffer buffer,
0975:                    Map context, ModelForm modelForm) {
0976:                buffer
0977:                        .append("<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">");
0978:
0979:                this .appendWhitespace(buffer);
0980:            }
0981:
0982:            public void renderFormatSingleWrapperClose(StringBuffer buffer,
0983:                    Map context, ModelForm modelForm) {
0984:                buffer.append("</table>");
0985:
0986:                this .appendWhitespace(buffer);
0987:            }
0988:
0989:            /* (non-Javadoc)
0990:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
0991:             */
0992:            public void renderFormatFieldRowOpen(StringBuffer buffer,
0993:                    Map context, ModelForm modelForm) {
0994:                buffer.append("<tr>");
0995:
0996:                this .appendWhitespace(buffer);
0997:            }
0998:
0999:            /* (non-Javadoc)
1000:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelForm)
1001:             */
1002:            public void renderFormatFieldRowClose(StringBuffer buffer,
1003:                    Map context, ModelForm modelForm) {
1004:                buffer.append("</tr>");
1005:
1006:                this .appendWhitespace(buffer);
1007:            }
1008:
1009:            /* (non-Javadoc)
1010:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField)
1011:             */
1012:            public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer,
1013:                    Map context, ModelFormField modelFormField) {
1014:                buffer.append("<td width=\"20%\" align=\"right\">");
1015:
1016:                this .appendWhitespace(buffer);
1017:            }
1018:
1019:            /* (non-Javadoc)
1020:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField)
1021:             */
1022:            public void renderFormatFieldRowTitleCellClose(StringBuffer buffer,
1023:                    Map context, ModelFormField modelFormField) {
1024:                buffer.append("</td>");
1025:
1026:                this .appendWhitespace(buffer);
1027:            }
1028:
1029:            /* (non-Javadoc)
1030:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowSpacerCell(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField)
1031:             */
1032:            public void renderFormatFieldRowSpacerCell(StringBuffer buffer,
1033:                    Map context, ModelFormField modelFormField) {
1034:                buffer.append("<td>&nbsp;</td>");
1035:
1036:                this .appendWhitespace(buffer);
1037:            }
1038:
1039:            /* (non-Javadoc)
1040:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowWidgetCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField, int)
1041:             */
1042:            public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer,
1043:                    Map context, ModelFormField modelFormField, int positions,
1044:                    int positionSpan, Integer nextPositionInRow) {
1045:                buffer.append("<td width=\"");
1046:                if (nextPositionInRow != null
1047:                        || modelFormField.getPosition() > 1) {
1048:                    buffer.append("30");
1049:                } else {
1050:                    buffer.append("80");
1051:                }
1052:                buffer.append("%\" align=\"left\"");
1053:                if (positionSpan > 0) {
1054:                    buffer.append(" colspan=\"");
1055:                    // do a span of 1 for this column, plus 3 columns for each spanned 
1056:                    //position or each blank position that this will be filling in 
1057:                    buffer.append(1 + (positionSpan * 3));
1058:                    buffer.append("\"");
1059:                }
1060:                buffer.append(">");
1061:
1062:                this .appendWhitespace(buffer);
1063:            }
1064:
1065:            /* (non-Javadoc)
1066:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFormatFieldRowWidgetCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField, int)
1067:             */
1068:            public void renderFormatFieldRowWidgetCellClose(
1069:                    StringBuffer buffer, Map context,
1070:                    ModelFormField modelFormField, int positions,
1071:                    int positionSpan, Integer nextPositionInRow) {
1072:                buffer.append("</td>");
1073:
1074:                this .appendWhitespace(buffer);
1075:            }
1076:
1077:            public void renderFormatEmptySpace(StringBuffer buffer,
1078:                    Map context, ModelForm modelForm) {
1079:                buffer.append("&nbsp;");
1080:            }
1081:
1082:            /* (non-Javadoc)
1083:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderTextFindField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.TextFindField)
1084:             */
1085:            public void renderTextFindField(StringBuffer buffer, Map context,
1086:                    TextFindField textFindField) {
1087:
1088:                ModelFormField modelFormField = textFindField
1089:                        .getModelFormField();
1090:                Locale locale = (Locale) context.get("locale");
1091:                String opEquals = UtilProperties.getMessage("conditional",
1092:                        "equals", locale);
1093:                String opBeginsWith = UtilProperties.getMessage("conditional",
1094:                        "begins_with", locale);
1095:                String opContains = UtilProperties.getMessage("conditional",
1096:                        "contains", locale);
1097:                String opIsEmpty = UtilProperties.getMessage("conditional",
1098:                        "is_empty", locale);
1099:
1100:                buffer.append("<input type=\"text\"");
1101:
1102:                String className = modelFormField.getWidgetStyle();
1103:                if (UtilValidate.isNotEmpty(className)) {
1104:                    buffer.append(" class=\"");
1105:                    buffer.append(className);
1106:                    buffer.append('"');
1107:                }
1108:
1109:                // add a style of red if this is a date/time field and redWhen is true
1110:                if (modelFormField.shouldBeRed(context)) {
1111:                    buffer.append(" style=\"color: red;\"");
1112:                }
1113:
1114:                buffer.append(" name=\"");
1115:                buffer.append(modelFormField.getParameterName(context));
1116:                buffer.append('"');
1117:
1118:                String value = modelFormField.getEntry(context);
1119:                if (UtilValidate.isNotEmpty(value)) {
1120:                    buffer.append(" value=\"");
1121:                    buffer.append(value);
1122:                    buffer.append('"');
1123:                }
1124:
1125:                buffer.append(" size=\"");
1126:                buffer.append(textFindField.getSize());
1127:                buffer.append('"');
1128:
1129:                Integer maxlength = textFindField.getMaxlength();
1130:                if (maxlength != null) {
1131:                    buffer.append(" maxlength=\"");
1132:                    buffer.append(maxlength.intValue());
1133:                    buffer.append('"');
1134:                }
1135:
1136:                buffer.append("/>");
1137:
1138:                buffer.append(" <span");
1139:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
1140:                    buffer.append(" class=\"");
1141:                    buffer.append(modelFormField.getTitleStyle());
1142:                    buffer.append('"');
1143:                }
1144:                buffer.append('>');
1145:                buffer
1146:                        .append(" " + opEquals
1147:                                + " <input type=\"radio\" name=\"");
1148:                buffer.append(modelFormField.getParameterName(context));
1149:                buffer.append("_op\" value=\"equals\" checked/>");
1150:
1151:                buffer.append(" " + opBeginsWith
1152:                        + " <input type=\"radio\" name=\"");
1153:                buffer.append(modelFormField.getParameterName(context));
1154:                buffer.append("_op\" value=\"like\"/>");
1155:
1156:                buffer.append(" " + opContains
1157:                        + " <input type=\"radio\" name=\"");
1158:                buffer.append(modelFormField.getParameterName(context));
1159:                buffer.append("_op\" value=\"contains\"/>");
1160:
1161:                buffer.append(" " + opIsEmpty
1162:                        + " <input type=\"radio\" name=\"");
1163:                buffer.append(modelFormField.getParameterName(context));
1164:                buffer.append("_op\" value=\"empty\"/>");
1165:                buffer.append("</span>");
1166:
1167:                this .appendTooltip(buffer, context, modelFormField);
1168:
1169:                this .appendWhitespace(buffer);
1170:            }
1171:
1172:            /* (non-Javadoc)
1173:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderRangeFindField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.RangeFindField)
1174:             */
1175:            public void renderRangeFindField(StringBuffer buffer, Map context,
1176:                    RangeFindField rangeFindField) {
1177:
1178:                ModelFormField modelFormField = rangeFindField
1179:                        .getModelFormField();
1180:                Locale locale = (Locale) context.get("locale");
1181:                String opEquals = UtilProperties.getMessage("conditional",
1182:                        "equals", locale);
1183:                String opGreaterThan = UtilProperties.getMessage("conditional",
1184:                        "greater_than", locale);
1185:                String opGreaterThanEquals = UtilProperties.getMessage(
1186:                        "conditional", "greater_than_equals", locale);
1187:                String opLessThan = UtilProperties.getMessage("conditional",
1188:                        "less_than", locale);
1189:                String opLessThanEquals = UtilProperties.getMessage(
1190:                        "conditional", "less_than_equals", locale);
1191:                String opIsEmpty = UtilProperties.getMessage("conditional",
1192:                        "is_empty", locale);
1193:
1194:                buffer.append("<input type=\"text\"");
1195:
1196:                String className = modelFormField.getWidgetStyle();
1197:                if (UtilValidate.isNotEmpty(className)) {
1198:                    buffer.append(" class=\"");
1199:                    buffer.append(className);
1200:                    buffer.append('"');
1201:                }
1202:
1203:                // add a style of red if this is a date/time field and redWhen is true
1204:                if (modelFormField.shouldBeRed(context)) {
1205:                    buffer.append(" style=\"color: red;\"");
1206:                }
1207:
1208:                buffer.append(" name=\"");
1209:                buffer.append(modelFormField.getParameterName(context));
1210:                buffer.append("_fld0_value\"");
1211:
1212:                String value = modelFormField.getEntry(context);
1213:                if (UtilValidate.isNotEmpty(value)) {
1214:                    buffer.append(" value=\"");
1215:                    buffer.append(value);
1216:                    buffer.append('"');
1217:                }
1218:
1219:                buffer.append(" size=\"");
1220:                buffer.append(rangeFindField.getSize());
1221:                buffer.append('"');
1222:
1223:                Integer maxlength = rangeFindField.getMaxlength();
1224:                if (maxlength != null) {
1225:                    buffer.append(" maxlength=\"");
1226:                    buffer.append(maxlength.intValue());
1227:                    buffer.append('"');
1228:                }
1229:
1230:                buffer.append("/>");
1231:
1232:                buffer.append(" <span");
1233:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
1234:                    buffer.append(" class=\"");
1235:                    buffer.append(modelFormField.getTitleStyle());
1236:                    buffer.append('"');
1237:                }
1238:                buffer.append('>');
1239:
1240:                buffer
1241:                        .append(" " + opEquals
1242:                                + " <input type=\"radio\" name=\"");
1243:                buffer.append(modelFormField.getParameterName(context));
1244:                buffer.append("_fld0_op\" value=\"equals\" checked/>");
1245:
1246:                buffer.append(" " + opGreaterThan
1247:                        + " <input type=\"radio\" name=\"");
1248:                buffer.append(modelFormField.getParameterName(context));
1249:                buffer.append("_fld0_op\" value=\"greaterThan\"/>");
1250:
1251:                buffer.append(" " + opGreaterThanEquals
1252:                        + " <input type=\"radio\" name=\"");
1253:                buffer.append(modelFormField.getParameterName(context));
1254:                buffer.append("_fld0_op\" value=\"greaterThanEqualTo\"/>");
1255:
1256:                buffer.append("</span>");
1257:
1258:                buffer.append(" <br/> ");
1259:
1260:                buffer.append("<input type=\"text\"");
1261:
1262:                className = modelFormField.getWidgetStyle();
1263:                if (UtilValidate.isNotEmpty(className)) {
1264:                    buffer.append(" class=\"");
1265:                    buffer.append(className);
1266:                    buffer.append('"');
1267:                }
1268:
1269:                // add a style of red if this is a date/time field and redWhen is true
1270:                if (modelFormField.shouldBeRed(context)) {
1271:                    buffer.append(" style=\"color: red;\"");
1272:                }
1273:
1274:                buffer.append(" name=\"");
1275:                buffer.append(modelFormField.getParameterName(context));
1276:                buffer.append("_fld1_value\"");
1277:
1278:                value = modelFormField.getEntry(context);
1279:                if (UtilValidate.isNotEmpty(value)) {
1280:                    buffer.append(" value=\"");
1281:                    buffer.append(value);
1282:                    buffer.append('"');
1283:                }
1284:
1285:                buffer.append(" size=\"");
1286:                buffer.append(rangeFindField.getSize());
1287:                buffer.append('"');
1288:
1289:                if (maxlength != null) {
1290:                    buffer.append(" maxlength=\"");
1291:                    buffer.append(maxlength.intValue());
1292:                    buffer.append('"');
1293:                }
1294:
1295:                buffer.append("/>");
1296:
1297:                buffer.append(" <span");
1298:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
1299:                    buffer.append(" class=\"");
1300:                    buffer.append(modelFormField.getTitleStyle());
1301:                    buffer.append('"');
1302:                }
1303:                buffer.append('>');
1304:
1305:                buffer.append(" " + opLessThan
1306:                        + " <input type=\"radio\" name=\"");
1307:                buffer.append(modelFormField.getParameterName(context));
1308:                buffer.append("_fld1_op\" value=\"lessThan\"/>");
1309:
1310:                buffer.append(" " + opLessThanEquals
1311:                        + " <input type=\"radio\" name=\"");
1312:                buffer.append(" Less than equals<input type=\"radio\" name=\"");
1313:                buffer.append(modelFormField.getParameterName(context));
1314:                buffer.append("_fld1_op\" value=\"lessThanEqualTo\"/>");
1315:
1316:                buffer.append(" " + opIsEmpty
1317:                        + " <input type=\"radio\" name=\"");
1318:                buffer.append(" Is Empty<input type=\"radio\" name=\"");
1319:                buffer.append(modelFormField.getParameterName(context));
1320:                buffer.append("_op\" value=\"empty\"/>");
1321:
1322:                buffer.append("</span>");
1323:
1324:                this .appendTooltip(buffer, context, modelFormField);
1325:
1326:                this .appendWhitespace(buffer);
1327:            }
1328:
1329:            /* (non-Javadoc)
1330:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderDateFindField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.DateFindField)
1331:             */
1332:            public void renderDateFindField(StringBuffer buffer, Map context,
1333:                    DateFindField dateFindField) {
1334:                ModelFormField modelFormField = dateFindField
1335:                        .getModelFormField();
1336:
1337:                Locale locale = (Locale) context.get("locale");
1338:                String opEquals = UtilProperties.getMessage("conditional",
1339:                        "equals", locale);
1340:                String opGreaterThan = UtilProperties.getMessage("conditional",
1341:                        "greater_than", locale);
1342:                String opSameDay = UtilProperties.getMessage("conditional",
1343:                        "same_day", locale);
1344:                String opGreaterThanFromDayStart = UtilProperties.getMessage(
1345:                        "conditional", "greater_than_from_day_start", locale);
1346:                String opLessThan = UtilProperties.getMessage("conditional",
1347:                        "less_than", locale);
1348:                String opUpToDay = UtilProperties.getMessage("conditional",
1349:                        "up_to_day", locale);
1350:                String opUpThruDay = UtilProperties.getMessage("conditional",
1351:                        "up_thru_day", locale);
1352:                String opIsEmpty = UtilProperties.getMessage("conditional",
1353:                        "is_empty", locale);
1354:
1355:                buffer.append("<input type=\"text\"");
1356:
1357:                String className = modelFormField.getWidgetStyle();
1358:                if (UtilValidate.isNotEmpty(className)) {
1359:                    buffer.append(" class=\"");
1360:                    buffer.append(className);
1361:                    buffer.append('"');
1362:                }
1363:
1364:                // add a style of red if this is a date/time field and redWhen is true
1365:                if (modelFormField.shouldBeRed(context)) {
1366:                    buffer.append(" style=\"color: red;\"");
1367:                }
1368:
1369:                buffer.append(" name=\"");
1370:                buffer.append(modelFormField.getParameterName(context));
1371:                buffer.append("_fld0_value\"");
1372:
1373:                String value = modelFormField.getEntry(context);
1374:                if (UtilValidate.isNotEmpty(value)) {
1375:                    buffer.append(" value=\"");
1376:                    buffer.append(value);
1377:                    buffer.append('"');
1378:                }
1379:
1380:                // the default values for a timestamp
1381:                int size = 25;
1382:                int maxlength = 30;
1383:
1384:                buffer.append(" size=\"");
1385:                buffer.append(size);
1386:                buffer.append('"');
1387:
1388:                buffer.append(" maxlength=\"");
1389:                buffer.append(maxlength);
1390:                buffer.append('"');
1391:
1392:                buffer.append("/>");
1393:
1394:                // add calendar pop-up button and seed data 
1395:                buffer.append("<a href=\"javascript:call_cal(document.");
1396:                buffer.append(modelFormField.getModelForm().getCurrentFormName(
1397:                        context));
1398:                buffer.append('.');
1399:                buffer.append(modelFormField.getParameterName(context));
1400:                buffer.append("_fld0_value, '");
1401:                buffer.append(modelFormField.getEntry(context, dateFindField
1402:                        .getDefaultDateTimeString(context)));
1403:                buffer.append("');\">");
1404:                buffer.append("<img src=\"");
1405:                this .appendContentUrl(buffer, "/images/cal.gif");
1406:                buffer
1407:                        .append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Calendar\"></a>");
1408:
1409:                buffer.append(" <span");
1410:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
1411:                    buffer.append(" class=\"");
1412:                    buffer.append(modelFormField.getTitleStyle());
1413:                    buffer.append('"');
1414:                }
1415:                buffer.append('>');
1416:
1417:                buffer
1418:                        .append(" " + opEquals
1419:                                + " <input type=\"radio\" name=\"");
1420:                buffer.append(modelFormField.getParameterName(context));
1421:                buffer.append("_fld0_op\" value=\"equals\" checked/>");
1422:
1423:                buffer.append(" " + opSameDay
1424:                        + " <input type=\"radio\" name=\"");
1425:                buffer.append(modelFormField.getParameterName(context));
1426:                buffer.append("_fld0_op\" value=\"sameDay\" checked/>");
1427:
1428:                buffer.append(" " + opGreaterThanFromDayStart
1429:                        + " <input type=\"radio\" name=\"");
1430:                buffer.append(modelFormField.getParameterName(context));
1431:                buffer.append("_fld0_op\" value=\"greaterThanFromDayStart\"/>");
1432:
1433:                buffer.append(" " + opGreaterThan
1434:                        + " <input type=\"radio\" name=\"");
1435:                buffer.append(modelFormField.getParameterName(context));
1436:                buffer.append("_fld0_op\" value=\"greaterThan\"/>");
1437:
1438:                buffer.append(" <span");
1439:
1440:                buffer.append(" <br/> ");
1441:
1442:                buffer.append("<input type=\"text\"");
1443:                className = modelFormField.getWidgetStyle();
1444:                if (UtilValidate.isNotEmpty(className)) {
1445:                    buffer.append(" class=\"");
1446:                    buffer.append(className);
1447:                    buffer.append('"');
1448:                }
1449:
1450:                // add a style of red if this is a date/time field and redWhen is true
1451:                if (modelFormField.shouldBeRed(context)) {
1452:                    buffer.append(" style=\"color: red;\"");
1453:                }
1454:
1455:                buffer.append(" name=\"");
1456:                buffer.append(modelFormField.getParameterName(context));
1457:                buffer.append("_fld1_value\"");
1458:
1459:                value = modelFormField.getEntry(context);
1460:                if (UtilValidate.isNotEmpty(value)) {
1461:                    buffer.append(" value=\"");
1462:                    buffer.append(value);
1463:                    buffer.append('"');
1464:                }
1465:
1466:                buffer.append(" size=\"");
1467:                buffer.append(size);
1468:                buffer.append('"');
1469:
1470:                buffer.append(" maxlength=\"");
1471:                buffer.append(maxlength);
1472:                buffer.append('"');
1473:
1474:                buffer.append("/>");
1475:
1476:                // add calendar pop-up button and seed data 
1477:                buffer.append("<a href=\"javascript:call_cal(document.");
1478:                buffer.append(modelFormField.getModelForm().getCurrentFormName(
1479:                        context));
1480:                buffer.append('.');
1481:                buffer.append(modelFormField.getParameterName(context));
1482:                buffer.append("_fld1_value, '");
1483:                buffer.append(modelFormField.getEntry(context, dateFindField
1484:                        .getDefaultDateTimeString(context)));
1485:                buffer.append("');\">");
1486:                buffer.append("<img src=\"");
1487:                this .appendContentUrl(buffer, "/images/cal.gif");
1488:                buffer
1489:                        .append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Calendar\"></a>");
1490:
1491:                buffer.append(" <span");
1492:                if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) {
1493:                    buffer.append(" class=\"");
1494:                    buffer.append(modelFormField.getTitleStyle());
1495:                    buffer.append('"');
1496:                }
1497:                buffer.append('>');
1498:
1499:                buffer.append(" " + opLessThan
1500:                        + " <input type=\"radio\" name=\"");
1501:                buffer.append(modelFormField.getParameterName(context));
1502:                buffer.append("_fld1_op\" value=\"lessThan\"/>");
1503:
1504:                buffer.append(" " + opUpToDay
1505:                        + " <input type=\"radio\" name=\"");
1506:                buffer.append(modelFormField.getParameterName(context));
1507:                buffer.append("_fld1_op\" value=\"upToDay\"/>");
1508:
1509:                buffer.append(" " + opUpThruDay
1510:                        + " <input type=\"radio\" name=\"");
1511:                buffer.append(modelFormField.getParameterName(context));
1512:                buffer.append("_fld1_op\" value=\"upThruDay\"/>");
1513:
1514:                buffer.append(" " + opIsEmpty
1515:                        + " <input type=\"radio\" name=\"");
1516:                buffer.append(modelFormField.getParameterName(context));
1517:                buffer.append("_op\" value=\"empty\"/>");
1518:
1519:                buffer.append("</span>");
1520:
1521:                this .appendTooltip(buffer, context, modelFormField);
1522:
1523:                this .appendWhitespace(buffer);
1524:            }
1525:
1526:            /* (non-Javadoc)
1527:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderLookupField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.LookupField)
1528:             */
1529:            public void renderLookupField(StringBuffer buffer, Map context,
1530:                    LookupField lookupField) {
1531:                ModelFormField modelFormField = lookupField.getModelFormField();
1532:
1533:                buffer.append("<input type=\"text\"");
1534:
1535:                String className = modelFormField.getWidgetStyle();
1536:                if (UtilValidate.isNotEmpty(className)) {
1537:                    buffer.append(" class=\"");
1538:                    buffer.append(className);
1539:                    buffer.append('"');
1540:                }
1541:
1542:                // add a style of red if this is a date/time field and redWhen is true
1543:                if (modelFormField.shouldBeRed(context)) {
1544:                    buffer.append(" style=\"color: red;\"");
1545:                }
1546:
1547:                buffer.append(" name=\"");
1548:                buffer.append(modelFormField.getParameterName(context));
1549:                buffer.append('"');
1550:
1551:                String value = modelFormField.getEntry(context);
1552:                if (UtilValidate.isNotEmpty(value)) {
1553:                    buffer.append(" value=\"");
1554:                    buffer.append(value);
1555:                    buffer.append('"');
1556:                }
1557:
1558:                buffer.append(" size=\"");
1559:                buffer.append(lookupField.getSize());
1560:                buffer.append('"');
1561:
1562:                Integer maxlength = lookupField.getMaxlength();
1563:                if (maxlength != null) {
1564:                    buffer.append(" maxlength=\"");
1565:                    buffer.append(maxlength.intValue());
1566:                    buffer.append('"');
1567:                }
1568:
1569:                buffer.append("/>");
1570:
1571:                // add lookup pop-up button 
1572:                buffer
1573:                        .append("<a href=\"javascript:call_fieldlookup2(document.");
1574:                buffer.append(modelFormField.getModelForm().getCurrentFormName(
1575:                        context));
1576:                buffer.append('.');
1577:                buffer.append(modelFormField.getParameterName(context));
1578:                buffer.append(", '");
1579:                buffer.append(lookupField.getFormName());
1580:                buffer.append("');\">");
1581:                buffer.append("<img src=\"");
1582:                this .appendContentUrl(buffer, "/images/fieldlookup.gif");
1583:                buffer
1584:                        .append("\" width=\"16\" height=\"16\" border=\"0\" alt=\"Lookup\"></a>");
1585:
1586:                this .makeHyperlinkString(buffer, lookupField.getSubHyperlink(),
1587:                        context);
1588:                this .appendTooltip(buffer, context, modelFormField);
1589:
1590:                this .appendWhitespace(buffer);
1591:            }
1592:
1593:            public void renderNextPrev(StringBuffer buffer, Map context,
1594:                    ModelForm modelForm) {
1595:                String targetService = modelForm.getPaginateTarget();
1596:                if (targetService == null) {
1597:                    targetService = "${targetService}";
1598:                }
1599:
1600:                int viewIndex = -1;
1601:                try {
1602:                    viewIndex = ((Integer) context.get("viewIndex")).intValue();
1603:                } catch (Exception e) {
1604:                    viewIndex = 0;
1605:                }
1606:
1607:                int viewSize = -1;
1608:                try {
1609:                    viewSize = ((Integer) context.get("viewSize")).intValue();
1610:                } catch (Exception e) {
1611:                    viewSize = 0;
1612:                }
1613:
1614:                int listSize = -1;
1615:                try {
1616:                    listSize = ((Integer) context.get("listSize")).intValue();
1617:                } catch (Exception e) {
1618:                    listSize = 0;
1619:                }
1620:
1621:                int highIndex = -1;
1622:                try {
1623:                    highIndex = ((Integer) context.get("highIndex")).intValue();
1624:                } catch (Exception e) {
1625:                    highIndex = 0;
1626:                }
1627:
1628:                int lowIndex = -1;
1629:                try {
1630:                    lowIndex = ((Integer) context.get("lowIndex")).intValue();
1631:                } catch (Exception e) {
1632:                    lowIndex = 0;
1633:                }
1634:
1635:                String queryString = (String) context.get("queryString");
1636:
1637:                ServletContext ctx = (ServletContext) request
1638:                        .getAttribute("servletContext");
1639:                RequestHandler rh = (RequestHandler) ctx
1640:                        .getAttribute("_REQUEST_HANDLER_");
1641:
1642:                buffer
1643:                        .append("<table border=\"0\" width=\"100%\" cellpadding=\"2\">\n");
1644:                buffer.append("  <tr>\n");
1645:                buffer.append("    <td align=right>\n");
1646:                buffer.append("      <b>\n");
1647:                if (viewIndex > 0) {
1648:                    buffer.append(" <a href=\"");
1649:                    String linkText = targetService + "?" + queryString
1650:                            + "&VIEW_SIZE=" + viewSize + "&VIEW_INDEX="
1651:                            + (viewIndex - 1) + "\"";
1652:                    // make the link
1653:                    buffer.append(rh.makeLink(request, response, linkText,
1654:                            false, false, false));
1655:                    buffer.append(" class=\"buttontext\">[Previous]</a>\n");
1656:
1657:                }
1658:                if (listSize > 0) {
1659:                    buffer.append("          <span class=\"tabletext\">"
1660:                            + lowIndex + " - " + highIndex + " of " + listSize
1661:                            + "</span> \n");
1662:                }
1663:                if (highIndex < listSize) {
1664:                    buffer.append(" <a href=\"");
1665:                    String linkText = "" + targetService + "?" + queryString
1666:                            + "&VIEW_SIZE=" + viewSize + "&VIEW_INDEX="
1667:                            + (viewIndex + 1) + "\"";
1668:
1669:                    // make the link
1670:                    buffer.append(rh.makeLink(request, response, linkText,
1671:                            false, false, false));
1672:                    buffer.append(" class=\"buttontext\">[Next]</a>\n");
1673:
1674:                }
1675:                buffer.append("      </b>\n");
1676:                buffer.append("    </td>\n");
1677:                buffer.append("  </tr>\n");
1678:                buffer.append("</table>\n");
1679:
1680:                this .appendWhitespace(buffer);
1681:            }
1682:
1683:            /* (non-Javadoc)
1684:             * @see org.ofbiz.content.widget.form.FormStringRenderer#renderFileField(java.lang.StringBuffer, java.util.Map, org.ofbiz.content.widget.form.ModelFormField.FileField)
1685:             */
1686:            public void renderFileField(StringBuffer buffer, Map context,
1687:                    FileField textField) {
1688:                ModelFormField modelFormField = textField.getModelFormField();
1689:
1690:                buffer.append("<input type=\"file\"");
1691:
1692:                String className = modelFormField.getWidgetStyle();
1693:                if (UtilValidate.isNotEmpty(className)) {
1694:                    buffer.append(" class=\"");
1695:                    buffer.append(className);
1696:                    buffer.append('"');
1697:                }
1698:
1699:                // add a style of red if this is a date/time field and redWhen is true
1700:                if (modelFormField.shouldBeRed(context)) {
1701:                    buffer.append(" style=\"color: red;\"");
1702:                }
1703:
1704:                buffer.append(" name=\"");
1705:                buffer.append(modelFormField.getParameterName(context));
1706:                buffer.append('"');
1707:
1708:                String value = modelFormField.getEntry(context, textField
1709:                        .getDefaultValue(context));
1710:                if (UtilValidate.isNotEmpty(value)) {
1711:                    buffer.append(" value=\"");
1712:                    buffer.append(value);
1713:                    buffer.append('"');
1714:                }
1715:
1716:                buffer.append(" size=\"");
1717:                buffer.append(textField.getSize());
1718:                buffer.append('"');
1719:
1720:                Integer maxlength = textField.getMaxlength();
1721:                if (maxlength != null) {
1722:                    buffer.append(" maxlength=\"");
1723:                    buffer.append(maxlength.intValue());
1724:                    buffer.append('"');
1725:                }
1726:
1727:                buffer.append("/>");
1728:
1729:                this.makeHyperlinkString(buffer, textField.getSubHyperlink(),
1730:                        context);
1731:
1732:                this.appendTooltip(buffer, context, modelFormField);
1733:
1734:                this.appendWhitespace(buffer);
1735:            }
1736:
1737:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.