Source Code Cross Referenced for UIWebScreenSection.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » ui » 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 » com.sourcetap.sfa.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * 
0003:         * Copyright (c) 2004 SourceTap - www.sourcetap.com
0004:         *
0005:         *  The contents of this file are subject to the SourceTap Public License 
0006:         * ("License"); You may not use this file except in compliance with the 
0007:         * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
0008:         * Software distributed under the License is distributed on an  "AS IS"  basis,
0009:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
0010:         * the specific language governing rights and limitations under the License.
0011:         *
0012:         * The above copyright notice and this permission notice shall be included
0013:         * in all copies or substantial portions of the Software.
0014:         *
0015:         */
0016:
0017:        package com.sourcetap.sfa.ui;
0018:
0019:        import java.text.DateFormat;
0020:        import java.text.DecimalFormat;
0021:        import java.text.NumberFormat;
0022:        import java.text.ParsePosition;
0023:        import java.text.SimpleDateFormat;
0024:        import java.util.ArrayList;
0025:        import java.util.Date;
0026:        import java.util.HashMap;
0027:        import java.util.Iterator;
0028:        import java.util.List;
0029:        import java.util.Map;
0030:        import java.util.Vector;
0031:
0032:        import org.ofbiz.base.util.Debug;
0033:        import org.ofbiz.base.util.UtilFormatOut;
0034:        import org.ofbiz.base.util.UtilMisc;
0035:        import org.ofbiz.base.util.UtilTimer;
0036:        import org.ofbiz.entity.GenericDelegator;
0037:        import org.ofbiz.entity.GenericEntityException;
0038:        import org.ofbiz.entity.GenericPK;
0039:        import org.ofbiz.entity.GenericValue;
0040:
0041:        import com.sourcetap.sfa.event.DataMatrix;
0042:        import com.sourcetap.sfa.util.Preference;
0043:        import com.sourcetap.sfa.util.StringHelper;
0044:        import com.sourcetap.sfa.util.UserInfo;
0045:
0046:        /**
0047:         * DOCUMENT ME!
0048:         *
0049:         */
0050:        public class UIWebScreenSection extends UIScreenSection {
0051:            public static final String module = UIWebScreenSection.class
0052:                    .getName();
0053:
0054:            private static final boolean WEB_DEBUG = false;
0055:            private static final boolean TIMER = false;
0056:            protected final String IMAGE_COPY = "/sfaimages/Copy24.gif";
0057:            protected final String IMAGE_DELETE = "/sfaimages/Delete24.gif";
0058:            protected final String IMAGE_EDIT = "/sfaimages/Edit24.gif";
0059:            protected final String IMAGE_FIND = "/sfaimages/Find24.gif";
0060:            protected final String IMAGE_NEW = "/sfaimages/New24.gif";
0061:            protected final String IMAGE_OPEN = "/sfaimages/Open24.gif";
0062:            protected final String IMAGE_PRINT = "/sfaimages/Print24.gif";
0063:            protected final String IMAGE_PROPERTIES = "/sfaimages/Properties24.gif";
0064:            protected final String IMAGE_SAVE = "/sfaimages/Save24.gif";
0065:            protected final String IMAGE_SEARCH = "/sfaimages/Search24.gif";
0066:            protected final String IMAGE_SELECT = "/sfaimages/Refresh24.gif";
0067:            protected final String IMAGE_STOP = "/sfaimages/Stop24.gif";
0068:            protected final String IMAGE_ZOOM = "/sfaimages/Zoom24.gif";
0069:            protected final String IMAGE_ZOOM_SELECTED = "/sfaimages/Zoom24Selected.gif";
0070:            protected final String IMAGE_COPY_DISABLED = "/sfaimages/Copy24Disabled.gif";
0071:            protected final String IMAGE_DELETE_DISABLED = "/sfaimages/Delete24Disabled.gif";
0072:            protected final String IMAGE_EDIT_DISABLED = "/sfaimages/Edit24Disabled.gif";
0073:            protected final String IMAGE_FIND_DISABLED = "/sfaimages/Find24Disabled.gif";
0074:            protected final String IMAGE_NEW_DISABLED = "/sfaimages/New24Disabled.gif";
0075:            protected final String IMAGE_OPEN_DISABLED = "/sfaimages/Open24Disabled.gif";
0076:            protected final String IMAGE_PRINT_DISABLED = "/sfaimages/Print24Disabled.gif";
0077:            protected final String IMAGE_PROPERTIES_DISABLED = "/sfaimages/Properties24Disabled.gif";
0078:            protected final String IMAGE_SAVE_DISABLED = "/sfaimages/Save24Disabled.gif";
0079:            protected final String IMAGE_SEARCH_DISABLED = "/sfaimages/Search24Disabled.gif";
0080:            protected final String IMAGE_SELECT_DISABLED = "/sfaimages/Refresh24Disabled.gif";
0081:            protected final String IMAGE_STOP_DISABLED = "/sfaimages/Stop24Disabled.gif";
0082:            protected final String IMAGE_ZOOM_DISABLED = "/sfaimages/Zoom24Disabled.gif";
0083:            //    protected final int FREE_FORM_ROW_HEIGHT = 16;
0084:            //    protected final int FREE_FORM2_ROW_HEIGHT = 16;
0085:
0086:            // used for handling large result sets.  start and end row can be set prior to calling display in order to handle
0087:            // paging of data.
0088:            protected int firstVisibleRow = 0;
0089:            protected boolean hasPriorPage = false;
0090:            protected boolean hasNextPage = false;
0091:            protected int priorPageStartRow = 0;
0092:            protected int nextPageStartRow = 0;
0093:            protected int totalRows = 0;
0094:
0095:            protected String queryMode = "standard";
0096:
0097:            public UIWebScreenSection(UserInfo userInfo, String screenName,
0098:                    String sectionName, GenericDelegator delegator,
0099:                    UICache uiCache) throws GenericEntityException {
0100:                super (userInfo, screenName, sectionName, delegator, uiCache);
0101:            }
0102:
0103:            /**
0104:             * DOCUMENT ME!
0105:             *
0106:             * @param rows 
0107:             */
0108:            public void setTotalRows(int rows) {
0109:                totalRows = rows;
0110:            }
0111:
0112:            /**
0113:             * DOCUMENT ME!
0114:             *
0115:             * @param dataMatrix 
0116:             * @param action 
0117:             * @param sectionTitle 
0118:             * @param isSubsection 
0119:             * @param tabOffset 
0120:             *
0121:             * @return 
0122:             *
0123:             * @throws GenericEntityException 
0124:             */
0125:            public String displayFreeFormSection(DataMatrix dataMatrix,
0126:                    String action, String sectionTitle, boolean isSubsection,
0127:                    int tabOffset) throws GenericEntityException {
0128:                UtilTimer timer = new UtilTimer();
0129:
0130:                if (TIMER) {
0131:                    timer
0132:                            .timerString(1,
0133:                                    "[UIWebScreenSection.displayFreeFormSection] Start");
0134:                }
0135:
0136:                Debug.logVerbose("[displayFreeFormSection] Start", module);
0137:
0138:                Vector entityDetailsVector = dataMatrix.getCurrentBuffer()
0139:                        .getContentsRow(0);
0140:                GenericValue primaryEntityDetails = dataMatrix
0141:                        .getCurrentBuffer().getGenericValue(0, 0);
0142:
0143:                Debug.logVerbose(
0144:                        "[displayFreeFormSection()] Primary entity name: "
0145:                                + primaryEntityDetails.getEntityName(), module);
0146:
0147:                StringBuffer displayHtml = new StringBuffer(5000);
0148:
0149:                // Get the key values so the form can pass them to the next page for the 4 buttons.
0150:                String keyParams = UIWebUtility.getHiddenArgs(
0151:                        getButtonKeyMap(), entityDetailsVector, "       ");
0152:
0153:                // Get the extra query parameters so the form can pass them to the next page.
0154:                String sendQueryParams = UIWebUtility.getHiddenArgs(
0155:                        getSendQueryParameterValueMap(), "       ");
0156:
0157:                Debug.logVerbose("[displayFreeFormSection] sendQueryParams: "
0158:                        + sendQueryParams, module);
0159:
0160:                String keyUrlArgs = UIWebUtility.getUrlArgs(getButtonKeyMap(),
0161:                        entityDetailsVector);
0162:                String queryUrlArgs = UIWebUtility.getUrlArgs(
0163:                        getSendQueryParameterMap(), entityDetailsVector);
0164:
0165:                // Append script to refresh the list or detail section when this free form section is saved.
0166:                if (!getDetailButtonTarget().equals("")
0167:                        && !isSubsection
0168:                        && (action.equals(ACTION_UPDATE)
0169:                                || action.equals(ACTION_INSERT) || action
0170:                                .equals(ACTION_DELETE))) {
0171:                    displayHtml
0172:                            .append("<SCRIPT FOR=\"window\" EVENT=\"onload\" LANGUAGE=\"JavaScript\">\n");
0173:
0174:                    if (WEB_DEBUG) {
0175:                        displayHtml
0176:                                .append("  alert('parent."
0177:                                        + getDetailButtonTarget()
0178:                                        + ".location.href = ' + parent."
0179:                                        + getDetailButtonTarget()
0180:                                        + ".location.href)\n");
0181:                    }
0182:
0183:                    displayHtml.append("  if (parent."
0184:                            + getDetailButtonTarget()
0185:                            + ".location.href.indexOf('"
0186:                            + getDetailButtonAction().substring(13)
0187:                            + "') > 0) {\n");
0188:                    displayHtml
0189:                            .append("   // This is the detail section of the current screen section.  Refresh it with new arguments.\n");
0190:
0191:                    if (WEB_DEBUG) {
0192:                        displayHtml
0193:                                .append("   alert('Reloading related section using HREF: "
0194:                                        + getDetailButtonAction()
0195:                                        + "?x="
0196:                                        + keyUrlArgs + queryUrlArgs + "');\n");
0197:                    }
0198:
0199:                    displayHtml.append("   parent." + getDetailButtonTarget()
0200:                            + ".location.href = \"" + getDetailButtonAction()
0201:                            + "?x=" + keyUrlArgs + queryUrlArgs + "\";\n");
0202:                    displayHtml.append("  } else {\n");
0203:                    displayHtml
0204:                            .append("   // This is a list section.  Refresh it with same arguments used last time.\n");
0205:
0206:                    if (WEB_DEBUG) {
0207:                        displayHtml
0208:                                .append("   alert('Reloading related section using HREF: ' + parent."
0209:                                        + getDetailButtonTarget()
0210:                                        + ".location.href);\n");
0211:                    }
0212:
0213:                    displayHtml.append("   parent." + getDetailButtonTarget()
0214:                            + ".location.href = parent."
0215:                            + getDetailButtonTarget() + ".location.href;\n");
0216:                    displayHtml.append("  }\n");
0217:                    displayHtml.append("</SCRIPT>\n");
0218:                }
0219:
0220:                // Insert the preSubmit function to prevent the onBeforeUnload popup window from being displayed
0221:                // if the Save button was just clicked.
0222:                if (getIsUpdateable()) {
0223:                    displayHtml.append("<SCRIPT LANGUAGE=\"JavaScript\">\n");
0224:                    displayHtml.append(" function preSubmit" + getSectionName()
0225:                            + "() {\n");
0226:                    displayHtml
0227:                            .append("  // Prevent the onBeforeUnload popup window\n");
0228:                    displayHtml.append("  window.onbeforeunload = null;\n");
0229:                    displayHtml.append("  return false;\n");
0230:                    displayHtml.append(" }\n");
0231:                    displayHtml.append("</SCRIPT>\n");
0232:                }
0233:
0234:                displayHtml
0235:                        .append("   <TABLE WIDTH=\"100%\" CLASS=\"freeFormSectionTitleTable\">\n");
0236:                displayHtml.append("    <TR>\n");
0237:
0238:                String titleTdName = getSectionName() + "TitleTD";
0239:                displayHtml.append("     <TD NAME=\"" + titleTdName
0240:                        + "\" ID=\"" + titleTdName + "\">\n");
0241:                displayHtml.append(sectionTitle + "\n");
0242:                displayHtml.append("     </TD>\n");
0243:                displayHtml.append("     <TD ALIGN=\"right\">\n");
0244:                displayHtml.append("      <TABLE>\n");
0245:                displayHtml.append("       <TR>\n");
0246:                displayHtml.append("\n");
0247:
0248:                if (!isSubsection) {
0249:                    // Buttons with configurable targets.
0250:                    // Don't send query parameters when the new button is clicked from a free-form tab. This will
0251:                    // prevent fields from be initialized to the same as the current record.
0252:                    displayHtml.append(displayNewButton("", action));
0253:                    displayHtml.append(displayEditButton(action, keyParams,
0254:                            sendQueryParams, ACTION_BUTTON));
0255:                    displayHtml.append(displayDetailButton(keyParams,
0256:                            sendQueryParams, action));
0257:
0258:                    // Buttons with same target as current window.
0259:                    displayHtml.append("     <TD>\n");
0260:                    displayHtml.append("      <FORM NAME=\"" + getSectionName()
0261:                            + "FormButton\" METHOD=\"post\"" + " ACTION=\""
0262:                            + getButtonAction() + "\"");
0263:
0264:                    if ((getButtonTarget() != null)
0265:                            && !getButtonTarget().equals("")) {
0266:                        displayHtml.append(" TARGET=\"" + getButtonTarget()
0267:                                + "\"");
0268:                    }
0269:
0270:                    displayHtml.append(">\n");
0271:                    displayHtml.append(keyParams);
0272:                    displayHtml.append(sendQueryParams);
0273:                    displayHtml
0274:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
0275:                                    + ACTION_BUTTON + "\">\n");
0276:
0277:                    displayHtml.append(displayQueryButton(action));
0278:                    displayHtml.append(displayDeleteButton(action));
0279:                    displayHtml.append(displayCopyButton(action));
0280:                    displayHtml.append(displayPrintButton(action));
0281:                    displayHtml.append("      </FORM>\n");
0282:                    displayHtml.append("     </TD>\n");
0283:                    displayHtml.append("\n");
0284:
0285:                    displayHtml.append(displayCustomizeButton());
0286:                }
0287:
0288:                displayHtml.append("       </TR>\n");
0289:                displayHtml.append("      </TABLE>\n");
0290:                displayHtml.append("     </TD>\n");
0291:                displayHtml.append("    </TR>\n");
0292:                displayHtml.append("   </TABLE>\n");
0293:                displayHtml.append("\n");
0294:
0295:                if (TIMER) {
0296:                    timer
0297:                            .timerString(1,
0298:                                    "[UIWebScreenSection.displayFreeFormSection] Finished title bar");
0299:                }
0300:
0301:                displayHtml
0302:                        .append("   <TABLE CLASS=\"freeFormSectionDisplayTable\" ");
0303:
0304:                if (!isSubsection) {
0305:                    //            displayHtml.append("HEIGHT=\"100%\"");
0306:                }
0307:
0308:                displayHtml.append(">\n");
0309:
0310:                if (!isSubsection) {
0311:                    boolean isMultiPart = false;
0312:
0313:                    for (int fieldNbr = 0; fieldNbr < getUiFieldList().size(); fieldNbr++) {
0314:                        UIFieldInfo fieldInfo = getUiField(fieldNbr);
0315:                        UIDisplayObject uiDisplayObject = fieldInfo
0316:                                .getUiDisplayObject();
0317:
0318:                        if (uiDisplayObject.getDisplayTypeId().equals(
0319:                                UIDisplayObject.DISPLAY_TYPE_FILE)) {
0320:                            isMultiPart = true;
0321:
0322:                            break;
0323:                        }
0324:                    }
0325:
0326:                    displayHtml.append("    <FORM METHOD=\"post\" NAME=\""
0327:                            + getSectionName() + "Form\""
0328:                            + " onSubmit=\"preSubmit" + getSectionName()
0329:                            + "()\"");
0330:
0331:                    if (action.equals(ACTION_SHOW_QUERY)
0332:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
0333:                            || action.equals(ACTION_SHOW_REPORT)) {
0334:                        Debug.logVerbose(
0335:                                "[displayFreeFormSection] search action: "
0336:                                        + getSearchAction(), module);
0337:
0338:                        Debug.logVerbose(
0339:                                "[displayFreeFormSection] search target: "
0340:                                        + getSearchTarget(), module);
0341:
0342:                        displayHtml.append(" ACTION=\"" + getSearchAction()
0343:                                + "\"");
0344:
0345:                        if ((getSearchTarget() != null)
0346:                                && !getSearchTarget().equals("")) {
0347:                            displayHtml.append(" TARGET=\"" + getSearchTarget()
0348:                                    + "\"");
0349:                        }
0350:                    } else {
0351:                        displayHtml.append(" ACTION=\"" + getButtonAction()
0352:                                + "\"");
0353:
0354:                        if ((getButtonTarget() != null)
0355:                                && !getButtonTarget().equals("")) {
0356:                            displayHtml.append(" TARGET=\"" + getButtonTarget()
0357:                                    + "\"");
0358:                        }
0359:                    }
0360:
0361:                    if (isMultiPart) {
0362:                        displayHtml.append(" enctype=\"multipart/form-data\"");
0363:                    }
0364:
0365:                    displayHtml.append(">\n");
0366:                }
0367:
0368:                displayHtml
0369:                        .append("     <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
0370:                                + getNextAction(action) + "\">\n");
0371:                displayHtml
0372:                        .append("     <INPUT TYPE=\"hidden\" NAME=\"rowCount\" VALUE=\"1\">\n");
0373:                displayHtml.append(sendQueryParams);
0374:
0375:                int htmlColumnCount = 0;
0376:                int htmlRowCount = 0;
0377:                ArrayList requiredFields = new ArrayList();
0378:
0379:                if (action.equals(ACTION_SHOW_QUERY)
0380:                        && getQueryMode().equals("advanced")) {
0381:                    int fieldListSize = getUiFieldList().size();
0382:
0383:                    StringBuffer fieldNameOptions = new StringBuffer(200);
0384:                    fieldNameOptions.append("<option value=''></option>");
0385:                    for (int fieldNbr = 0; fieldNbr < fieldListSize; fieldNbr++) {
0386:                        UIFieldInfo fieldInfo = getUiField(fieldNbr);
0387:                        if (fieldInfo.getIsSearchable()) {
0388:                            String htmlName = UIWebUtility.getHtmlName(
0389:                                    getSectionName(), fieldInfo, 0);
0390:                            String displayObjectId = fieldInfo
0391:                                    .getDisplayObjectId();
0392:                            String displayTypeId = fieldInfo
0393:                                    .getUiDisplayObject().getDisplayTypeId();
0394:                            String attributeId = fieldInfo.getAttributeId();
0395:                            String optValue = htmlName + ";" + attributeId
0396:                                    + ";" + displayTypeId + ";"
0397:                                    + displayObjectId;
0398:                            fieldNameOptions
0399:                                    .append("<option value='" + optValue + "'>"
0400:                                            + fieldInfo.getDisplayLabel()
0401:                                            + "</option>");
0402:                        }
0403:
0404:                    }
0405:
0406:                    List extendedFields = getRelatedSectionQueryFields();
0407:                    if (extendedFields != null) {
0408:                        int numFields = extendedFields.size();
0409:                        for (int i = 0; i < numFields; i++) {
0410:                            GenericValue fieldInfo = (GenericValue) extendedFields
0411:                                    .get(i);
0412:                            String entityName = fieldInfo
0413:                                    .getString("entityName");
0414:                            String attributeId = fieldInfo
0415:                                    .getString("attributeId");
0416:                            String attributeName = fieldInfo
0417:                                    .getString("attributeName");
0418:                            String displayObjectId = fieldInfo
0419:                                    .getString("displayObjectId");
0420:                            String displayTypeId = fieldInfo
0421:                                    .getString("displayTypeId");
0422:                            String sectionName = fieldInfo
0423:                                    .getString("sectionName");
0424:                            String sectionDescription = fieldInfo
0425:                                    .getString("sectionDescription");
0426:                            String displayLabel = fieldInfo
0427:                                    .getString("displayLabel");
0428:                            String htmlName = UIWebUtility.getHtmlName(
0429:                                    sectionName, entityName, attributeName, 0);
0430:                            String optValue = htmlName + ";" + attributeId
0431:                                    + ";" + displayTypeId + ";"
0432:                                    + displayObjectId;
0433:                            displayLabel = sectionDescription + "."
0434:                                    + displayLabel;
0435:                            fieldNameOptions.append("<option value='"
0436:                                    + optValue + "'>" + displayLabel
0437:                                    + "</option>");
0438:                        }
0439:                    }
0440:
0441:                    StringBuffer conditionOptions = new StringBuffer(100);
0442:                    conditionOptions
0443:                            .append("<option value='startsWith'>STARTS WITH</option>");
0444:                    conditionOptions
0445:                            .append("<option value='equals'>=</option>");
0446:                    conditionOptions
0447:                            .append("<option value='like'>CONTAINS</option>");
0448:                    conditionOptions
0449:                            .append("<option value='endsWith'>ENDS WITH</option>");
0450:                    conditionOptions
0451:                            .append("<option value='equals'>=</option>");
0452:                    conditionOptions
0453:                            .append("<option value='notEqual'>NOT EQUAL</option>");
0454:                    conditionOptions
0455:                            .append("<option value='lessThan'>&lt;</option>");
0456:                    conditionOptions
0457:                            .append("<option value='greaterThan'>&gt;</option>");
0458:                    conditionOptions
0459:                            .append("<option value='lessThanEqualTo'>&lt;=</option>");
0460:                    conditionOptions
0461:                            .append("<option value='greaterThanEqualTo'>&gt;=</option>");
0462:                    conditionOptions.append("<option value='in'>IN</option>");
0463:                    conditionOptions
0464:                            .append("<option value='not-in'>NOT IN</option>");
0465:                    conditionOptions
0466:                            .append("<option value='between'>BETWEEN</option>");
0467:
0468:                    displayHtml
0469:                            .append("<table id='queryListTable' border=1>\n");
0470:                    displayHtml
0471:                            .append("<tr><td>Field</td><td>Condition</td><td>Value</td><td>Action</td></tr>\n");
0472:
0473:                    // default show 4 rows
0474:                    for (int i = 1; i < 5; i++) {
0475:                        displayHtml.append("<tr id=queryListRow" + i
0476:                                + "><td><select name=queryListField" + i + ">"
0477:                                + fieldNameOptions.toString()
0478:                                + "</select></td>\n");
0479:                        displayHtml
0480:                                .append("	<td><select name=queryListOperator"
0481:                                        + i + ">" + conditionOptions.toString()
0482:                                        + "</select></td>\n");
0483:                        displayHtml.append("	<td><input name=queryListValue"
0484:                                + i + " size=60></td>\n");
0485:                        displayHtml
0486:                                .append("	<td><img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow("
0487:                                        + i + ")>\n");
0488:                        displayHtml
0489:                                .append("	    <img src=/sfaimages/add.gif alt=Add onClick=addConditionRow("
0490:                                        + i + ")></td>\n");
0491:                        displayHtml.append("</tr>");
0492:
0493:                    }
0494:
0495:                    displayHtml.append("</table>\n");
0496:                    displayHtml
0497:                            .append("<input type=hidden id=queryListMaxRows name=queryListMaxRows value=4>\n");
0498:
0499:                    displayHtml.append("<script type='text/javascript'>\n");
0500:                    displayHtml.append("function addConditionRow(i) {\n");
0501:                    displayHtml
0502:                            .append("	var tab1=document.getElementById('queryListTable')\n");
0503:                    displayHtml.append("	if ( tab1 ) {\n");
0504:                    displayHtml.append("		var numRows = tab1.rows.length\n");
0505:                    displayHtml.append("		var maxRows = 10\n");
0506:                    displayHtml.append("		if ( numRows > maxRows )\n");
0507:                    displayHtml
0508:                            .append("			alert(\"Can't have more than 10 conditions\");\n");
0509:                    displayHtml.append("		else {\n");
0510:                    displayHtml.append("			var x = tab1.insertRow(numRows)\n");
0511:                    displayHtml
0512:                            .append("			var maxRows = document.getElementById('queryListMaxRows')\n");
0513:                    displayHtml.append("			var newRow = maxRows.value -  -1\n");
0514:                    displayHtml.append("			maxRows.value = newRow\n");
0515:                    displayHtml.append("			x.id = \"queryListRow\" + newRow\n");
0516:                    displayHtml.append("			var c1=x.insertCell(0)\n");
0517:                    displayHtml.append("			var c2=x.insertCell(1)\n");
0518:                    displayHtml.append("			var c3=x.insertCell(2)\n");
0519:                    displayHtml.append("			var c4=x.insertCell(3)\n");
0520:                    displayHtml
0521:                            .append("			c1.innerHTML=\"<select name=queryListField\" + newRow + \">"
0522:                                    + fieldNameOptions.toString()
0523:                                    + "</select>\"\n");
0524:                    displayHtml
0525:                            .append("			c2.innerHTML=\"<select name=queryListOperator\" + newRow + \">"
0526:                                    + conditionOptions.toString()
0527:                                    + "</select>\"\n");
0528:                    displayHtml
0529:                            .append("			c3.innerHTML=\"<input name=queryListValue\" + newRow + \" size=60>\"\n");
0530:                    displayHtml
0531:                            .append("			c4.innerHTML=\"<img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow(\" + newRow + \")>\" + \" <img src=/sfaimages/add.gif alt=Add onClick=addConditionRow(\" + newRow + \")>\"\n");
0532:
0533:                    displayHtml.append("		}\n");
0534:                    displayHtml.append("		fixSize()\n");
0535:                    displayHtml.append("	}\n");
0536:                    displayHtml.append("}\n");
0537:
0538:                    displayHtml.append("function delConditionRow(i)\n");
0539:                    displayHtml.append("{\n");
0540:                    displayHtml
0541:                            .append("	var row1 = document.getElementById('queryListRow' + i)\n");
0542:                    displayHtml
0543:                            .append("	var tab = document.getElementById('queryListTable')\n");
0544:                    displayHtml.append("	var rows = tab.rows\n");
0545:                    displayHtml.append("	if ( rows.length == 2 ) {\n");
0546:                    displayHtml.append("		event.returnValue = false\n");
0547:                    displayHtml.append("		return;\n");
0548:                    displayHtml.append("	}\n");
0549:                    displayHtml
0550:                            .append("	for ( i=0; i < rows.length; i++ ) {\n");
0551:                    displayHtml.append("		row = rows[i];\n");
0552:                    displayHtml.append("		if ( row.id == row1.id) {\n");
0553:                    displayHtml.append("			tab.deleteRow(i);\n");
0554:                    displayHtml.append("			break;\n");
0555:                    displayHtml.append("		}\n");
0556:                    displayHtml.append("	}\n");
0557:                    displayHtml.append("	fixSize()\n");
0558:                    displayHtml.append("}\n");
0559:
0560:                    displayHtml.append("</script>\n");
0561:
0562:                } else {
0563:                    int column = 1;
0564:                    int row = 1;
0565:                    boolean[][] cellUsed = new boolean[100][20];
0566:                    boolean trOpen = false;
0567:
0568:                    if (TIMER) {
0569:                        timer
0570:                                .timerString(1,
0571:                                        "[UIWebScreenSection.displayFreeFormSection] Finished preparing form");
0572:                    }
0573:
0574:                    int fieldListSize = getUiFieldList().size();
0575:                    for (int fieldNbr = 0; fieldNbr < fieldListSize; fieldNbr++) {
0576:                        if (TIMER) {
0577:                            timer.timerString(1,
0578:                                    "[UIWebScreenSection.displayFreeFormSection] Start field "
0579:                                            + String.valueOf(fieldNbr));
0580:                        }
0581:
0582:                        UIFieldInfo fieldInfo = getUiField(fieldNbr);
0583:
0584:                        // Multiply the column count by 2 since we need space for the labels, too.
0585:                        htmlColumnCount = (getColumnCount() > 1) ? (getColumnCount() * 2)
0586:                                : 2;
0587:
0588:                        int rowSpan = (fieldInfo.getRowSpan() < 2) ? 1
0589:                                : fieldInfo.getRowSpan();
0590:
0591:                        // Double the col span and then substract one from the label to get the actual col span of the data field.
0592:                        int colSpan = (fieldInfo.getColSpan() < 2) ? 1
0593:                                : ((fieldInfo.getColSpan() * 2) - 1);
0594:                        int displayOrder = fieldInfo.getDisplayOrder();
0595:                        String attributeName = fieldInfo.getUiAttribute()
0596:                                .getAttributeName();
0597:                        int fieldWidth = fieldInfo.getDisplayLength();
0598:                        boolean startOnNewRow = fieldInfo.getStartOnNewRow();
0599:
0600:                        if (fieldInfo.getIsVisible()) {
0601:
0602:                            if ((startOnNewRow) && (column > 1)) {
0603:                                int numCellsSkipped = 0;
0604:                                for (int i = column; i <= htmlColumnCount; i++) {
0605:                                    if (!cellUsed[row][i])
0606:                                        numCellsSkipped++;
0607:                                    cellUsed[row][i] = true;
0608:                                }
0609:                                if (numCellsSkipped > 0)
0610:                                    displayHtml
0611:                                            .append("<TD class=freeFormSectionField colspan="
0612:                                                    + numCellsSkipped
0613:                                                    + "></TD>");
0614:                            }
0615:                            if (column == 1) {
0616:                                // We are at the beginning of a new row.
0617:                                Debug.logVerbose(
0618:                                        "[displayFreeFormSection] Starting row "
0619:                                                + String.valueOf(row), module);
0620:
0621:                                displayHtml.append("     <TR>");
0622:                                trOpen = true;
0623:                            }
0624:
0625:                            // Skip cells already used by fields that were taller or wider than one cell.
0626:                            while (cellUsed[row][column]) {
0627:                                column++;
0628:
0629:                                if (column > htmlColumnCount) {
0630:                                    if (trOpen) {
0631:                                        displayHtml.append("     </TR>\n");
0632:                                        trOpen = false;
0633:                                    }
0634:
0635:                                    Debug.logVerbose(
0636:                                            "[displayFreeFormSection] Ending row "
0637:                                                    + String.valueOf(row)
0638:                                                    + " (skipped used cells)",
0639:                                            module);
0640:
0641:                                    column = 1;
0642:                                    row++;
0643:
0644:                                    Debug.logVerbose(
0645:                                            "[displayFreeFormSection] Starting row "
0646:                                                    + String.valueOf(row)
0647:                                                    + " (skipped used cells)",
0648:                                            module);
0649:
0650:                                    displayHtml.append("     <TR>");
0651:                                    // + " HEIGHT=\"" +
0652:                                    //    String.valueOf(FREE_FORM_ROW_HEIGHT) + "\">\n");
0653:                                    trOpen = true;
0654:                                }
0655:                            }
0656:
0657:                            if (fieldInfo.getIsMandatory()
0658:                                    && !getProtect(action)) {
0659:                                displayHtml
0660:                                        .append("      <TD CLASS=\"freeFormSectionLabel\"");
0661:                            } else {
0662:                                displayHtml
0663:                                        .append("      <TD CLASS=\"freeFormSectionLabelOptional\"");
0664:                            }
0665:
0666:                            if (rowSpan > 1) {
0667:                                displayHtml.append(" ROWSPAN=\""
0668:                                        + String.valueOf(rowSpan) + "\"");
0669:                            }
0670:
0671:                            displayHtml.append(">\n");
0672:
0673:                            Debug.logVerbose(
0674:                                    "[displayFreeFormSection] Displaying label "
0675:                                            + fieldInfo.getDisplayLabel()
0676:                                            + " at row " + String.valueOf(row)
0677:                                            + " column "
0678:                                            + String.valueOf(column), module);
0679:
0680:                            displayHtml.append("        "
0681:                                    + fieldInfo.getDisplayLabel() + ":\n");
0682:                            displayHtml.append("      </TD>\n");
0683:                            displayHtml
0684:                                    .append("      <TD CLASS=\"freeFormSectionField\"");
0685:
0686:                            if (rowSpan > 1) {
0687:                                displayHtml.append(" ROWSPAN=\""
0688:                                        + String.valueOf(rowSpan) + "\"");
0689:                            }
0690:
0691:                            if (colSpan > 1) {
0692:                                displayHtml.append(" COLSPAN=\""
0693:                                        + String.valueOf(colSpan) + "\"");
0694:                            }
0695:
0696:                            displayHtml.append(">\n");
0697:                        }
0698:
0699:                        // Write all fields with display order greater than zero.  The ones that are not visible
0700:                        // may be created as hidden fields.
0701:                        if (fieldInfo.getIsVisible()
0702:                                || ((fieldInfo.getDisplayOrder() > 0) && (fieldInfo
0703:                                        .getUiDisplayObject()
0704:                                        .getDisplayTypeId()
0705:                                        .equals(UIDisplayObject.DISPLAY_TYPE_HIDDEN)))) {
0706:                            displayHtml.append(displayField(fieldInfo,
0707:                                    entityDetailsVector, action, 0,
0708:                                    isSubsection, tabOffset));
0709:                            displayHtml.append("\n");
0710:                        }
0711:
0712:                        // If this is a required field, add it to the list of fields to be validated.
0713:                        if (fieldInfo.getIsVisible()
0714:                                && fieldInfo.getIsMandatory()) {
0715:                            requiredFields.add(fieldInfo);
0716:                        }
0717:
0718:                        if (fieldInfo.getIsVisible()) {
0719:                            // Close the cell.
0720:                            displayHtml.append("      </TD>\n");
0721:
0722:                            // Mark used cells in the matrix.
0723:                            // Mark all used rows.
0724:                            for (int markRow = row; markRow < (row + rowSpan); markRow++) {
0725:                                // Mark all used columns, including the label.  That's why we have to add 1 here:
0726:                                for (int markColumn = column; markColumn < (column
0727:                                        + colSpan + 1); markColumn++) {
0728:                                    cellUsed[markRow][markColumn] = true;
0729:                                }
0730:                            }
0731:
0732:                            // Get ready for next time through the loop by adding the column span plus 1 for the label.
0733:                            column += (1 + colSpan);
0734:
0735:                            if (column > htmlColumnCount) {
0736:                                Debug.logVerbose(
0737:                                        "[displayFreeFormSection] Ending row "
0738:                                                + String.valueOf(row), module);
0739:
0740:                                if (trOpen) {
0741:                                    displayHtml.append("     </TR>\n");
0742:                                    trOpen = false;
0743:                                }
0744:
0745:                                column = 1;
0746:                                row++;
0747:                            }
0748:                        }
0749:                    }
0750:
0751:                    if (TIMER) {
0752:                        timer
0753:                                .timerString(1,
0754:                                        "[UIWebScreenSection.displayFreeFormSection] Finished fields");
0755:                    }
0756:
0757:                    if (trOpen) {
0758:                        displayHtml.append("     </TR>\n");
0759:                        trOpen = false;
0760:                    }
0761:
0762:                    displayHtml.append("\n");
0763:                }
0764:
0765:                if (!isSubsection) {
0766:                    displayHtml.append("     <TR HEIGHT=\"*\">\n");
0767:                    displayHtml
0768:                            .append("      <TD CLASS=\"freeFormSectionSaveButtonArea\" COLSPAN=\""
0769:                                    + String.valueOf(htmlColumnCount) + "\">\n");
0770:
0771:                    if (action.equals(ACTION_SHOW_QUERY)
0772:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
0773:                            || action.equals(ACTION_SHOW_REPORT)) {
0774:                        displayHtml.append("       Save Query  Definition:\n");
0775:                        displayHtml
0776:                                .append("       <INPUT TYPE=\"text\" WIDTH=\"40\" NAME=\"queryName\">\n");
0777:                        displayHtml.append("       Save Results to List:\n");
0778:                        displayHtml
0779:                                .append("       <INPUT TYPE=\"text\" WIDTH=\"40\" NAME=\"listName\">\n");
0780:                        displayHtml
0781:                                .append("       <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\""
0782:                                        + getSectionName()
0783:                                        + "SaveButton\" VALUE=\"Run/Save Query\">\n");
0784:                    } else {
0785:                        if (!getProtect(action)) {
0786:                            displayHtml
0787:                                    .append("       <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\""
0788:                                            + getSectionName()
0789:                                            + "SaveButton\" VALUE=\"Save\" onClick=\"return verifyRequired"
0790:                                            + getSectionName()
0791:                                            + "(this.form)\">\n");
0792:                        }
0793:                    }
0794:
0795:                    displayHtml.append("      </TD>\n");
0796:                    displayHtml.append("     </TR>\n");
0797:                    displayHtml.append("    </FORM>\n");
0798:                    displayHtml.append("\n");
0799:                }
0800:
0801:                displayHtml.append("   </TABLE>\n");
0802:                displayHtml.append("\n");
0803:
0804:                // Add the javascript methods for confirming delete and validating required fields.
0805:                displayHtml.append(UIWebUtility.writeConfirmDeleteScript());
0806:                displayHtml.append(UIWebUtility.writeVerifyRequiredScript(
0807:                        getSectionName(), requiredFields));
0808:
0809:                if (TIMER) {
0810:                    timer.timerString(1,
0811:                            "[UIWebScreenSection.displayFreeFormSection] End");
0812:                }
0813:
0814:                return displayHtml.toString();
0815:            }
0816:
0817:            /**
0818:             * DOCUMENT ME!
0819:             *
0820:             * @param dataMatrix 
0821:             * @param action 
0822:             * @param sectionTitle 
0823:             * @param queryId 
0824:             *
0825:             * @return 
0826:             *
0827:             * @throws GenericEntityException 
0828:             */
0829:            public String displayTabularSection(DataMatrix dataMatrix,
0830:                    String action, String sectionTitle, String queryId)
0831:                    throws GenericEntityException {
0832:
0833:                Debug.logVerbose("[displayTabularSection()] Screen name: "
0834:                        + getUiScreen().getScreenName() + " - SectionName = "
0835:                        + getSectionName(), module);
0836:
0837:                UtilTimer timer = new UtilTimer();
0838:
0839:                if (TIMER) {
0840:                    timer.timerString(1,
0841:                            "[UIWebScreenSection.displayTabularSection] Start");
0842:                }
0843:
0844:                // Get the extra query parameters so the form can pass them to the next page.
0845:                Debug.logVerbose(
0846:                        "displayTabularSection] getSendQueryParameterValueMap: "
0847:                                + getSendQueryParameterValueMap().toString(),
0848:                        module);
0849:
0850:                String sendQueryParams = UIWebUtility.getHiddenArgs(
0851:                        getSendQueryParameterValueMap(), "       ");
0852:
0853:                Debug.logVerbose("[displayTabularSection] sendQueryParams: "
0854:                        + sendQueryParams, module);
0855:
0856:                StringBuffer displayHtml = new StringBuffer(5000);
0857:
0858:                int row = 0;
0859:                int rows = dataMatrix.getCurrentBuffer().getContents().size();
0860:
0861:                hasPriorPage = firstVisibleRow > 0;
0862:                hasNextPage = (rowsPerPage > 0) && (totalRows > rowsPerPage);
0863:                priorPageStartRow = firstVisibleRow - rowsPerPage;
0864:
0865:                if (priorPageStartRow < 0) {
0866:                    priorPageStartRow = 0;
0867:                }
0868:
0869:                nextPageStartRow = firstVisibleRow + rowsPerPage;
0870:
0871:                Debug.logVerbose("hasPrior=" + hasPriorPage + ", hasNext="
0872:                        + hasNextPage + ",priorStart=" + priorPageStartRow
0873:                        + ",nextStart=" + nextPageStartRow, module);
0874:
0875:                /*        int lastVisibleRow = rows + 1;
0876:                        int numPages = 1;
0877:                        if ( (rowsPerPage > 0) && (rows > rowsPerPage) )
0878:                        {
0879:                           lastVisibleRow = firstVisibleRow + rowsPerPage -1;
0880:                           numPages = rows/rowsPerPage;
0881:                           if (rows % rowsPerPage > 0)
0882:                               numPages++;
0883:                        }
0884:                 */
0885:                displayHtml.append(displayTabularSectionHeader(action,
0886:                        sectionTitle, queryId, rows, sendQueryParams));
0887:
0888:                Iterator entityDetailsVectorIterator = dataMatrix
0889:                        .getCurrentBuffer().getContents().iterator();
0890:
0891:                while (entityDetailsVectorIterator.hasNext()) {
0892:                    // Get the next item from the vector of entity vectors.
0893:                    Vector entityDetailsVector = (Vector) entityDetailsVectorIterator
0894:                            .next();
0895:
0896:                    // Display the row of fields.
0897:                    displayHtml.append(displayTabularSectionRow(row++, rows,
0898:                            entityDetailsVector, action));
0899:                }
0900:
0901:                if (hasPriorPage || hasNextPage) {
0902:                    displayHtml.append(displayPageButtons(hasPriorPage,
0903:                            priorPageStartRow, hasNextPage, nextPageStartRow,
0904:                            queryId));
0905:                }
0906:
0907:                // Display the closing HTML tags, and the alpha search for the screen section.
0908:                displayHtml.append(displayTabularSectionFooter(action,
0909:                        sendQueryParams, queryId));
0910:
0911:                Debug.logVerbose(
0912:                        "[displayTabularSection()] Finished Screen name: "
0913:                                + getUiScreen().getScreenName()
0914:                                + " - SectionName = " + getSectionName(),
0915:                        module);
0916:
0917:                if (TIMER) {
0918:                    timer.timerString(1,
0919:                            "[UIWebScreenSection.displayTabularSection] End");
0920:                }
0921:
0922:                return displayHtml.toString();
0923:            }
0924:
0925:            /**
0926:             * DOCUMENT ME!
0927:             *
0928:             * @param action 
0929:             * @param sectionTitle 
0930:             * @param queryId 
0931:             * @param rows 
0932:             * @param sendQueryParams 
0933:             *
0934:             * @return 
0935:             *
0936:             * @throws GenericEntityException 
0937:             */
0938:            public String displayTabularSectionHeader(String action,
0939:                    String sectionTitle, String queryId, int rows,
0940:                    String sendQueryParams) throws GenericEntityException {
0941:                UtilTimer timer = new UtilTimer();
0942:
0943:                if (TIMER) {
0944:                    timer
0945:                            .timerString(2,
0946:                                    "[UIWebScreenSection.displayTabularSectionHeader] Start");
0947:                }
0948:
0949:                StringBuffer displayHtml = new StringBuffer(2000);
0950:
0951:                displayHtml.append("<SCRIPT>\n");
0952:                displayHtml.append(" function selectRow" + getSectionName()
0953:                        + "(aLinkObj, aClickedObj) {\n");
0954:
0955:                if (WEB_DEBUG) {
0956:                    displayHtml
0957:                            .append("  alert('[selectRow"
0958:                                    + getSectionName()
0959:                                    + "] Clicked object name: ' + aClickedObj.name);\n");
0960:                }
0961:
0962:                if (WEB_DEBUG) {
0963:                    displayHtml.append("  alert('[selectRow" + getSectionName()
0964:                            + "] Clicked object ID: ' + aClickedObj.id);\n");
0965:                }
0966:
0967:                if (WEB_DEBUG) {
0968:                    displayHtml
0969:                            .append("  alert('[selectRow"
0970:                                    + getSectionName()
0971:                                    + "] Clicked object tag name: ' + aClickedObj.tagName);\n");
0972:                }
0973:
0974:                displayHtml.append("  if (aClickedObj.tagName == 'TD') {\n");
0975:                displayHtml
0976:                        .append("   // An empty space in the row was clicked.  Go ahead and click the hidden anchor.\n");
0977:                displayHtml
0978:                        .append("   // Note: Catch exception to get rid of the 'undefined error' that pops up if the cancel \n");
0979:                displayHtml
0980:                        .append("   // button is clicked in response to the onBeforeUnload processing.\n");
0981:                displayHtml.append("   try {\n");
0982:                displayHtml.append("    aLinkObj.click();\n");
0983:                displayHtml.append("   } catch (Exception) {\n");
0984:                displayHtml.append("   }\n");
0985:                displayHtml.append("  } else {\n");
0986:                displayHtml
0987:                        .append("   // Either an anchor was clicked by the user, in which case that link\n");
0988:                displayHtml
0989:                        .append("   // will take care of reloading pages, or a drop down was clicked, in which case\n");
0990:                displayHtml
0991:                        .append("   // we don't want to select a new row, or this function is executing a second time\n");
0992:                displayHtml
0993:                        .append("   // as the result of the click() it just triggered on the aLinkObj anchor.\n");
0994:                displayHtml.append("   // Don't do anything here.  \n");
0995:                displayHtml.append("  }\n");
0996:                displayHtml.append(" }\n");
0997:
0998:                // Insert the preSubmit function to prevent the onBeforeUnload popup window from being displayed
0999:                // if the Save button was just clicked.
1000:                if (getIsUpdateable()) {
1001:                    displayHtml.append(" function preSubmit" + getSectionName()
1002:                            + "() {\n");
1003:                    displayHtml
1004:                            .append("  // Prevent the onBeforeUnload popup window\n");
1005:                    displayHtml.append("  window.onbeforeunload = null;\n");
1006:                    displayHtml.append("  return false;\n");
1007:                    displayHtml.append(" }\n");
1008:                }
1009:
1010:                displayHtml.append("</SCRIPT>\n");
1011:                displayHtml.append("\n");
1012:                displayHtml
1013:                        .append("<SCRIPT LANGUAGE=\"JScript\" TYPE=\"text/javascript\" FOR=\"window\" EVENT=\"onload\">\n");
1014:                displayHtml.append("\n");
1015:                displayHtml
1016:                        .append(" // Turn on the scroll bars in case the window object is an Iframe that was\n");
1017:                displayHtml
1018:                        .append(" // created to hold a set of tab pages, which don't have any scroll bars.\n");
1019:                displayHtml.append(" document.body.scroll=\"auto\";\n");
1020:                displayHtml.append("\n");
1021:                displayHtml.append("</SCRIPT>\n");
1022:                displayHtml.append("\n");
1023:
1024:                displayHtml
1025:                        .append("   <TABLE WIDTH=\"100%\" CLASS=\"tabularSectionTitleTable\">\n");
1026:                displayHtml.append("    <TR>\n");
1027:                displayHtml.append("\n");
1028:                displayHtml.append("     <TD>\n");
1029:                displayHtml.append("      <NOBR>" + sectionTitle + "</NOBR>\n");
1030:                displayHtml.append("     </TD>\n");
1031:                displayHtml.append("     <TD ALIGN=\"right\">\n");
1032:                displayHtml.append("      <TABLE>\n");
1033:                displayHtml.append("       <TR>\n");
1034:                displayHtml.append("\n");
1035:                displayHtml
1036:                        .append(displayQueryPicker(sendQueryParams, queryId));
1037:
1038:                if (getLayoutTypeId() != LAYOUT_TYPE_SELECT) {
1039:                    displayHtml
1040:                            .append(displayNewButton(sendQueryParams, action));
1041:                }
1042:
1043:                if (getIsUpdateable()) {
1044:                    displayHtml.append(displayEditButton(action, "",
1045:                            sendQueryParams, ACTION_QUERY_UPDATE));
1046:                }
1047:
1048:                if (getLayoutTypeId() == LAYOUT_TYPE_SELECT) {
1049:                    // This is actually a select section being displayed in tabular mode. Display the Select
1050:                    // button so the user can put it back into Select mode.
1051:                    displayHtml.append("     <TD WIDTH=\"70\">\n");
1052:                    displayHtml.append("      <FORM NAME=\"" + getSectionName()
1053:                            + "FormEditButton\" METHOD=\"post\"" + " ACTION=\""
1054:                            + getButtonAction() + "\"");
1055:
1056:                    if ((getButtonTarget() != null)
1057:                            && !getButtonTarget().equals("")) {
1058:                        displayHtml.append(" TARGET=\"" + getButtonTarget()
1059:                                + "\"");
1060:                    }
1061:
1062:                    displayHtml.append(">\n");
1063:                    displayHtml
1064:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
1065:                                    + ACTION_SHOW_SELECT + "\">\n");
1066:                    displayHtml.append(sendQueryParams);
1067:                    displayHtml.append(displaySelectButton(action));
1068:                    displayHtml.append("      </FORM>\n");
1069:                    displayHtml.append("     </TD>\n");
1070:                    displayHtml.append("\n");
1071:                }
1072:
1073:                displayHtml.append(displayCustomizeButton());
1074:                displayHtml.append("       </TR>\n");
1075:                displayHtml.append("      </TABLE>\n");
1076:                displayHtml.append("     </TD>\n");
1077:                displayHtml.append("    </TR>\n");
1078:                displayHtml.append("   </TABLE>\n\n");
1079:
1080:                displayHtml.append("   <TABLE CLASS=\"grid\"  ID=\"table"
1081:                        + getSectionName() + "\" WIDTH=\""
1082:                        + getRowWidth(getUiFieldList())
1083:                        + "\" CELLSPACING=\"0\">\n");
1084:
1085:                displayHtml.append("    <THEAD>\n");
1086:                displayHtml.append("     <TR valign=\"middle\">\n");
1087:
1088:                // Write out the column headings.
1089:                int tempColumnCount = 0;
1090:
1091:                for (int column = 0; column < getUiFieldList().size(); column++) {
1092:                    UIFieldInfo fieldInfo = (UIFieldInfo) getUiField(column);
1093:
1094:                    if (fieldInfo.getIsVisible()) {
1095:                        displayHtml.append("      <TD  WIDTH=\"");
1096:
1097:                        if (fieldInfo.getDisplayLabel().length() > fieldInfo
1098:                                .getDisplayLength()) {
1099:                            displayHtml.append((fieldInfo.getDisplayLabel()
1100:                                    .length() + 35));
1101:                        } else {
1102:                            displayHtml
1103:                                    .append((fieldInfo.getDisplayLength() + 35));
1104:                        }
1105:
1106:                        displayHtml
1107:                                .append("\" ><INPUT type=button style='width:100%;height:20;font:12px menu;' value='"
1108:                                        + fieldInfo.getDisplayLabel()
1109:                                        + "'></TD>\n");
1110:                    }
1111:
1112:                    tempColumnCount++;
1113:                }
1114:
1115:                // Column count in database is not used for tabular screen sections.
1116:                setColumnCount(tempColumnCount);
1117:
1118:                displayHtml.append("     </TR>\n");
1119:                displayHtml.append("    </THEAD>\n");
1120:
1121:                displayHtml.append("    <TBODY ID='tableDetails'>\n");
1122:
1123:                if ((getButtonAction() != null)
1124:                        && !getButtonAction().equals("")
1125:                        && (getButtonTarget() != null)
1126:                        && !getButtonTarget().equals("") && getIsUpdateable()) {
1127:                    displayHtml.append("     <FORM METHOD=\"post\" NAME=\""
1128:                            + getSectionName() + "Form\""
1129:                            + " onSubmit=\"preSubmit" + getSectionName()
1130:                            + "()\"" + " ACTION=\"" + getButtonAction() + "\"");
1131:                    displayHtml.append(" TARGET=\"" + getButtonTarget() + "\"");
1132:                    displayHtml.append(">\n");
1133:                    displayHtml
1134:                            .append("      <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
1135:                                    + getNextAction(action) + "\">\n");
1136:                    displayHtml.append(sendQueryParams);
1137:                }
1138:
1139:                displayHtml
1140:                        .append("      <INPUT TYPE=\"hidden\" NAME=\"rowCount\" VALUE=\""
1141:                                + String.valueOf(rows) + "\">\n");
1142:
1143:                if (TIMER) {
1144:                    timer
1145:                            .timerString(2,
1146:                                    "[UIWebScreenSection.displayTabularSectionHeader] End");
1147:                }
1148:
1149:                return displayHtml.toString();
1150:            }
1151:
1152:            /**
1153:             * DOCUMENT ME!
1154:             *
1155:             * @param row 
1156:             * @param rows 
1157:             * @param entityDetailsVector 
1158:             * @param action 
1159:             *
1160:             * @return 
1161:             *
1162:             * @throws GenericEntityException 
1163:             */
1164:            public String displayTabularSectionRow(int row, int rows,
1165:                    Vector entityDetailsVector, String action)
1166:                    throws GenericEntityException {
1167:                UtilTimer timer = new UtilTimer();
1168:
1169:                if (TIMER) {
1170:                    timer.timerString(2,
1171:                            "[UIWebScreenSection.displayTabularSectionRow] Start - row "
1172:                                    + String.valueOf(row));
1173:                }
1174:
1175:                StringBuffer displayHtml = new StringBuffer(200);
1176:                String rowClass = (((row % 2) != 0) ? "light" : "medium");
1177:
1178:                //		String rowClass = (((row % 2) != 0) ? "tabularSectionField1" : "tabularSectionField2");
1179:                GenericValue primaryEntityDetails = (GenericValue) entityDetailsVector
1180:                        .firstElement();
1181:                displayHtml.append("     <TR CLASS=\"" + rowClass
1182:                        + "\" ID=\"tr_" + getSectionName() + "_");
1183:                displayHtml.append(String.valueOf(row) + "\"");
1184:
1185:                String hrefName = "a_" + getSectionName() + "_"
1186:                        + String.valueOf(row);
1187:
1188:                if (!getDetailButtonAction().equals("")
1189:                        && !getDetailButtonTarget().equals("")) {
1190:                    displayHtml.append(" onclick=\"selectRow"
1191:                            + getSectionName() + "(" + hrefName
1192:                            + ", window.event.srcElement)\"");
1193:                }
1194:
1195:                displayHtml.append(">\n");
1196:
1197:                if (!getDetailButtonAction().equals("")
1198:                        && !getDetailButtonTarget().equals("")) {
1199:                    // Insert the row select button.
1200:                    String href = " <A HREF=\""
1201:                            + getDetailButtonAction()
1202:                            + "?action=show"
1203:                            + UIWebUtility.getUrlArgs(getButtonKeyMap(),
1204:                                    entityDetailsVector) + "\" TARGET=\""
1205:                            + getDetailButtonTarget() + "\" name=" + hrefName
1206:                            + "></A>\n";
1207:                    displayHtml.append(href);
1208:                }
1209:
1210:                for (int fieldNbr = 0; fieldNbr < getUiFieldList().size(); fieldNbr++) {
1211:                    UIFieldInfo fieldInfo = getUiField(fieldNbr);
1212:                    String attributeName = fieldInfo.getUiAttribute()
1213:                            .getAttributeName();
1214:
1215:                    if (fieldInfo.getIsVisible()) {
1216:                        Debug.logVerbose(
1217:                                "[displayTabularSection()] Section name: "
1218:                                        + getSectionName() + " - Field Name = "
1219:                                        + attributeName, module);
1220:
1221:                        displayHtml.append("      <TD NOWRAP ID=\"td_"
1222:                                + String.valueOf(row) + "_"
1223:                                + String.valueOf(fieldNbr) + "\">\n");
1224:                    }
1225:
1226:                    displayHtml.append(displayField(fieldInfo,
1227:                            entityDetailsVector, action, row, false, 0));
1228:
1229:                    if (fieldInfo.getIsVisible()) {
1230:                        displayHtml.append("      </TD>\n");
1231:                    }
1232:
1233:                    displayHtml.append("\n");
1234:                }
1235:
1236:                // Make a blank column at the right side so the colors will look right.
1237:                displayHtml
1238:                        .append("      <TD CLASS=\"tabularSectionBlankLabel\">\n");
1239:                displayHtml.append("       &nbsp\n");
1240:                displayHtml.append("      </TD>\n");
1241:                displayHtml.append("     </TR>\n");
1242:
1243:                if (TIMER) {
1244:                    timer.timerString(2,
1245:                            "[UIWebScreenSection.displayTabularSectionRow] End - row "
1246:                                    + String.valueOf(row));
1247:                }
1248:
1249:                return displayHtml.toString();
1250:            }
1251:
1252:            /**
1253:             * DOCUMENT ME!
1254:             *
1255:             * @param action 
1256:             * @param sendQueryParams 
1257:             *
1258:             * @return 
1259:             */
1260:            public String displayTabularSectionFooter(String action,
1261:                    String sendQueryParams, String queryId) {
1262:                UtilTimer timer = new UtilTimer();
1263:
1264:                if (TIMER) {
1265:                    timer
1266:                            .timerString(2,
1267:                                    "[UIWebScreenSection.displayTabularSectionFooter] Start");
1268:                }
1269:
1270:                StringBuffer displayHtml = new StringBuffer(200);
1271:
1272:                if ((getButtonAction() != null)
1273:                        && !getButtonAction().equals("")
1274:                        && (getButtonTarget() != null)
1275:                        && !getButtonTarget().equals("")
1276:                        && getIsUpdateable()
1277:                        && (action.equals(ACTION_QUERY_UPDATE)
1278:                                || action.equals(ACTION_SHOW_INSERT) || action
1279:                                .equals(ACTION_UPDATE))) {
1280:                    displayHtml.append("     <TR>\n");
1281:                    displayHtml.append("      <TD></TD>\n");
1282:                    displayHtml
1283:                            .append("      <TD CLASS=\"tabularSectionSaveButtonArea\" COLSPAN=\""
1284:                                    + String.valueOf(getColumnCount())
1285:                                    + "\">\n");
1286:                    displayHtml
1287:                            .append("       <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\""
1288:                                    + getSectionName()
1289:                                    + "SaveButton\" VALUE=\"Save\">\n");
1290:                    displayHtml.append("      </TD>\n");
1291:                    displayHtml.append("     </TR>\n");
1292:                    displayHtml.append("\n");
1293:                }
1294:
1295:                if ((getButtonAction() != null)
1296:                        && !getButtonAction().equals("")
1297:                        && (getButtonTarget() != null)
1298:                        && !getButtonTarget().equals("") && getIsUpdateable()) {
1299:                    displayHtml.append("    </FORM>\n");
1300:                }
1301:
1302:                displayHtml.append("   </TBODY>\n");
1303:                displayHtml.append("  </TABLE>\n");
1304:
1305:                Debug.logVerbose(
1306:                        "[displayTabularSection()] getSearchAction(): "
1307:                                + getSearchAction(), module);
1308:                Debug.logVerbose(
1309:                        "[displayTabularSection()] getSearchTarget(): "
1310:                                + getSearchTarget(), module);
1311:                Debug.logVerbose(
1312:                        "[displayTabularSection()] getSearchAttributeId(): "
1313:                                + getSearchAttributeId(), module);
1314:
1315:                if (hasPriorPage || hasNextPage) {
1316:
1317:                    String scrollAction = action;
1318:                    if (scrollAction.equals(ACTION_UPDATE)
1319:                            || (scrollAction.equals(ACTION_INSERT)))
1320:                        scrollAction = ACTION_QUERY;
1321:
1322:                    displayHtml
1323:                            .append("<FORM STYLE=\"padding=0; border=0; margin=0\" ACTION=\""
1324:                                    + getSearchAction()
1325:                                    + "\""
1326:                                    + " TARGET=\""
1327:                                    + getSearchTarget()
1328:                                    + "\" NAME=\""
1329:                                    + getSectionName() + "PageButtons\">\n");
1330:                    displayHtml
1331:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
1332:                                    + scrollAction + "\">\n");
1333:                    displayHtml
1334:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"startRow\" VALUE=\""
1335:                                    + 0 + "\">\n");
1336:                    displayHtml.append(sendQueryParams);
1337:                    if (queryId != null && queryId.length() > 0)
1338:                        displayHtml
1339:                                .append("<INPUT TYPE=hidden name=queryId value=\""
1340:                                        + queryId + "\">\n");
1341:                    displayHtml.append("<CENTER><TABLE>\n<TR>\n");
1342:                    displayHtml.append("<TD ALIGN=CENTER>");
1343:
1344:                    if (hasPriorPage) {
1345:                        displayHtml
1346:                                .append("<input type=submit CLASS=\"titleBarImageButton\" title=\"Previous Page\" name=previous value=\"Previous\" onClick=\"startRow.value ="
1347:                                        + priorPageStartRow + "\">\n");
1348:                    }
1349:
1350:                    displayHtml.append("</TD><TD ALIGN=CENTER>");
1351:
1352:                    if (hasNextPage) {
1353:                        displayHtml
1354:                                .append("<TD><input type=submit CLASS=\"titleBarImageButton\" title=\"Next Page\" name=next value=\"Next\" onClick=\"startRow.value ="
1355:                                        + nextPageStartRow + "\">\n");
1356:                    }
1357:
1358:                    displayHtml.append("</TD></TR></TABLE></CENTER>\n");
1359:                    displayHtml.append("</FORM>\n");
1360:                }
1361:
1362:                if (!getSearchAction().equals("")
1363:                        && !getSearchTarget().equals("")
1364:                        && !getSearchAttributeId().equals("")) {
1365:                    // Draw the alpha search under the list.
1366:                    Debug
1367:                            .logVerbose(
1368:                                    "[displayTabularSection()] Displaying alpha search buttons.",
1369:                                    module);
1370:
1371:                    displayHtml.append("  <TABLE WIDTH=\"100%\">\n");
1372:
1373:                    String[] alphabet = { "a", "b", "c", "d", "e", "f", "g",
1374:                            "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
1375:                            "r", "s", "t", "u", "v", "w", "x", "y", "z", "*" };
1376:                    displayHtml.append("\n");
1377:                    displayHtml.append("    <TR>\n");
1378:                    displayHtml.append("     <TD WIDTH=\"30\"></TD>\n");
1379:                    displayHtml.append("     <TD ALIGN=\"left\">\n");
1380:                    displayHtml
1381:                            .append("      <FORM STYLE=\"padding=0; border=0; margin=0\" ACTION=\""
1382:                                    + getSearchAction()
1383:                                    + "\""
1384:                                    + " TARGET=\""
1385:                                    + getSearchTarget()
1386:                                    + "\" NAME=\""
1387:                                    + getSectionName() + "AlphaQueryForm\">\n");
1388:                    displayHtml
1389:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
1390:                                    + ACTION_QUERY + "\">\n");
1391:                    displayHtml.append(sendQueryParams);
1392:                    displayHtml
1393:                            .append("       <TABLE BORDER=\"0\" BGCOLOR=\"white\" CELLSPACING=\"0\" CELLPADDING=\"0\" BORDER=\"0\">\n");
1394:                    displayHtml.append("        <TR>\n");
1395:
1396:                    for (int letterNbr = 0; letterNbr < alphabet.length; letterNbr++) {
1397:                        displayHtml.append("         <TD>\n");
1398:                        displayHtml
1399:                                .append("          <INPUT WIDTH=\"10\" TYPE=\"submit\" CLASS=\"button\" NAME=\"nameToSearch\" VALUE=\""
1400:                                        + alphabet[letterNbr] + "\">\n");
1401:                        displayHtml.append("         </TD>\n");
1402:                    }
1403:
1404:                    displayHtml.append("        </TR>\n");
1405:                    displayHtml.append("       </TABLE>\n");
1406:                    displayHtml.append("      </FORM>\n");
1407:                    displayHtml.append("     </TD>\n");
1408:                    displayHtml.append("    </TR>\n");
1409:                    displayHtml.append("   </TABLE>\n");
1410:                    displayHtml.append("\n");
1411:                }
1412:
1413:                if (TIMER) {
1414:                    timer
1415:                            .timerString(2,
1416:                                    "[UIWebScreenSection.displayTabularSectionFooter] End");
1417:                }
1418:
1419:                return displayHtml.toString();
1420:            }
1421:
1422:            /**
1423:             * DOCUMENT ME!
1424:             *
1425:             * @param dataMatrix 
1426:             * @param action 
1427:             * @param sectionTitle 
1428:             * @param queryId 
1429:             *
1430:             * @return 
1431:             *
1432:             * @throws GenericEntityException 
1433:             */
1434:            public String displaySelectSection(DataMatrix dataMatrix,
1435:                    String action, String sectionTitle, String queryId)
1436:                    throws GenericEntityException {
1437:                Debug.logVerbose("[displaySelectSection] Screen name: "
1438:                        + getUiScreen().getScreenName() + " - SectionName = "
1439:                        + getSectionName(), module);
1440:
1441:                int rows = dataMatrix.getCurrentBuffer().getContents().size();
1442:
1443:                // Get the extra query parameters so the form can pass them to the next page.
1444:
1445:                Debug.logVerbose(
1446:                        "[displaySelectSection] getSendQueryParameterValueMap: "
1447:                                + getSendQueryParameterValueMap().toString(),
1448:                        module);
1449:
1450:                String sendQueryParams = UIWebUtility.getHiddenArgs(
1451:                        getSendQueryParameterValueMap(), "       ");
1452:
1453:                Debug.logVerbose("[displaySelectSection] sendQueryParams: "
1454:                        + sendQueryParams, module);
1455:
1456:                StringBuffer displayHtml = new StringBuffer(5000);
1457:
1458:                if (action.equals(ACTION_SHOW_SELECT)
1459:                        || action.equals(ACTION_UPDATE_SELECT)) {
1460:                    // Need to display the screen section in select mode.
1461:                    // Insert the client side scripts.
1462:                    Debug
1463:                            .logVerbose(
1464:                                    "[displaySelectSection] Inserting scripts.",
1465:                                    module);
1466:
1467:                    displayHtml.append("<SCRIPT LANGUAGE=\"JavaScript\">\n");
1468:                    displayHtml.append("function handleUnassignedChange"
1469:                            + getSectionName() + "() {\n");
1470:                    displayHtml.append("	document." + getSectionName()
1471:                            + "Form." + getSectionName()
1472:                            + "AssignedSel.selectedIndex = -1;\n");
1473:                    displayHtml.append("	document." + getSectionName()
1474:                            + "Form." + getSectionName()
1475:                            + "SelectButton.disabled = false;\n");
1476:                    displayHtml.append("	document." + getSectionName()
1477:                            + "Form." + getSectionName()
1478:                            + "SelectButton.value = \">>>\";\n");
1479:                    displayHtml.append("}\n");
1480:                    displayHtml.append("function handleAssignedChange"
1481:                            + getSectionName() + "() {\n");
1482:                    displayHtml.append("	document." + getSectionName()
1483:                            + "Form." + getSectionName()
1484:                            + "UnassignedSel.selectedIndex = -1;\n");
1485:                    displayHtml.append("	document." + getSectionName()
1486:                            + "Form." + getSectionName()
1487:                            + "SelectButton.disabled = false;\n");
1488:                    displayHtml.append("	document." + getSectionName()
1489:                            + "Form." + getSectionName()
1490:                            + "SelectButton.value = \"<<<\";\n");
1491:                    displayHtml.append("}\n");
1492:                    displayHtml.append("\n");
1493:                    displayHtml.append("function selectTransfer"
1494:                            + getSectionName() + "(btnObj)\n");
1495:                    displayHtml.append("{\n");
1496:                    displayHtml.append("	selectTransfer" + getSectionName()
1497:                            + "(btnObj, \"N\");\n");
1498:                    displayHtml.append("}\n");
1499:                    displayHtml.append("\n");
1500:                    displayHtml.append("function selectTransfer"
1501:                            + getSectionName() + "(btnObj, requiredFlag)\n");
1502:                    displayHtml.append("{\n");
1503:                    displayHtml.append("	var selFrom;\n");
1504:                    displayHtml.append("	var selTo;\n");
1505:                    displayHtml.append("	var selDB;\n");
1506:                    displayHtml.append("	var selDBAlt;\n");
1507:                    displayHtml.append("	var curOpt;\n");
1508:                    displayHtml.append("\n");
1509:                    displayHtml.append("	if (btnObj.value == \">>>\") {\n");
1510:                    displayHtml.append("		// An item is being added\n");
1511:                    displayHtml.append("		selTo = document.all('"
1512:                            + getSectionName() + "AssignedSel');\n");
1513:                    displayHtml.append("		selFrom = document.all('"
1514:                            + getSectionName() + "UnassignedSel');\n");
1515:                    displayHtml.append("		selDB = document.all('"
1516:                            + getSectionName() + "AddDBSel');\n");
1517:                    displayHtml.append("		selDBAlt = document.all('"
1518:                            + getSectionName() + "DeleteDBSel');\n");
1519:                    displayHtml.append("	} else {\n");
1520:                    displayHtml.append("		// An item is being deleted\n");
1521:                    displayHtml.append("		selTo = document.all('"
1522:                            + getSectionName() + "UnassignedSel');\n");
1523:                    displayHtml.append("		selFrom = document.all('"
1524:                            + getSectionName() + "AssignedSel');\n");
1525:                    displayHtml.append("		selDB = document.all('"
1526:                            + getSectionName() + "DeleteDBSel');\n");
1527:                    displayHtml.append("		selDBAlt = document.all('"
1528:                            + getSectionName() + "AddDBSel');\n");
1529:                    displayHtml.append("	}\n");
1530:                    displayHtml.append("\n");
1531:                    displayHtml.append("	// Make sure an item was selected\n");
1532:                    displayHtml.append("	if (selFrom.selectedIndex < 0) {\n");
1533:                    displayHtml
1534:                            .append("		alert('Please select an item first');\n");
1535:                    displayHtml.append("		return;\n");
1536:                    displayHtml.append("	}\n");
1537:                    displayHtml.append("\n");
1538:                    displayHtml
1539:                            .append("	curOpt = selFrom.options[selFrom.selectedIndex];\n");
1540:                    displayHtml.append("	var selectedValue = curOpt.value;\n");
1541:                    displayHtml.append("	var selectedText = curOpt.text;\n");
1542:
1543:                    if (WEB_DEBUG) {
1544:                        displayHtml
1545:                                .append("	alert('selectedValue = ' + selectedValue);\n");
1546:                    }
1547:
1548:                    displayHtml
1549:                            .append("	// Add the entry to the 'select to' list\n");
1550:                    displayHtml
1551:                            .append("	selTo.options[selTo.length] = new Option(selectedText, selectedValue, false, true);\n");
1552:                    displayHtml.append("\n");
1553:                    displayHtml.append("\n");
1554:                    displayHtml
1555:                            .append("	// Remove the entry from the 'select from' list\n");
1556:                    displayHtml
1557:                            .append("	selFrom.options[selFrom.selectedIndex] = null;\n");
1558:                    displayHtml.append("\n");
1559:                    displayHtml
1560:                            .append("	// If this is a reversal of a prior selection, remove the item from the reverse DB action list.\n");
1561:                    displayHtml.append("	var handled = false;\n");
1562:                    displayHtml
1563:                            .append("	for (i=0; i< selDBAlt.length; i++) {\n");
1564:                    displayHtml
1565:                            .append("		var checkOptionObj = selDBAlt.options[i];\n");
1566:                    displayHtml
1567:                            .append("		var checkValue = checkOptionObj.value;\n");
1568:                    displayHtml
1569:                            .append("		if (checkValue == selectedValue) {\n");
1570:                    displayHtml
1571:                            .append("			// Just remove the item from the DB list since no action will be required at Save time\n");
1572:
1573:                    if (WEB_DEBUG) {
1574:                        displayHtml
1575:                                .append("			alert('Removing item from the reverse DB action list.');\n");
1576:                    }
1577:
1578:                    displayHtml
1579:                            .append("			selDBAlt.removeChild(checkOptionObj);\n");
1580:                    displayHtml.append("			handled = true;\n");
1581:                    displayHtml.append("			break;\n");
1582:                    displayHtml.append("		}\n");
1583:                    displayHtml.append("	}\n");
1584:                    displayHtml.append("\n");
1585:                    displayHtml
1586:                            .append("	// If the item was not already handled by deleting it from the reverse DB action list, add it to the DB action list.\n");
1587:                    displayHtml.append("	if (!handled) {\n");
1588:                    displayHtml
1589:                            .append("		selDB.options[selDB.length] = new Option(selectedText, selectedValue, false, true);\n");
1590:                    displayHtml.append("	}\n");
1591:                    displayHtml.append("\n");
1592:                    displayHtml
1593:                            .append("	// Change the look of the arrow button\n");
1594:                    displayHtml.append("	if (selTo == document."
1595:                            + getSectionName() + "Form." + getSectionName()
1596:                            + "UnassignedSel)\n");
1597:                    displayHtml.append("		handleUnassignedChange"
1598:                            + getSectionName() + "();\n");
1599:                    displayHtml.append("	else if (selTo == document."
1600:                            + getSectionName() + "Form." + getSectionName()
1601:                            + "AssignedSel)\n");
1602:                    displayHtml.append("		handleAssignedChange"
1603:                            + getSectionName() + "();\n");
1604:                    displayHtml.append("\n");
1605:                    displayHtml
1606:                            .append("	if ( document."
1607:                                    + getSectionName()
1608:                                    + "Form."
1609:                                    + getSectionName()
1610:                                    + "AssignedSel.length < 1 && requiredFlag==\"Y\")\n");
1611:                    displayHtml.append("	{\n");
1612:                    displayHtml.append("		document." + getSectionName()
1613:                            + "Form." + getSectionName()
1614:                            + "SaveButton.disabled = true;\n");
1615:                    displayHtml.append("	}\n");
1616:                    displayHtml.append("	else\n");
1617:                    displayHtml.append("	{\n");
1618:                    displayHtml.append("		document." + getSectionName()
1619:                            + "Form." + getSectionName()
1620:                            + "SaveButton.disabled = false;\n");
1621:                    displayHtml.append("	}\n");
1622:                    displayHtml.append("}\n");
1623:                    displayHtml.append("\n");
1624:                    displayHtml.append("function preSubmit" + getSectionName()
1625:                            + "()\n");
1626:                    displayHtml.append("{\n");
1627:                    displayHtml.append("	var i;\n");
1628:                    displayHtml.append("	var tmpStr = \"\";\n");
1629:                    displayHtml.append("	var opt = \"\";\n");
1630:                    displayHtml.append("\n");
1631:                    displayHtml
1632:                            .append("	// Build the delete string which will be used by the event processor to remove records.\n");
1633:                    displayHtml.append("	var deleteDBSelObj = document.all('"
1634:                            + getSectionName() + "DeleteDBSel');\n");
1635:                    displayHtml
1636:                            .append("	for (i=0; i< deleteDBSelObj.length; i++) {\n");
1637:                    displayHtml
1638:                            .append("		opt = deleteDBSelObj.options[i].value;\n");
1639:                    displayHtml.append("		tmpStr = tmpStr + opt + \";\";\n");
1640:
1641:                    if (WEB_DEBUG) {
1642:                        displayHtml
1643:                                .append("		alert('Added unassigned option to delete string: ' + opt);\n");
1644:                    }
1645:
1646:                    displayHtml.append("	}\n");
1647:                    displayHtml.append("	document." + getSectionName()
1648:                            + "Form.inpUnassigned.value = tmpStr;\n");
1649:
1650:                    if (WEB_DEBUG) {
1651:                        displayHtml
1652:                                .append("	alert('Delete string: ' + tmpStr);\n");
1653:                    }
1654:
1655:                    displayHtml.append("	tmpStr = \"\";\n");
1656:                    displayHtml.append("\n");
1657:                    displayHtml
1658:                            .append("	// Build the add string which will be used by the event processor to add records.\n");
1659:                    displayHtml.append("	var addDBSelObj = document.all('"
1660:                            + getSectionName() + "AddDBSel');\n");
1661:                    displayHtml
1662:                            .append("	for (i=0; i< addDBSelObj.length; i++)\n");
1663:                    displayHtml.append("	{\n");
1664:                    displayHtml
1665:                            .append("		opt = addDBSelObj.options[i].value;\n");
1666:                    displayHtml.append("		tmpStr = tmpStr + opt + \";\";\n");
1667:
1668:                    if (WEB_DEBUG) {
1669:                        displayHtml
1670:                                .append("		alert('Added assigned option to add string: ' + opt);\n");
1671:                    }
1672:
1673:                    displayHtml.append("	}\n");
1674:                    displayHtml.append("	document." + getSectionName()
1675:                            + "Form.inpAssigned.value = tmpStr;\n");
1676:
1677:                    if (WEB_DEBUG) {
1678:                        displayHtml
1679:                                .append("	alert('Add string: ' + tmpStr);\n");
1680:                    }
1681:
1682:                    displayHtml
1683:                            .append("    // Prevent the onBeforeUnload popup window\n");
1684:                    displayHtml.append("	window.onbeforeunload = null;\n");
1685:                    displayHtml.append("	return false;\n");
1686:                    displayHtml.append("}\n");
1687:                    displayHtml.append("\n");
1688:
1689:                    Debug.logVerbose(
1690:                            "[displaySelectSection] Inserting function "
1691:                                    + getSectionName() + "Send(selectObj)",
1692:                            module);
1693:
1694:                    displayHtml.append("function " + getSectionName()
1695:                            + "Send(selectObj){\n");
1696:
1697:                    if (WEB_DEBUG) {
1698:                        displayHtml
1699:                                .append(" alert('Selected account ID = ' + selectObj.value);\n");
1700:                    }
1701:
1702:                    if (WEB_DEBUG) {
1703:                        displayHtml
1704:                                .append(" alert('Length = ' + selectObj.value.length);\n");
1705:                    }
1706:
1707:                    displayHtml.append(" if(selectObj.value.length > 0) {\n");
1708:                    displayHtml
1709:                            .append("  var searchValue = selectObj.value;\n");
1710:
1711:                    if (WEB_DEBUG) {
1712:                        displayHtml
1713:                                .append("  alert('searchValue = ' + searchValue);\n");
1714:                    }
1715:
1716:                    displayHtml.append("  var selectName = selectObj.name;\n");
1717:
1718:                    if (WEB_DEBUG) {
1719:                        displayHtml
1720:                                .append("  alert('selectName = ' + selectName);\n");
1721:                    }
1722:
1723:                    displayHtml.append("  var searchUrl = '"
1724:                            + getSearchAction()
1725:                            + "?searchValue=' + searchValue");
1726:
1727:                    Iterator sendQueryParameterI = getSendQueryParameterValueMap()
1728:                            .keySet().iterator();
1729:
1730:                    while (sendQueryParameterI.hasNext()) {
1731:                        String sendQueryParameterKey = (String) sendQueryParameterI
1732:                                .next();
1733:                        String sendQueryParameterValue = (String) getSendQueryParameterValueMap()
1734:                                .get(sendQueryParameterKey);
1735:                        displayHtml.append(" + '&" + sendQueryParameterKey
1736:                                + "=" + sendQueryParameterValue + "'");
1737:                    }
1738:
1739:                    displayHtml.append(";\n");
1740:                    displayHtml
1741:                            .append("  var assignedSelectObj = document.all.item('"
1742:                                    + getSectionName() + "AssignedSel');\n");
1743:                    displayHtml
1744:                            .append("  var assignedOptionObjs = assignedSelectObj.children.tags('OPTION');\n");
1745:                    displayHtml
1746:                            .append("  var assignedOptionCount = assignedOptionObjs.length;\n");
1747:                    displayHtml
1748:                            .append("  for (assignedOptionNbr = 0; assignedOptionNbr < assignedOptionCount; assignedOptionNbr++) {\n");
1749:                    displayHtml
1750:                            .append("   var assignedValue = assignedOptionObjs(assignedOptionNbr).value;\n");
1751:                    displayHtml
1752:                            .append("   searchUrl = searchUrl + '&assignedValue_' + assignedOptionNbr + '=' + assignedValue;\n");
1753:                    displayHtml.append("  }\n");
1754:                    displayHtml
1755:                            .append("  searchUrl = searchUrl + '&assignedOptionCount=' + assignedOptionCount;\n");
1756:                    displayHtml.append(";\n");
1757:
1758:                    if (WEB_DEBUG) {
1759:                        displayHtml
1760:                                .append("  alert('searchUrl = ' + searchUrl);\n");
1761:                    }
1762:
1763:                    displayHtml.append("  var anchorObj = document.anchors('"
1764:                            + getSectionName() + "Anchor');\n");
1765:                    displayHtml.append("  anchorObj.href=searchUrl;\n");
1766:                    displayHtml.append("  anchorObj.click();\n");
1767:                    displayHtml.append(" }\n");
1768:                    displayHtml.append("}\n");
1769:                    displayHtml.append("\n");
1770:
1771:                    Debug.logVerbose(
1772:                            "[displaySelectSection] Inserting function "
1773:                                    + getSectionName() + "UpdateAvailable()",
1774:                            module);
1775:
1776:                    displayHtml.append("function " + getSectionName()
1777:                            + "UpdateAvailable() {\n");
1778:
1779:                    if (WEB_DEBUG) {
1780:                        displayHtml.append(" alert('Starting "
1781:                                + getSectionName() + "UpdateAvailable()');\n");
1782:                    }
1783:
1784:                    displayHtml
1785:                            .append(" var searchIframeDoc = document.frames('"
1786:                                    + getSectionName() + "Iframe').document;\n");
1787:                    displayHtml
1788:                            .append(" var realTimeAvailSelectObj = searchIframeDoc.all('"
1789:                                    + getSectionName()
1790:                                    + "RealTimeAvailSelect');\n");
1791:                    displayHtml
1792:                            .append(" var unassignedSelectObj = document.all.item('"
1793:                                    + getSectionName() + "UnassignedSel');\n");
1794:                    displayHtml
1795:                            .append(" if(realTimeAvailSelectObj != null) {\n");
1796:
1797:                    if (WEB_DEBUG) {
1798:                        displayHtml
1799:                                .append("  alert('realTimeAvailSelectObj was found.');\n");
1800:                    }
1801:
1802:                    displayHtml
1803:                            .append("  var oldOptionObjs = unassignedSelectObj.children.tags('OPTION');\n");
1804:                    displayHtml
1805:                            .append("  for (oldOptionNbr = oldOptionObjs.length - 1; oldOptionNbr >= 0; oldOptionNbr--) {\n");
1806:                    displayHtml
1807:                            .append("   // Remove this option from the visible select box\n");
1808:
1809:                    if (WEB_DEBUG) {
1810:                        displayHtml
1811:                                .append("   alert('Removing an old option');\n");
1812:                    }
1813:
1814:                    displayHtml
1815:                            .append("   unassignedSelectObj.removeChild(oldOptionObjs(oldOptionNbr));\n");
1816:                    displayHtml.append("  }\n");
1817:                    displayHtml
1818:                            .append("  var newOptionObjs = realTimeAvailSelectObj.children.tags('OPTION');\n");
1819:                    displayHtml
1820:                            .append("  for (newOptionNbr = 0; newOptionNbr < newOptionObjs.length; newOptionNbr++) {\n");
1821:                    displayHtml
1822:                            .append("   // Create a new element to add to the select\n");
1823:
1824:                    if (WEB_DEBUG) {
1825:                        displayHtml
1826:                                .append("   alert('Tag of child node: ' + newOptionObjs(newOptionNbr).tagName);\n");
1827:                    }
1828:
1829:                    displayHtml
1830:                            .append("   var newUnassignedOptionObj = document.createElement('OPTION');\n");
1831:                    displayHtml
1832:                            .append("   newUnassignedOptionObj.value = newOptionObjs(newOptionNbr).value;\n");
1833:                    displayHtml
1834:                            .append("   newUnassignedOptionObj.text = newOptionObjs(newOptionNbr).text;\n");
1835:
1836:                    if (WEB_DEBUG) {
1837:                        displayHtml
1838:                                .append("   alert('Adding new option: ' + newUnassignedOptionObj.value + '/' + newUnassignedOptionObj.text);\n");
1839:                    }
1840:
1841:                    displayHtml
1842:                            .append("   unassignedSelectObj.options.add(newUnassignedOptionObj, newOptionNbr);\n");
1843:                    displayHtml.append("  }\n");
1844:                    displayHtml.append(" }\n");
1845:                    displayHtml.append("}\n");
1846:                    displayHtml.append("\n");
1847:
1848:                    displayHtml.append("</SCRIPT>\n");
1849:
1850:                    // Make a list of the primary keys of the entities that are already assigned.
1851:                    Debug
1852:                            .logVerbose(
1853:                                    "[displaySelectSection] Getting selected entities.",
1854:                                    module);
1855:
1856:                    ArrayList selectedEntityGVC = new ArrayList();
1857:                    ArrayList selectedEntityPKC = new ArrayList();
1858:
1859:                    for (int row = 0; row < dataMatrix.getCurrentBuffer()
1860:                            .getContents().size(); row++) {
1861:                        // Get the generic value for the current row for the entity being listed.  This must be
1862:                        // the second entity (element 1) in the retrieve order defined in the screen section
1863:                        // entities for this screen section.
1864:                        GenericValue listGV = dataMatrix.getCurrentBuffer()
1865:                                .getGenericValue(row, 1);
1866:                        selectedEntityGVC.add(listGV);
1867:                        selectedEntityPKC.add(listGV.getPrimaryKey());
1868:                    }
1869:
1870:                    // Get the list of all eligible entities.
1871:                    Debug
1872:                            .logVerbose(
1873:                                    "[displaySelectSection] Getting eligible entities.",
1874:                                    module);
1875:
1876:                    List eligibleEntityL = getEligibleEntityList(
1877:                            getUseQueryParameterValueMap(),
1878:                            getUiScreenSectionEntity(1).getUiEntity()
1879:                                    .getEntityName(), userInfo, delegator);
1880:
1881:                    // Remove selected entities from the list of eligible entities.
1882:                    Debug
1883:                            .logVerbose(
1884:                                    "[displaySelectSection] Removing selected entities.",
1885:                                    module);
1886:
1887:                    eligibleEntityL = UIUtility.removeSelectedEligibleEntities(
1888:                            selectedEntityPKC, eligibleEntityL);
1889:
1890:                    // Display the title bar.
1891:                    Debug.logVerbose(
1892:                            "[displaySelectSection] Displaying title bar",
1893:                            module);
1894:
1895:                    displayHtml
1896:                            .append("<TABLE WIDTH=\"100%\" CLASS=\"tabularSectionTitleTable\">\n");
1897:                    displayHtml.append(" <TR>\n");
1898:                    displayHtml.append("\n");
1899:                    displayHtml.append("  <TD>\n");
1900:                    displayHtml
1901:                            .append("   <NOBR>" + sectionTitle + "</NOBR>\n");
1902:                    displayHtml.append("  </TD>\n");
1903:                    displayHtml.append("\n");
1904:
1905:                    if (getIsUpdateable()) {
1906:                        displayHtml.append(displayEditButton(action, "",
1907:                                sendQueryParams, ACTION_QUERY_UPDATE));
1908:                    }
1909:
1910:                    displayHtml.append("     <TD WIDTH=\"70\">\n");
1911:                    displayHtml.append(displaySelectButton(action));
1912:                    displayHtml.append("     </TD>\n");
1913:                    displayHtml.append(displayCustomizeButton());
1914:                    displayHtml.append(" </TR>\n");
1915:                    displayHtml.append("</TABLE>\n"); // End of title table.
1916:                    displayHtml.append("\n");
1917:
1918:                    // Display the select screen contents.
1919:                    // Start of table with one row for the select boxes and one row for the Save button.
1920:                    Debug
1921:                            .logVerbose(
1922:                                    "[displaySelectSection] Displaying screen contents",
1923:                                    module);
1924:
1925:                    displayHtml
1926:                            .append("<TABLE WIDTH=\"100%\" CLASS=\"freeFormSectionDisplayTable\">\n");
1927:
1928:                    if ((getButtonAction() != null)
1929:                            && !getButtonAction().equals("")
1930:                            && getIsUpdateable()) {
1931:                        displayHtml.append(" <FORM METHOD=\"post\" NAME=\""
1932:                                + getSectionName() + "Form\" "
1933:                                + "onSubmit=\"preSubmit" + getSectionName()
1934:                                + "()\" ACTION=\"" + getButtonAction() + "\"");
1935:
1936:                        if ((getButtonTarget() != null)
1937:                                && !getButtonTarget().equals("")) {
1938:                            displayHtml.append(" TARGET=\"" + getButtonTarget()
1939:                                    + "\"");
1940:                        }
1941:
1942:                        displayHtml.append(">\n");
1943:                        displayHtml
1944:                                .append("  <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
1945:                                        + getNextAction(action) + "\">\n");
1946:                        displayHtml.append(sendQueryParams);
1947:                    }
1948:
1949:                    // Display the empty hidden vars to hold the selected and de-selected entity keys.
1950:                    displayHtml
1951:                            .append("  <INPUT TYPE=\"hidden\" NAME=\"inpUnassigned\" ID=\"inpUnassigned\" VALUE=\"\">\n");
1952:                    displayHtml
1953:                            .append("  <INPUT TYPE=\"hidden\" NAME=\"inpAssigned\" ID=\"inpAssigned\" VALUE=\"\">\n");
1954:
1955:                    displayHtml.append("  <TR>\n");
1956:                    displayHtml.append("   <TD>\n");
1957:
1958:                    // Start of table that shows the two select boxes.
1959:                    displayHtml
1960:                            .append("    <TABLE BORDER=\"0\" WIDTH=\"100%\" CLASS=\"freeFormSectionDisplayTable\">\n");
1961:                    displayHtml.append("     <TR>\n");
1962:                    displayHtml
1963:                            .append("      <TD WIDTH=\"25%\" CLASS=\"selectSectionLabel\">Available</TD>\n");
1964:
1965:                    // Insert invisible drop list for setting an extra query parameter for the available list.
1966:                    displayHtml
1967:                            .append("      <TD WIDTH=\"20%\" CLASS=\"selectSectionLabel\">\n");
1968:                    displayHtml.append("        <SELECT ID=\""
1969:                            + getSectionName() + "FilterId\" NAME=\""
1970:                            + getSectionName() + "FilterId\" TABINDEX=\"1\" ");
1971:                    displayHtml
1972:                            .append("CLASS=\"querySelectBox\" STYLE=\"visibility: hidden\" ");
1973:                    displayHtml.append("onchange=\"" + getSectionName()
1974:                            + "Send(this);\">\n");
1975:                    displayHtml.append("        </SELECT>\n");
1976:                    displayHtml.append("      </TD>\n");
1977:
1978:                    displayHtml.append("      <TD></TD>\n"); // Space for arrow button.
1979:                    displayHtml
1980:                            .append("      <TD WIDTH=\"45%\" CLASS=\"selectSectionLabel\">Selected</TD>\n");
1981:                    displayHtml.append("     </TR>\n");
1982:                    displayHtml.append("     <TR>\n");
1983:
1984:                    // Display the eligible (available) entities.
1985:                    displayHtml.append("      <TD COLSPAN=\"2\">\n");
1986:                    displayHtml
1987:                            .append("       <SELECT STYLE=\"width: 100%\" "
1988:                                    + "NAME=\""
1989:                                    + getSectionName()
1990:                                    + "UnassignedSel\" ID=\""
1991:                                    + getSectionName()
1992:                                    + "UnassignedSel\" SIZE=\"10\" onChange=\"handleUnassignedChange"
1993:                                    + getSectionName() + "()\">\n");
1994:
1995:                    Iterator eligibleEntityI = eligibleEntityL.iterator();
1996:
1997:                    while (eligibleEntityI.hasNext()) {
1998:                        GenericValue eligibleGV = (GenericValue) eligibleEntityI
1999:                                .next();
2000:                        GenericPK eligiblePK = eligibleGV.getPrimaryKey();
2001:                        Iterator eligiblePKFieldI = eligiblePK.getAllFields()
2002:                                .entrySet().iterator();
2003:
2004:                        // Add an option to the available select box for this entity.
2005:                        // Example of value with 1 field in the key: "contactId:10341"
2006:                        // Example of value with 3 fields in the key: "displayObjectId:10021,displayTypeId:22320,displayAttribId:SIZE"
2007:                        displayHtml.append("        <OPTION VALUE=\"");
2008:
2009:                        int fieldCount = 0;
2010:                        StringBuffer keyStringBuf = new StringBuffer();
2011:
2012:                        while (eligiblePKFieldI.hasNext()) {
2013:                            Map.Entry eligiblePKField = (Map.Entry) eligiblePKFieldI
2014:                                    .next();
2015:
2016:                            Debug.logVerbose(
2017:                                    "[displaySelectSection] eligiblePKField: "
2018:                                            + eligiblePKField.toString(),
2019:                                    module);
2020:
2021:                            String eligiblePKFieldName = (String) eligiblePKField
2022:                                    .getKey();
2023:
2024:                            Debug.logVerbose(
2025:                                    "[displaySelectSection] eligiblePKFieldName: "
2026:                                            + eligiblePKFieldName.toString(),
2027:                                    module);
2028:
2029:                            String eligiblePKFieldValue = (String) eligiblePKField
2030:                                    .getValue();
2031:
2032:                            Debug.logVerbose(
2033:                                    "[displaySelectSection] eligiblePKFieldValue: "
2034:                                            + eligiblePKFieldValue.toString(),
2035:                                    module);
2036:
2037:                            if (++fieldCount > 1) {
2038:                                keyStringBuf.append(",");
2039:                            }
2040:
2041:                            keyStringBuf.append(eligiblePKFieldName + ":"
2042:                                    + eligiblePKFieldValue);
2043:                        }
2044:
2045:                        // Append the key and the name.
2046:                        Vector listedEntityVector = new Vector();
2047:                        listedEntityVector.add(eligibleGV);
2048:
2049:                        String eligibleItemName = UIUtility
2050:                                .decodeEntityDisplayDef(getSelectNameDef(),
2051:                                        listedEntityVector, "");
2052:                        displayHtml.append(keyStringBuf.toString() + "\">"
2053:                                + eligibleItemName + "\n");
2054:                    }
2055:
2056:                    displayHtml.append("       </SELECT>\n");
2057:                    displayHtml.append("      </TD>\n");
2058:
2059:                    // Display the arrow button.
2060:                    displayHtml.append("      <TD ALIGN=\"center\">\n");
2061:                    displayHtml
2062:                            .append("       <INPUT DISABLED TYPE=\"button\" NAME=\""
2063:                                    + getSectionName()
2064:                                    + "SelectButton\" value=\"---\" "
2065:                                    + "onClick=\"selectTransfer"
2066:                                    + getSectionName() + "(this)\">\n");
2067:                    displayHtml.append("      </TD>\n");
2068:
2069:                    // Display the selected entities.
2070:                    displayHtml.append("      <TD>\n");
2071:                    displayHtml
2072:                            .append("       <SELECT STYLE=\"width: 100%\" "
2073:                                    + "NAME=\""
2074:                                    + getSectionName()
2075:                                    + "AssignedSel\" ID=\""
2076:                                    + getSectionName()
2077:                                    + "AssignedSel\" SIZE=\"10\" onChange=\"handleAssignedChange"
2078:                                    + getSectionName() + "()\">\n");
2079:
2080:                    Iterator selectedEntityGVI = selectedEntityGVC.iterator();
2081:
2082:                    while (selectedEntityGVI.hasNext()) {
2083:                        GenericValue selectedGV = (GenericValue) selectedEntityGVI
2084:                                .next();
2085:                        GenericPK selectedPK = (GenericPK) selectedGV
2086:                                .getPrimaryKey();
2087:                        Iterator selectedPKFieldI = selectedPK.getAllFields()
2088:                                .entrySet().iterator();
2089:
2090:                        // Add an option to the available select box for this entity.
2091:                        // Example of value with 1 field in the key: "contactId:10341"
2092:                        // Example of value with 3 fields in the key: "displayObjectId:10021,displayTypeId:22320,displayAttribId:SIZE"
2093:                        displayHtml.append("        <OPTION VALUE=\"");
2094:
2095:                        int fieldCount = 0;
2096:                        StringBuffer keyStringBuf = new StringBuffer();
2097:
2098:                        while (selectedPKFieldI.hasNext()) {
2099:                            Map.Entry selectedPKField = (Map.Entry) selectedPKFieldI
2100:                                    .next();
2101:
2102:                            Debug.logVerbose(
2103:                                    "[displaySelectSection] selectedPKField: "
2104:                                            + selectedPKField.toString(),
2105:                                    module);
2106:
2107:                            String selectedPKFieldName = (String) selectedPKField
2108:                                    .getKey();
2109:                            String selectedPKFieldValue = (String) selectedPKField
2110:                                    .getValue();
2111:
2112:                            if (++fieldCount > 1) {
2113:                                keyStringBuf.append(",");
2114:                            }
2115:
2116:                            keyStringBuf.append(selectedPKFieldName + ":"
2117:                                    + selectedPKFieldValue);
2118:                        }
2119:
2120:                        // Append the key and the name.
2121:                        Vector listedEntityVector = new Vector();
2122:                        listedEntityVector.add(selectedGV);
2123:
2124:                        String selectedItemName = UIUtility
2125:                                .decodeEntityDisplayDef(getSelectNameDef(),
2126:                                        listedEntityVector, "");
2127:                        displayHtml.append(keyStringBuf.toString() + "\">"
2128:                                + selectedItemName + "\n");
2129:                    }
2130:
2131:                    displayHtml.append("       </SELECT>\n");
2132:                    displayHtml.append("      </TD>\n");
2133:                    displayHtml.append("     </TR>\n");
2134:                    displayHtml.append("    </TABLE>\n"); // End of table that shows the two select boxes.
2135:
2136:                    displayHtml.append("   </TD>\n");
2137:                    displayHtml.append("  </TR>\n");
2138:
2139:                    if ((getButtonAction() != null)
2140:                            && !getButtonAction().equals("")
2141:                            && (getButtonTarget() != null)
2142:                            && !getButtonTarget().equals("")
2143:                            && getIsUpdateable()) {
2144:                        displayHtml.append("  <TR>\n");
2145:                        displayHtml
2146:                                .append("   <TD CLASS=\"freeFormSectionSaveButtonArea\">\n");
2147:                        displayHtml
2148:                                .append("    <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\""
2149:                                        + getSectionName()
2150:                                        + "SaveButton\" VALUE=\"Save\">\n");
2151:                        displayHtml.append("   </TD>\n");
2152:                        displayHtml.append("  </TR>\n");
2153:                        displayHtml.append("\n");
2154:                    }
2155:
2156:                    // Create hidden SELECTs for items to be added or deleted.
2157:                    displayHtml.append("  <TR>\n");
2158:                    displayHtml
2159:                            .append("   <TD CLASS=\"freeFormSectionSaveButtonArea\">\n");
2160:                    displayHtml
2161:                            .append("    <SELECT STYLE=\"visibility: hidden\" "
2162:                                    + "NAME=\"" + getSectionName()
2163:                                    + "AddDBSel\" ID=\"" + getSectionName()
2164:                                    + "AddDBSel\"></SELECT>\n");
2165:                    displayHtml
2166:                            .append("    <SELECT STYLE=\"visibility: hidden\" "
2167:                                    + "NAME=\"" + getSectionName()
2168:                                    + "DeleteDBSel\" ID=\"" + getSectionName()
2169:                                    + "DeleteDBSel\"></SELECT>\n");
2170:                    displayHtml.append("   </TD>\n");
2171:                    displayHtml.append("  </TR>\n");
2172:
2173:                    if ((getButtonAction() != null)
2174:                            && !getButtonAction().equals("")
2175:                            && (getButtonTarget() != null)
2176:                            && !getButtonTarget().equals("")
2177:                            && getIsUpdateable()) {
2178:                        displayHtml.append(" </FORM>\n");
2179:                    }
2180:
2181:                    displayHtml.append("</TABLE>\n");
2182:
2183:                    // End of table with one row for the select boxes and one row for the Save button.
2184:                    // Create hidden Anchor and I-Frame for searching for available values.
2185:                    displayHtml.append("<A STYLE='visibility:hidden' ID='"
2186:                            + getSectionName() + "Anchor' " + "NAME='"
2187:                            + getSectionName() + "Anchor' " + "TARGET='"
2188:                            + getSectionName() + "Iframe'>\n");
2189:                    displayHtml.append("</A>\n");
2190:                    displayHtml
2191:                            .append("<IFRAME STYLE='visibility:hidden; width:0; height:0; margin:0; padding:0;' "
2192:                                    + "ID='"
2193:                                    + getSectionName()
2194:                                    + "Iframe' NAME='"
2195:                                    + getSectionName()
2196:                                    + "Iframe' "
2197:                                    + "FRAMEBORDER='0' FRAMESPACING='0' MARGINWIDTH='0' MARGINHEIGHT='0' "
2198:                                    + "onload='"
2199:                                    + getSectionName()
2200:                                    + "UpdateAvailable();'>\n");
2201:                    displayHtml.append("</IFRAME>\n");
2202:                    displayHtml.append("\n");
2203:                } else {
2204:                    // Don't need to display this section in select mode right now.  Just display it as a normal
2205:                    // tabular section.
2206:                    displayHtml.append(displayTabularSection(dataMatrix,
2207:                            action, sectionTitle, queryId));
2208:                }
2209:
2210:                Debug.logVerbose(
2211:                        "[displaySelectSection] Finished Screen name: "
2212:                                + getUiScreen().getScreenName()
2213:                                + " - SectionName = " + getSectionName(),
2214:                        module);
2215:
2216:                return displayHtml.toString();
2217:            }
2218:
2219:            /**
2220:             * DOCUMENT ME!
2221:             *
2222:             * @param useQueryParameterValueMap 
2223:             * @param listedEntityName 
2224:             * @param userInfo 
2225:             * @param delegator 
2226:             *
2227:             * @return 
2228:             */
2229:            public List getEligibleEntityList(
2230:                    HashMap useQueryParameterValueMap, String listedEntityName,
2231:                    UserInfo userInfo, GenericDelegator delegator) {
2232:
2233:                Debug.logVerbose("[getEligibleEntityList] Start", module);
2234:
2235:                ArrayList eligibleEntities = new ArrayList();
2236:
2237:                // Default to all values of the given entity type.  Descendant should override this if filtering
2238:                // is required.
2239:                try {
2240:                    List listedEntityGVL = delegator.findAll(listedEntityName);
2241:                    Iterator listedEntityGVI = listedEntityGVL.iterator();
2242:
2243:                    while (listedEntityGVI.hasNext()) {
2244:                        GenericValue listedEntityGV = (GenericValue) listedEntityGVI
2245:                                .next();
2246:                        eligibleEntities.add(listedEntityGV);
2247:                    }
2248:                } catch (GenericEntityException e) {
2249:                    Debug
2250:                            .logError(
2251:                                    "UIWebScreenSection.getEligibleEntityList] An error occurred while searching for eligible "
2252:                                            + listedEntityName + " entities:",
2253:                                    module);
2254:                    Debug.logError(e.getLocalizedMessage(), module);
2255:
2256:                    return eligibleEntities;
2257:                }
2258:
2259:                Debug.logVerbose("[getEligibleEntityList] End", module);
2260:
2261:                return eligibleEntities;
2262:            }
2263:
2264:            /**
2265:             * This function returns a string containing the HTML text needed to display a field in the format
2266:             * defined by the display object to which it is attached.
2267:             * @param entityDetailsVector A vector containing GenericValues objects for the entities being displayed
2268:             * one the screen.  The primary entity should be put into the vector first
2269:             * in the calling script.  This is required so this function can get the value for the current field,
2270:             * and also in case we need to do any logic with other values from the screen, such as filtering a dropdown list.
2271:             * @param action If this is ACTION_SHOW or "", the HTML text will be modified to make the field non-editable.
2272:             * @return String An HTML String for display.
2273:             */
2274:            public String displayField(UIFieldInfo fieldInfo,
2275:                    Vector entityDetailsVector, String action, int row,
2276:                    boolean isSubsection, int tabOffset) {
2277:                UtilTimer timer = new UtilTimer();
2278:
2279:                if (TIMER) {
2280:                    timer.timerString(3,
2281:                            "[UIWebScreenSection.displayField] Start "
2282:                                    + fieldInfo.getUiAttribute()
2283:                                            .getAttributeName());
2284:                }
2285:
2286:                StringBuffer displayHtml = new StringBuffer();
2287:                int maxLength;
2288:                GenericValue genericValue = null;
2289:                String findAttributeValue = "";
2290:                boolean protect = false;
2291:
2292:                Debug.logVerbose("[displayField()] getEntityName()      -> "
2293:                        + fieldInfo.getUiAttribute().getUiEntity()
2294:                                .getEntityName(), module);
2295:                Debug
2296:                        .logVerbose(
2297:                                "[displayField()] getAttributeName()       ->"
2298:                                        + fieldInfo.getUiAttribute()
2299:                                                .getAttributeName(), module);
2300:
2301:                // If the screen is being displayed in query mode, and the current field is not searchable, don't display it.
2302:                Debug.logVerbose("[displayField()] action               -> "
2303:                        + action, module);
2304:                Debug.logVerbose("[displayField()] getIsSearchable()    -> "
2305:                        + String.valueOf(fieldInfo.getIsSearchable()), module);
2306:
2307:                if ((action.equals(ACTION_SHOW_QUERY)
2308:                        || action.equals(ACTION_SHOW_QUERY_REPORT) || action
2309:                        .equals(ACTION_SHOW_REPORT))
2310:                        && !fieldInfo.getIsSearchable()) {
2311:                    if (TIMER) {
2312:                        timer
2313:                                .timerString(3,
2314:                                        "[UIWebScreenSection.displayField] in query mode and not a searchable field");
2315:                    }
2316:
2317:                    return "";
2318:                }
2319:
2320:                // Get the details of the field's entity.  For example, if this is the account detail screen,
2321:                // but the current field is the city from the Address entity, this will get the address entity
2322:                // off the vector that was passed in.
2323:                GenericValue fieldEntityDetails = null;
2324:                Iterator entityDetailsIterator = entityDetailsVector.iterator();
2325:
2326:                while (entityDetailsIterator.hasNext()) {
2327:                    GenericValue testEntity = (GenericValue) entityDetailsIterator
2328:                            .next();
2329:
2330:                    if (testEntity.getEntityName().equals(
2331:                            fieldInfo.getUiAttribute().getUiEntity()
2332:                                    .getEntityName())) {
2333:                        fieldEntityDetails = testEntity;
2334:                    }
2335:                }
2336:
2337:                if (fieldEntityDetails == null) {
2338:                    Debug
2339:                            .logVerbose(
2340:                                    "[displayField()] fieldEntityDetails is null.  Assuming a null field",
2341:                                    module);
2342:
2343:                    if (TIMER) {
2344:                        timer
2345:                                .timerString(
2346:                                        3,
2347:                                        "[UIWebScreenSection.displayField] fieldEntityDetails is null.  Assuming a null field");
2348:                    }
2349:
2350:                    return "";
2351:                }
2352:
2353:                // Get the details of the primary entity being displayed on the screen.  For example, if this is
2354:                // the account detail screen, this will get the account entity off the vector that was passed in.
2355:                GenericValue primaryEntityDetails = (GenericValue) entityDetailsVector
2356:                        .firstElement();
2357:
2358:                // Get the current field's value passed in from the jsp script.
2359:                String fieldValue = (String.valueOf(fieldEntityDetails
2360:                        .get(fieldInfo.getUiAttribute().getAttributeName())) != null) ? String
2361:                        .valueOf(fieldEntityDetails.get(fieldInfo
2362:                                .getUiAttribute().getAttributeName()))
2363:                        : "";
2364:
2365:                if ((fieldValue == null) || fieldValue.equals("null")) {
2366:                    fieldValue = "";
2367:                }
2368:
2369:                Debug.logVerbose("[displayField()] fieldValue           -> "
2370:                        + fieldValue, module);
2371:
2372:                if (fieldInfo.getUiAttribute().getUiEntity().getEntityName()
2373:                        .equals("")) {
2374:                    // Entity name not specified.
2375:                    Debug
2376:                            .logWarning(
2377:                                    "[UIWebScreenSection.displayField]: Entity name not specified.",
2378:                                    module);
2379:
2380:                    if (TIMER) {
2381:                        timer
2382:                                .timerString(3,
2383:                                        "[UIWebScreenSection.displayField] End (entity name not specified)");
2384:                    }
2385:
2386:                    return fieldValue;
2387:                }
2388:
2389:                if (fieldInfo.getUiAttribute().getAttributeName().equals("")) {
2390:                    // Field name not specified.
2391:                    Debug
2392:                            .logWarning(
2393:                                    "[UIWebScreenSection.displayField]: Field name not specified.",
2394:                                    module);
2395:
2396:                    if (TIMER) {
2397:                        timer
2398:                                .timerString(3,
2399:                                        "[UIWebScreenSection.displayField] End (attribute name not specified)");
2400:                    }
2401:
2402:                    return fieldValue;
2403:                }
2404:
2405:                if (action.equals(ACTION_SHOW)
2406:                        || action.equals(ACTION_INSERT)
2407:                        || action.equals(ACTION_UPDATE)
2408:                        || action.equals(ACTION_QUERY)
2409:                        || action.equals("")
2410:                        || (action == null)
2411:                        || ((fieldInfo.getIsReadOnly() || !fieldInfo
2412:                                .getUiScreenSectionEntity().getIsUpdateable())
2413:                                && !action.equals(ACTION_SHOW_QUERY)
2414:                                && !action.equals(ACTION_SHOW_QUERY_REPORT) && !action
2415:                                .equals(ACTION_SHOW_REPORT))
2416:                        || ((action.equals(ACTION_SHOW_UPDATE) || action
2417:                                .equals(ACTION_QUERY_UPDATE)) && fieldInfo
2418:                                .getUiAttribute().getIsPk())) {
2419:                    protect = true;
2420:                }
2421:
2422:                // If the action is SHOW_COPY, and this is a primary key field that is auto-generated, need to clear the value
2423:                // before displaying.  The original value will be saved as is in case the primary key of the copied record
2424:                // is needed for custom processing later.
2425:                // Save a copy of the original field value in case we change the field value.
2426:                String origFieldValue = fieldValue;
2427:
2428:                if (UIWebUtility.getIsCopiedPrimaryKey(action, fieldInfo)) {
2429:                    fieldValue = "";
2430:
2431:                    Debug.logVerbose(
2432:                            "[displayField()] Clearing primary key field.",
2433:                            module);
2434:
2435:                }
2436:
2437:                String htmlName = UIWebUtility.getHtmlName(getSectionName(),
2438:                        fieldInfo, row);
2439:                String htmlNameOriginal = UIWebUtility.getHtmlNameOriginal(
2440:                        getSectionName(), fieldInfo, row);
2441:                int tabIndex = tabOffset + fieldInfo.getDisplayOrder();
2442:                UIDisplayObject uiDisplayObject = fieldInfo
2443:                        .getUiDisplayObject();
2444:
2445:                try {
2446:                    uiDisplayObject.loadAttributes();
2447:
2448:                    Debug.logVerbose(
2449:                            "[displayField()] Starting to decode field "
2450:                                    + htmlName + " of type "
2451:                                    + uiDisplayObject.getDisplayTypeId(),
2452:                            module);
2453:
2454:                    if (uiDisplayObject.getDisplayTypeId().equals(
2455:                            UIDisplayObject.DISPLAY_TYPE_SELECT)) {
2456:                        // Default to the generic UIDropDown class.
2457:                        String uiDropDownClassName = "";
2458:
2459:                        if (uiDisplayObject.getAttribEntityFindMethod().equals(
2460:                                "CUSTOM_CLASS")) {
2461:                            // A custom class has been constructed to handle the retrieval of entities from the data base.
2462:                            // Need to use that class instead of the plain UIDropDown class.
2463:                            uiDropDownClassName = uiDisplayObject
2464:                                    .getAttribEntityFindDef();
2465:                        }
2466:
2467:                        UIDropDown uiDropDown = UIUtility
2468:                                .getUIDropDown(uiDropDownClassName);
2469:                        displayHtml.append(uiDropDown.displayFieldHtml(
2470:                                uiDisplayObject, protect, htmlName, fieldValue,
2471:                                entityDetailsVector, fieldInfo, action,
2472:                                tabIndex, getUserInfo(), getDelegator()));
2473:
2474:                        if (TIMER) {
2475:                            timer.timerString(3,
2476:                                    "[UIWebScreenSection.displayField] End "
2477:                                            + fieldInfo.getUiAttribute()
2478:                                                    .getAttributeName()
2479:                                            + " (text - protected)");
2480:                        }
2481:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2482:                            UIDisplayObject.DISPLAY_TYPE_SEARCH_TEXT)) {
2483:                        // Search Text field.  Searches for a value and then turns into a select field.
2484:
2485:                        /*
2486:                         * fieldName (htmlName) , entityName (ENTITY), idName (ENTITY_VALUE_DEF)
2487:                                <script for='firstName' event='onblur()' language='JavaScript'>sendData(this, this.form);</script>
2488:                                <script for='firstName' event='onchange()' language='JavaScript'>searchAgain(this, this.form);</script>
2489:                                <p id='firstNameHolder' name='firstNameHolder' >
2490:                                <input type="text" name="firstName" id="firstName" entityName="Contact" fieldName="firstName" idName="contactId" >
2491:                                </p>
2492:                         */
2493:
2494:                        // Default to the generic UISearchField class.
2495:                        String uiSearchFieldClassName = "";
2496:
2497:                        if (uiDisplayObject.getAttribEntityFindMethod().equals(
2498:                                "CUSTOM_CLASS")) {
2499:                            // A custom class has been constructed to handle the retrieval of entities from the data base.
2500:                            // Need to use that class instead of the plain UISearchField class.
2501:                            uiSearchFieldClassName = uiDisplayObject
2502:                                    .getAttribEntityFindDef();
2503:                        }
2504:
2505:                        UISearchField uiSearchField = UIUtility
2506:                                .getUISearchField(uiSearchFieldClassName);
2507:                        displayHtml.append(uiSearchField.displayFieldHtml(
2508:                                uiDisplayObject, protect, htmlName, fieldValue,
2509:                                entityDetailsVector, fieldInfo, action,
2510:                                tabIndex, getUserInfo(), getDelegator()));
2511:
2512:                        if (TIMER) {
2513:                            timer.timerString(3,
2514:                                    "[UIWebScreenSection.displayField] End "
2515:                                            + fieldInfo.getUiAttribute()
2516:                                                    .getAttributeName()
2517:                                            + " (text - protected)");
2518:                        }
2519:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2520:                            UIDisplayObject.DISPLAY_TYPE_TEXT)) {
2521:                        // Text field
2522:                        if (!protect) {
2523:                            // Mode is not protected, so create a text tag.
2524:                            displayHtml.append("<INPUT TYPE=\"TEXT\" NAME=\""
2525:                                    + htmlName + "\" TABINDEX=\""
2526:                                    + String.valueOf(tabIndex) + "\" ");
2527:                            displayHtml.append(UIWebUtility
2528:                                    .translateAttribSize(uiDisplayObject
2529:                                            .getAttribSize()));
2530:                            displayHtml
2531:                                    .append(UIWebUtility
2532:                                            .translateAttribMaxLength(
2533:                                                    uiDisplayObject
2534:                                                            .getAttribMaxLength(),
2535:                                                    String.valueOf(fieldInfo
2536:                                                            .getMaxLength())));
2537:                            displayHtml.append(UIWebUtility
2538:                                    .translateAttribDisabled(uiDisplayObject
2539:                                            .getAttribDisabled()));
2540:                            displayHtml.append(UIWebUtility
2541:                                    .translateAttribReadOnly(uiDisplayObject
2542:                                            .getAttribReadOnly()));
2543:                            displayHtml.append(UIWebUtility
2544:                                    .translateAttribAlign(uiDisplayObject
2545:                                            .getAttribAlign()));
2546:                            displayHtml.append(UIWebUtility
2547:                                    .translateAttribClass(uiDisplayObject
2548:                                            .getAttribClass(action, fieldInfo
2549:                                                    .getIsMandatory())));
2550:                            displayHtml.append(" VALUE='" + fieldValue + "'>");
2551:
2552:                            if (fieldInfo.getIsMandatory()
2553:                                    && !action.equals(ACTION_SHOW_QUERY)
2554:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
2555:                                    && !action.equals(ACTION_SHOW_REPORT)) {
2556:                                displayHtml.append("*\n");
2557:                            }
2558:
2559:                            if (TIMER) {
2560:                                timer.timerString(3,
2561:                                        "[UIWebScreenSection.displayField] End "
2562:                                                + fieldInfo.getUiAttribute()
2563:                                                        .getAttributeName()
2564:                                                + " (text)");
2565:                            }
2566:                        } else {
2567:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
2568:                            // Create an anchor tag if the ANCHOR_HREF_DEF attribute was set in the display object.
2569:                            displayHtml.append(UIWebUtility
2570:                                    .displayFieldReadOnly(uiDisplayObject,
2571:                                            htmlName, fieldValue, fieldValue,
2572:                                            entityDetailsVector));
2573:
2574:                            if (TIMER) {
2575:                                timer.timerString(3,
2576:                                        "[UIWebScreenSection.displayField] End "
2577:                                                + fieldInfo.getUiAttribute()
2578:                                                        .getAttributeName()
2579:                                                + " (text - protected)");
2580:                            }
2581:                        }
2582:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2583:                            UIDisplayObject.DISPLAY_TYPE_FILE)) {
2584:                        // Text field
2585:                        if (!protect) {
2586:                            // Mode is not protected, so create a text tag.
2587:                            displayHtml.append("<INPUT TYPE=\"FILE\" NAME=\""
2588:                                    + htmlName + "\" TABINDEX=\""
2589:                                    + String.valueOf(tabIndex) + "\" ");
2590:                            displayHtml.append(UIWebUtility
2591:                                    .translateAttribSize(uiDisplayObject
2592:                                            .getAttribSize()));
2593:                            displayHtml
2594:                                    .append(UIWebUtility
2595:                                            .translateAttribMaxLength(
2596:                                                    uiDisplayObject
2597:                                                            .getAttribMaxLength(),
2598:                                                    String.valueOf(fieldInfo
2599:                                                            .getMaxLength())));
2600:                            displayHtml.append(UIWebUtility
2601:                                    .translateAttribDisabled(uiDisplayObject
2602:                                            .getAttribDisabled()));
2603:                            displayHtml.append(UIWebUtility
2604:                                    .translateAttribReadOnly(uiDisplayObject
2605:                                            .getAttribReadOnly()));
2606:                            displayHtml.append(UIWebUtility
2607:                                    .translateAttribAlign(uiDisplayObject
2608:                                            .getAttribAlign()));
2609:                            displayHtml.append(UIWebUtility
2610:                                    .translateAttribClass(uiDisplayObject
2611:                                            .getAttribClass(action, fieldInfo
2612:                                                    .getIsMandatory())));
2613:                            displayHtml.append(" VALUE='" + fieldValue + "'>");
2614:
2615:                            if (fieldInfo.getIsMandatory()
2616:                                    && !action.equals(ACTION_SHOW_QUERY)
2617:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
2618:                                    && !action.equals(ACTION_SHOW_REPORT)) {
2619:                                displayHtml.append("*\n");
2620:                            }
2621:
2622:                            if (TIMER) {
2623:                                timer.timerString(3,
2624:                                        "[UIWebScreenSection.displayField] End "
2625:                                                + fieldInfo.getUiAttribute()
2626:                                                        .getAttributeName()
2627:                                                + " (text)");
2628:                            }
2629:                        } else {
2630:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
2631:                            // Create an anchor tag if the ANCHOR_HREF_DEF attribute was set in the display object.
2632:                            displayHtml.append(UIWebUtility
2633:                                    .displayFieldReadOnly(uiDisplayObject,
2634:                                            htmlName, fieldValue, fieldValue,
2635:                                            entityDetailsVector));
2636:
2637:                            if (TIMER) {
2638:                                timer.timerString(3,
2639:                                        "[UIWebScreenSection.displayField] End "
2640:                                                + fieldInfo.getUiAttribute()
2641:                                                        .getAttributeName()
2642:                                                + " (text - protected)");
2643:                            }
2644:                        }
2645:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2646:                            UIDisplayObject.DISPLAY_TYPE_CHECKBOX)) {
2647:                        // Check box
2648:                        if (!protect) {
2649:                            // Mode is not protected, so create an input tag.
2650:                            displayHtml
2651:                                    .append("<INPUT TYPE=\"CHECKBOX\" NAME=\""
2652:                                            + htmlName + "\" TABINDEX=\""
2653:                                            + String.valueOf(tabIndex) + "\" ");
2654:
2655:                            if (fieldValue.equals(uiDisplayObject
2656:                                    .getAttribCheckedValue())) {
2657:                                displayHtml.append("CHECKED ");
2658:                            }
2659:
2660:                            displayHtml.append(UIWebUtility
2661:                                    .translateAttribSize(uiDisplayObject
2662:                                            .getAttribSize()));
2663:                            displayHtml.append(UIWebUtility
2664:                                    .translateAttribDisabled(uiDisplayObject
2665:                                            .getAttribDisabled()));
2666:                            displayHtml.append(UIWebUtility
2667:                                    .translateAttribReadOnly(uiDisplayObject
2668:                                            .getAttribReadOnly()));
2669:                            displayHtml.append(UIWebUtility
2670:                                    .translateAttribClass(uiDisplayObject
2671:                                            .getAttribClass(action, fieldInfo
2672:                                                    .getIsMandatory())));
2673:                            displayHtml.append(">\n");
2674:
2675:                            if (fieldInfo.getIsMandatory()
2676:                                    && !action.equals(ACTION_SHOW_QUERY)
2677:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
2678:                                    && !action.equals(ACTION_SHOW_REPORT)) {
2679:                                displayHtml.append("*\n");
2680:                            }
2681:
2682:                            if (TIMER) {
2683:                                timer.timerString(3,
2684:                                        "[UIWebScreenSection.displayField] End "
2685:                                                + fieldInfo.getUiAttribute()
2686:                                                        .getAttributeName()
2687:                                                + " (checkbox)");
2688:                            }
2689:                        } else {
2690:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
2691:                            displayHtml.append("<INPUT TYPE=\"HIDDEN\" NAME=\""
2692:                                    + htmlName + "\" VALUE='" + fieldValue
2693:                                    + "'>\n");
2694:
2695:                            if (fieldValue.equals(uiDisplayObject
2696:                                    .getAttribCheckedValue())) {
2697:                                displayHtml.append(uiDisplayObject
2698:                                        .getAttribCheckedDisplay());
2699:                            } else if (fieldValue.equals(uiDisplayObject
2700:                                    .getAttribUncheckedValue())) {
2701:                                displayHtml.append(uiDisplayObject
2702:                                        .getAttribUncheckedDisplay());
2703:                            } else {
2704:                                displayHtml.append("Undefined");
2705:                            }
2706:
2707:                            if (TIMER) {
2708:                                timer.timerString(3,
2709:                                        "[UIWebScreenSection.displayField] End "
2710:                                                + fieldInfo.getUiAttribute()
2711:                                                        .getAttributeName()
2712:                                                + " (checkbox - protected)");
2713:                            }
2714:                        }
2715:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2716:                            UIDisplayObject.DISPLAY_TYPE_NUMBER)
2717:                            || uiDisplayObject.getDisplayTypeId().equals(
2718:                                    UIDisplayObject.DISPLAY_TYPE_CURRENCY)
2719:                            || uiDisplayObject.getDisplayTypeId().equals(
2720:                                    UIDisplayObject.DISPLAY_TYPE_PERCENT)) {
2721:                        // Number or currency field
2722:                        String formattedNumberString = fieldValue;
2723:
2724:                        if ((fieldValue != null) && !fieldValue.equals("")) {
2725:                            NumberFormat numberFormat = null;
2726:
2727:                            if (uiDisplayObject.getDisplayTypeId().equals(
2728:                                    "NUMBER")) {
2729:                                numberFormat = NumberFormat.getInstance();
2730:                            } else if (uiDisplayObject.getDisplayTypeId()
2731:                                    .equals("CURRENCY")) {
2732:                                numberFormat = NumberFormat
2733:                                        .getCurrencyInstance();
2734:                            } else if (uiDisplayObject.getDisplayTypeId()
2735:                                    .equals("PERCENT")) {
2736:                                numberFormat = NumberFormat
2737:                                        .getPercentInstance();
2738:                            }
2739:
2740:                            Debug.logVerbose(
2741:                                    "[displayField()] Starting to parse number from "
2742:                                            + fieldValue, module);
2743:
2744:                            DecimalFormat decimalParser = new DecimalFormat();
2745:                            ParsePosition parsePosition = new ParsePosition(0);
2746:                            Number parsedNumber = decimalParser.parse(
2747:                                    fieldValue, parsePosition);
2748:
2749:                            Debug.logVerbose(
2750:                                    "[displayField()] Finished parsing number: "
2751:                                            + String.valueOf(parsedNumber),
2752:                                    module);
2753:
2754:                            formattedNumberString = numberFormat
2755:                                    .format(parsedNumber);
2756:
2757:                            // Change the original and current value strings to match the formatted value so a false change won't
2758:                            // be detected when the user navigates away from this screen section.
2759:                            origFieldValue = formattedNumberString;
2760:
2761:                            if (!UIWebUtility.getIsCopiedPrimaryKey(action,
2762:                                    fieldInfo)) {
2763:                                fieldValue = formattedNumberString;
2764:                            }
2765:                        }
2766:
2767:                        if (!protect) {
2768:                            // Mode is not protected, so create a text tag.
2769:                            displayHtml.append("<INPUT TYPE=\"TEXT\" NAME=\""
2770:                                    + htmlName + "\" TABINDEX=\""
2771:                                    + String.valueOf(tabIndex) + "\" ");
2772:                            displayHtml.append(UIWebUtility
2773:                                    .translateAttribSize(uiDisplayObject
2774:                                            .getAttribSize()));
2775:                            displayHtml
2776:                                    .append(UIWebUtility
2777:                                            .translateAttribMaxLength(
2778:                                                    uiDisplayObject
2779:                                                            .getAttribMaxLength(),
2780:                                                    String.valueOf(fieldInfo
2781:                                                            .getMaxLength())));
2782:                            displayHtml.append(UIWebUtility
2783:                                    .translateAttribDisabled(uiDisplayObject
2784:                                            .getAttribDisabled()));
2785:                            displayHtml.append(UIWebUtility
2786:                                    .translateAttribReadOnly(uiDisplayObject
2787:                                            .getAttribReadOnly()));
2788:                            displayHtml.append(UIWebUtility
2789:                                    .translateAttribAlign(uiDisplayObject
2790:                                            .getAttribAlign()));
2791:                            displayHtml.append(UIWebUtility
2792:                                    .translateAttribClass(uiDisplayObject
2793:                                            .getAttribClass(action, fieldInfo
2794:                                                    .getIsMandatory())));
2795:                            displayHtml.append(" VALUE=\""
2796:                                    + formattedNumberString + "\">");
2797:
2798:                            if (fieldInfo.getIsMandatory()
2799:                                    && !action.equals(ACTION_SHOW_QUERY)
2800:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
2801:                                    && !action.equals(ACTION_SHOW_REPORT)) {
2802:                                displayHtml.append("*\n");
2803:                            }
2804:
2805:                            if (TIMER) {
2806:                                timer.timerString(3,
2807:                                        "[UIWebScreenSection.displayField] End "
2808:                                                + fieldInfo.getUiAttribute()
2809:                                                        .getAttributeName()
2810:                                                + " (number)");
2811:                            }
2812:                        } else {
2813:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
2814:                            displayHtml.append(UIWebUtility
2815:                                    .displayFieldReadOnly(uiDisplayObject,
2816:                                            htmlName, fieldValue,
2817:                                            formattedNumberString,
2818:                                            entityDetailsVector));
2819:
2820:                            if (TIMER) {
2821:                                timer.timerString(3,
2822:                                        "[UIWebScreenSection.displayField] End "
2823:                                                + fieldInfo.getUiAttribute()
2824:                                                        .getAttributeName()
2825:                                                + " (number - protected)");
2826:                            }
2827:                        }
2828:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
2829:                            UIDisplayObject.DISPLAY_TYPE_DATE)
2830:                            || uiDisplayObject.getDisplayTypeId().equals(
2831:                                    UIDisplayObject.DISPLAY_TYPE_TIME)
2832:                            || uiDisplayObject.getDisplayTypeId().equals(
2833:                                    UIDisplayObject.DISPLAY_TYPE_DATETIME)) {
2834:                        // Date, DateTime, or Time field
2835:                        String formattedDateString = fieldValue;
2836:
2837:                        if ((fieldValue != null) && !fieldValue.equals("")) {
2838:                            Debug
2839:                                    .logVerbose(
2840:                                            "-->[UIFieldsInfo.displayField()] Field value is not null.",
2841:                                            module);
2842:
2843:                            SimpleDateFormat dateFormat = null;
2844:
2845:                            // Try to parse as an sql DATETIME column.
2846:                            String parseMask = "yyyy-MM-dd HH:mm:ss.S";
2847:
2848:                            Debug.logVerbose(
2849:                                    "[displayField()] Starting to parse date from "
2850:                                            + fieldValue + " using mask "
2851:                                            + parseMask, module);
2852:
2853:                            SimpleDateFormat dateParser = new SimpleDateFormat(
2854:                                    parseMask);
2855:                            ParsePosition parsePosition = new ParsePosition(0);
2856:                            Date parsedDate = dateParser.parse(fieldValue,
2857:                                    parsePosition);
2858:
2859:                            if (parsedDate == null) {
2860:                                // Try to parse as an sql DATE column.
2861:                                parseMask = "yyyy-MM-dd";
2862:
2863:                                Debug.logVerbose(
2864:                                        "[displayField()] Starting to parse date from "
2865:                                                + fieldValue + " using mask "
2866:                                                + parseMask, module);
2867:
2868:                                dateParser = new SimpleDateFormat(parseMask);
2869:                                parsedDate = dateParser.parse(fieldValue,
2870:                                        parsePosition);
2871:                            }
2872:
2873:                            Debug
2874:                                    .logVerbose(
2875:                                            "-->[UIFieldsInfo.displayField()] Finished parsing date.",
2876:                                            module);
2877:
2878:                            if (parsedDate != null) {
2879:                                Debug
2880:                                        .logVerbose(
2881:                                                "-->[UIFieldsInfo.displayField()] Parsed date is not null.",
2882:                                                module);
2883:
2884:                                if (uiDisplayObject.getDisplayTypeId().equals(
2885:                                        "DATE")) {
2886:                                    if (uiDisplayObject.getAttribDisplayMask()
2887:                                            .equals("")) {
2888:                                        // Use system default date mask.
2889:                                        Debug
2890:                                                .logVerbose(
2891:                                                        "[displayField()] DATE: using standard date format.",
2892:                                                        module);
2893:
2894:                                        dateFormat = (SimpleDateFormat) DateFormat
2895:                                                .getDateInstance(DateFormat.SHORT);
2896:                                    } else {
2897:                                        // Use display mask specified in the display object.
2898:                                        Debug
2899:                                                .logVerbose(
2900:                                                        "[displayField()] DATE: using display mask - \""
2901:                                                                + uiDisplayObject
2902:                                                                        .getAttribDisplayMask()
2903:                                                                + "\"", module);
2904:
2905:                                        dateFormat = new SimpleDateFormat(
2906:                                                uiDisplayObject
2907:                                                        .getAttribDisplayMask());
2908:                                    }
2909:                                } else if (uiDisplayObject.getDisplayTypeId()
2910:                                        .equals("TIME")) {
2911:                                    if (uiDisplayObject.getAttribDisplayMask()
2912:                                            .equals("")) {
2913:                                        // Use system default date mask.
2914:                                        Debug
2915:                                                .logVerbose(
2916:                                                        "[displayField()] TIME: using standard time format.",
2917:                                                        module);
2918:
2919:                                        dateFormat = (SimpleDateFormat) DateFormat
2920:                                                .getTimeInstance(DateFormat.SHORT);
2921:                                    } else {
2922:                                        // Use display mask specified in the display object.
2923:                                        Debug
2924:                                                .logVerbose(
2925:                                                        "[displayField()] TIME: using display mask - \""
2926:                                                                + uiDisplayObject
2927:                                                                        .getAttribDisplayMask()
2928:                                                                + "\"", module);
2929:
2930:                                        dateFormat = new SimpleDateFormat(
2931:                                                uiDisplayObject
2932:                                                        .getAttribDisplayMask());
2933:                                    }
2934:                                } else if (uiDisplayObject.getDisplayTypeId()
2935:                                        .equals("DATETIME")) {
2936:                                    if (uiDisplayObject.getAttribDisplayMask()
2937:                                            .equals("")) {
2938:                                        // Use system default date mask.
2939:                                        Debug
2940:                                                .logVerbose(
2941:                                                        "[displayField()] DATETIME: using standard datetime format.",
2942:                                                        module);
2943:
2944:                                        dateFormat = (SimpleDateFormat) DateFormat
2945:                                                .getDateTimeInstance();
2946:                                    } else {
2947:                                        // Use display mask specified in the display object.
2948:                                        Debug
2949:                                                .logVerbose(
2950:                                                        "[displayField()] DATETIME: using display mask - \""
2951:                                                                + uiDisplayObject
2952:                                                                        .getAttribDisplayMask()
2953:                                                                + "\"", module);
2954:
2955:                                        dateFormat = new SimpleDateFormat(
2956:                                                uiDisplayObject
2957:                                                        .getAttribDisplayMask());
2958:                                    }
2959:                                }
2960:
2961:                                formattedDateString = dateFormat
2962:                                        .format(parsedDate);
2963:                            } else {
2964:                                Debug
2965:                                        .logVerbose(
2966:                                                "-->[UIFieldsInfo.displayField()] Parsed date is null.",
2967:                                                module);
2968:
2969:                                formattedDateString = "";
2970:                            }
2971:
2972:                            // Change the original and current value strings to match the formatted value so a false change
2973:                            // won't be detected when the user navigates away from this screen section.
2974:                            origFieldValue = formattedDateString;
2975:
2976:                            if (!UIWebUtility.getIsCopiedPrimaryKey(action,
2977:                                    fieldInfo)) {
2978:                                fieldValue = formattedDateString;
2979:                            }
2980:                        }
2981:
2982:                        if (!protect) {
2983:                            // Mode is not protected, so create a text tag.
2984:                            displayHtml.append("<INPUT TYPE=\"TEXT\" NAME=\""
2985:                                    + htmlName + "\" TABINDEX=\""
2986:                                    + String.valueOf(tabIndex) + "\" ");
2987:                            displayHtml.append(UIWebUtility
2988:                                    .translateAttribSize(uiDisplayObject
2989:                                            .getAttribSize()));
2990:                            displayHtml
2991:                                    .append(UIWebUtility
2992:                                            .translateAttribMaxLength(
2993:                                                    uiDisplayObject
2994:                                                            .getAttribMaxLength(),
2995:                                                    String.valueOf(fieldInfo
2996:                                                            .getMaxLength())));
2997:                            displayHtml.append(UIWebUtility
2998:                                    .translateAttribDisabled(uiDisplayObject
2999:                                            .getAttribDisabled()));
3000:                            displayHtml.append(UIWebUtility
3001:                                    .translateAttribReadOnly(uiDisplayObject
3002:                                            .getAttribReadOnly()));
3003:                            displayHtml.append(UIWebUtility
3004:                                    .translateAttribAlign(uiDisplayObject
3005:                                            .getAttribAlign()));
3006:                            displayHtml.append(UIWebUtility
3007:                                    .translateAttribClass(uiDisplayObject
3008:                                            .getAttribClass(action, fieldInfo
3009:                                                    .getIsMandatory())));
3010:                            displayHtml.append(" VALUE=\""
3011:                                    + formattedDateString + "\">\n");
3012:
3013:                            if (uiDisplayObject.getDisplayTypeId().equals(
3014:                                    "DATE")
3015:                                    || uiDisplayObject.getDisplayTypeId()
3016:                                            .equals("DATETIME")) {
3017:                                boolean isDateTime = true;
3018:
3019:                                if (uiDisplayObject.getDisplayTypeId().equals(
3020:                                        "DATE")) {
3021:                                    isDateTime = false;
3022:                                }
3023:
3024:                                String formName = "";
3025:                                String fieldName = "";
3026:
3027:                                if (isSubsection) {
3028:                                    // This section is being displayed as a subsection, so there isn't a form
3029:                                    // for just this section.  Need to use the one called "compositeForm".
3030:                                    formName = "document."
3031:                                            + UIWebUtility.HTML_COMPOSITE_FORM_NAME;
3032:                                } else {
3033:                                    // This section is being alone, so a form is being generated by this class.
3034:                                    // Use the form with the section name in it.
3035:                                    formName = "document." + getSectionName()
3036:                                            + "Form";
3037:                                }
3038:
3039:                                fieldName = formName + "." + htmlName;
3040:
3041:                                // Use onfocus and onblur events to set variable to make the onBeforeUnload
3042:                                // script skip the popup message.
3043:                                displayHtml
3044:                                        .append(" <A\n"
3045:                                                + "   TABINDEX=\""
3046:                                                + String.valueOf(tabIndex)
3047:                                                + "\"\n"
3048:                                                + "   TARGET=\"_self\"\n "
3049:                                                + "   HREF=\"javascript:show_calendar('"
3050:                                                + fieldName
3051:                                                + "', "
3052:                                                + fieldName
3053:                                                + ".value, "
3054:                                                + (isDateTime ? "1" : "0")
3055:                                                + ");\"\n"
3056:                                                + "   onfocus=\"checkForChanges = false;\"\n"
3057:                                                + "   onblur=\"checkForChanges = true;\"\n"
3058:                                                + " >\n");
3059:
3060:                                displayHtml
3061:                                        .append("  <IMG SRC='/sfaimages/cal.gif' WIDTH='16' HEIGHT='16' BORDER='0' "
3062:                                                + "ALT='Click here for calendar'>\n");
3063:                                displayHtml.append(" </A>\n");
3064:                            }
3065:
3066:                            if (fieldInfo.getIsMandatory()
3067:                                    && !action.equals(ACTION_SHOW_QUERY)
3068:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
3069:                                    && !action.equals(ACTION_SHOW_REPORT)) {
3070:                                displayHtml.append("*\n");
3071:                            }
3072:
3073:                            if (TIMER) {
3074:                                timer.timerString(3,
3075:                                        "[UIWebScreenSection.displayField] End "
3076:                                                + fieldInfo.getUiAttribute()
3077:                                                        .getAttributeName()
3078:                                                + " (date)");
3079:                            }
3080:                        } else {
3081:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
3082:                            displayHtml.append(UIWebUtility
3083:                                    .displayFieldReadOnly(uiDisplayObject,
3084:                                            htmlName, fieldValue,
3085:                                            formattedDateString,
3086:                                            entityDetailsVector));
3087:
3088:                            if (TIMER) {
3089:                                timer.timerString(3,
3090:                                        "[UIWebScreenSection.displayField] End "
3091:                                                + fieldInfo.getUiAttribute()
3092:                                                        .getAttributeName()
3093:                                                + " (date - protected)");
3094:                            }
3095:                        }
3096:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
3097:                            UIDisplayObject.DISPLAY_TYPE_TEXTAREA)) {
3098:                        // Text field
3099:                        if (!protect) {
3100:                            // Mode is not protected, so create a text tag.
3101:                            displayHtml.append("<TEXTAREA NAME=\"" + htmlName
3102:                                    + "\" TABINDEX=\""
3103:                                    + String.valueOf(tabIndex) + "\" ");
3104:                            displayHtml.append(UIWebUtility
3105:                                    .translateAttribCols(uiDisplayObject
3106:                                            .getAttribCols()));
3107:                            displayHtml.append(UIWebUtility
3108:                                    .translateAttribRows(uiDisplayObject
3109:                                            .getAttribRows()));
3110:                            displayHtml.append(UIWebUtility
3111:                                    .translateAttribDisabled(uiDisplayObject
3112:                                            .getAttribDisabled()));
3113:                            displayHtml.append(UIWebUtility
3114:                                    .translateAttribReadOnly(uiDisplayObject
3115:                                            .getAttribReadOnly()));
3116:                            displayHtml.append(UIWebUtility
3117:                                    .translateAttribAlign(uiDisplayObject
3118:                                            .getAttribAlign()));
3119:                            displayHtml.append(UIWebUtility
3120:                                    .translateAttribWrap(uiDisplayObject
3121:                                            .getAttribWrap()));
3122:                            displayHtml.append(UIWebUtility
3123:                                    .translateAttribClass(uiDisplayObject
3124:                                            .getAttribClass(action, fieldInfo
3125:                                                    .getIsMandatory())));
3126:                            displayHtml.append(">" + fieldValue
3127:                                    + "</TEXTAREA>\n");
3128:
3129:                            if (fieldInfo.getIsMandatory()
3130:                                    && !action.equals(ACTION_SHOW_QUERY)
3131:                                    && !action.equals(ACTION_SHOW_QUERY_REPORT)
3132:                                    && !action.equals(ACTION_SHOW_REPORT)) {
3133:                                displayHtml.append("*\n");
3134:                            }
3135:
3136:                            if (TIMER) {
3137:                                timer.timerString(3,
3138:                                        "[UIWebScreenSection.displayField] End "
3139:                                                + fieldInfo.getUiAttribute()
3140:                                                        .getAttributeName()
3141:                                                + " (text area)");
3142:                            }
3143:                        } else {
3144:                            // In protect mode.  Just create a hidden field AND show the value as text in the table cell.
3145:                            displayHtml.append(UIWebUtility
3146:                                    .displayFieldReadOnly(uiDisplayObject,
3147:                                            htmlName, fieldValue, StringHelper
3148:                                                    .textToHtml(fieldValue),
3149:                                            entityDetailsVector));
3150:
3151:                            if (TIMER) {
3152:                                timer.timerString(3,
3153:                                        "[UIWebScreenSection.displayField] End "
3154:                                                + fieldInfo.getUiAttribute()
3155:                                                        .getAttributeName()
3156:                                                + " (protected text area)");
3157:                            }
3158:                        }
3159:                    } else if (uiDisplayObject.getDisplayTypeId().equals(
3160:                            UIDisplayObject.DISPLAY_TYPE_HIDDEN)) {
3161:                        // Hidden field
3162:                        displayHtml
3163:                                .append("<INPUT TYPE=\"HIDDEN\" NAME=\""
3164:                                        + htmlName + "\" VALUE='" + fieldValue
3165:                                        + "'>\n");
3166:
3167:                        if (TIMER) {
3168:                            timer.timerString(3,
3169:                                    "[UIWebScreenSection.displayField] End "
3170:                                            + fieldInfo.getUiAttribute()
3171:                                                    .getAttributeName()
3172:                                            + " (hidden field)");
3173:                        }
3174:                    } else {
3175:                        // Unknown display type. Use the plain value.
3176:                        if (TIMER) {
3177:                            timer.timerString(3,
3178:                                    "[UIWebScreenSection.displayField] End "
3179:                                            + fieldInfo.getUiAttribute()
3180:                                                    .getAttributeName()
3181:                                            + " (unknown display type)");
3182:                        }
3183:
3184:                        displayHtml.append(fieldValue);
3185:                    }
3186:
3187:                    // Create hidden field to hold the original value for update capability.
3188:                    displayHtml.append("<INPUT TYPE=\"HIDDEN\" NAME=\""
3189:                            + htmlNameOriginal + "\" VALUE='" + origFieldValue
3190:                            + "'>\n");
3191:
3192:                    return displayHtml.toString();
3193:                } catch (GenericEntityException e) {
3194:                    Debug
3195:                            .logError(
3196:                                    "[UIWebScreenSection.displayField]: Error occurred while getting the display object attributes for displayObjectId "
3197:                                            + fieldInfo.getDisplayObjectId()
3198:                                            + ":", module);
3199:                    Debug.logError("  " + e.getLocalizedMessage(), module);
3200:
3201:                    return fieldValue;
3202:                }
3203:            }
3204:
3205:            /**
3206:             * DOCUMENT ME!
3207:             *
3208:             * @param action 
3209:             *
3210:             * @return 
3211:             */
3212:            protected String displayQueryButton(String action) {
3213:                StringBuffer displayHtml = new StringBuffer("");
3214:                String queryLabel = "Query";
3215:
3216:                if (getHideButtons().indexOf("query") < 0) {
3217:
3218:                    if (action.equals(ACTION_SHOW_QUERY)) {
3219:                        String newMode = "standard";
3220:                        if (getQueryMode().equals("standard")) {
3221:                            queryLabel = "Advanced Query";
3222:                            newMode = "advanced";
3223:                        } else {
3224:                            queryLabel = "Standard Query";
3225:                            newMode = "standard";
3226:                        }
3227:
3228:                        displayHtml
3229:                                .append("<INPUT TYPE=HIDDEN NAME='queryMode' VALUE='"
3230:                                        + newMode + "'>\n");
3231:                    }
3232:                    displayHtml
3233:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"queryButton\" TITLE=\"Create a new query\"");
3234:
3235:                    if (//action.equals(ACTION_SHOW_QUERY) ||
3236:                    action.equals(ACTION_SHOW_QUERY_REPORT)
3237:                            || action.equals(ACTION_SHOW_REPORT)) {
3238:                        displayHtml.append(" DISABLED");
3239:                        displayHtml.append(" SRC=\"" + IMAGE_FIND_DISABLED
3240:                                + "\">\n");
3241:                    } else {
3242:                        displayHtml.append(" SRC=\"" + IMAGE_FIND + "\">\n");
3243:                    }
3244:
3245:                    displayHtml
3246:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Create a new query\" VALUE=\""
3247:                                    + queryLabel + "\"");
3248:
3249:                    if ( // removed for use with Standard / Advanced Query Toggle action.equals(ACTION_SHOW_QUERY) ||
3250:                    action.equals(ACTION_SHOW_QUERY_REPORT)
3251:                            || action.equals(ACTION_SHOW_REPORT)) {
3252:                        displayHtml.append(" DISABLED");
3253:                    }
3254:
3255:                    displayHtml.append(">\n");
3256:                }
3257:
3258:                return displayHtml.toString();
3259:            }
3260:
3261:            /**
3262:             * DOCUMENT ME!
3263:             *
3264:             * @param sendQueryParams 
3265:             * @param action 
3266:             *
3267:             * @return 
3268:             */
3269:            protected String displayNewButton(String sendQueryParams,
3270:                    String action) {
3271:                StringBuffer displayHtml = new StringBuffer("");
3272:
3273:                if (getHideButtons().indexOf("new") < 0) {
3274:                    displayHtml.append("     <TD>\n");
3275:                    displayHtml
3276:                            .append("      <FORM NAME=\"newForm\" METHOD=\"post\" ACTION=\""
3277:                                    + getNewButtonAction() + "\"");
3278:
3279:                    if ((getNewButtonTarget() != null)
3280:                            && !getNewButtonTarget().equals("")) {
3281:                        displayHtml.append(" TARGET=\"" + getNewButtonTarget()
3282:                                + "\"");
3283:                    }
3284:
3285:                    displayHtml.append(">\n");
3286:                    displayHtml.append(sendQueryParams);
3287:                    displayHtml
3288:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
3289:                                    + ACTION_BUTTON + "\">\n");
3290:                    displayHtml
3291:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"newButton\" TITLE=\"Create a new record\"");
3292:
3293:                    if (action.equals(ACTION_SHOW_INSERT)) {
3294:                        displayHtml.append(" DISABLED");
3295:                        displayHtml.append(" SRC=\"" + IMAGE_NEW_DISABLED
3296:                                + "\">\n");
3297:                    } else {
3298:                        displayHtml.append(" SRC=\"" + IMAGE_NEW + "\">\n");
3299:                    }
3300:
3301:                    displayHtml
3302:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Create a new record\" VALUE=\"New\"");
3303:
3304:                    if (action.equals(ACTION_SHOW_INSERT)) {
3305:                        displayHtml.append(" DISABLED");
3306:                    }
3307:
3308:                    displayHtml.append(">\n");
3309:                    displayHtml.append("      </FORM>\n");
3310:                    displayHtml.append("\n");
3311:                    displayHtml.append("     </TD>\n");
3312:                    displayHtml.append("\n");
3313:                }
3314:
3315:                return displayHtml.toString();
3316:            }
3317:
3318:            /**
3319:             * DOCUMENT ME!
3320:             *
3321:             * @param action 
3322:             * @param keyParams 
3323:             * @param sendQueryParams 
3324:             * @param nextAction 
3325:             *
3326:             * @return 
3327:             */
3328:            protected String displayEditButton(String action, String keyParams,
3329:                    String sendQueryParams, String nextAction) {
3330:                StringBuffer displayHtml = new StringBuffer("");
3331:
3332:                if (getHideButtons().indexOf("edit") < 0) {
3333:                    displayHtml.append("     <TD>\n");
3334:                    displayHtml
3335:                            .append("      <FORM name=\"editForm\" METHOD=\"post\" ACTION=\""
3336:                                    + getEditButtonAction() + "\"");
3337:
3338:                    if ((getEditButtonTarget() != null)
3339:                            && !getEditButtonTarget().equals("")) {
3340:                        displayHtml.append(" TARGET=\"" + getEditButtonTarget()
3341:                                + "\"");
3342:                    }
3343:
3344:                    displayHtml.append(">\n");
3345:                    displayHtml
3346:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
3347:                                    + nextAction + "\">\n");
3348:                    displayHtml.append(keyParams);
3349:                    displayHtml.append(sendQueryParams);
3350:                    displayHtml
3351:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"editButton\" TITLE=\"Edit the information\"");
3352:
3353:                    if (action.equals(ACTION_SHOW_INSERT)
3354:                            || action.equals(ACTION_SHOW_UPDATE)
3355:                            || action.equals(ACTION_QUERY_UPDATE)
3356:                            || action.equals(ACTION_SHOW_QUERY)
3357:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3358:                            || action.equals(ACTION_SHOW_REPORT)
3359:                            || !getIsUpdateable()) {
3360:                        displayHtml.append(" DISABLED");
3361:                        displayHtml.append(" SRC=\"" + IMAGE_EDIT_DISABLED
3362:                                + "\">\n");
3363:                    } else {
3364:                        displayHtml.append(" SRC=\"" + IMAGE_EDIT + "\">\n");
3365:                    }
3366:
3367:                    displayHtml
3368:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Edit the information\" VALUE=\"Edit\"");
3369:
3370:                    if (action.equals(ACTION_SHOW_INSERT)
3371:                            || action.equals(ACTION_SHOW_UPDATE)
3372:                            || action.equals(ACTION_QUERY_UPDATE)
3373:                            || action.equals(ACTION_SHOW_QUERY)
3374:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3375:                            || action.equals(ACTION_SHOW_REPORT)
3376:                            || !getIsUpdateable()) {
3377:                        displayHtml.append(" DISABLED");
3378:                    }
3379:
3380:                    displayHtml.append(">\n");
3381:                    displayHtml.append("      </FORM>\n");
3382:                    displayHtml.append("\n");
3383:                    displayHtml.append("     </TD>\n");
3384:                    displayHtml.append("\n");
3385:                }
3386:
3387:                return displayHtml.toString();
3388:            }
3389:
3390:            /**
3391:             * DOCUMENT ME!
3392:             *
3393:             * @param action 
3394:             *
3395:             * @return 
3396:             */
3397:            protected String displayDeleteButton(String action) {
3398:                StringBuffer displayHtml = new StringBuffer("");
3399:
3400:                if (getHideButtons().indexOf("delete") < 0) {
3401:                    displayHtml
3402:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"deleteButton\" TITLE=\"Delete the current record\" onClick=\"return confirmDelete()\"");
3403:
3404:                    if (action.equals(ACTION_SHOW_INSERT)
3405:                            || action.equals(ACTION_DELETE)
3406:                            || action.equals(ACTION_SHOW_COPY)
3407:                            || action.equals(ACTION_SHOW_QUERY)
3408:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3409:                            || action.equals(ACTION_SHOW_REPORT)
3410:                            || !getIsUpdateable()) {
3411:                        displayHtml.append(" DISABLED");
3412:                        displayHtml.append(" SRC=\"" + IMAGE_DELETE_DISABLED
3413:                                + "\">\n");
3414:                    } else {
3415:                        displayHtml.append(" SRC=\"" + IMAGE_DELETE + "\">\n");
3416:                    }
3417:
3418:                    displayHtml
3419:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Delete the current record\" VALUE=\"Delete\" onClick=\"return confirmDelete()\"");
3420:
3421:                    if (action.equals(ACTION_SHOW_INSERT)
3422:                            || action.equals(ACTION_DELETE)
3423:                            || action.equals(ACTION_SHOW_COPY)
3424:                            || action.equals(ACTION_SHOW_QUERY)
3425:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3426:                            || action.equals(ACTION_SHOW_REPORT)
3427:                            || !getIsUpdateable()) {
3428:                        displayHtml.append(" DISABLED");
3429:                    }
3430:
3431:                    displayHtml.append(">\n");
3432:                }
3433:
3434:                return displayHtml.toString();
3435:            }
3436:
3437:            /**
3438:             * DOCUMENT ME!
3439:             *
3440:             * @param action 
3441:             *
3442:             * @return 
3443:             */
3444:            protected String displayCopyButton(String action) {
3445:                StringBuffer displayHtml = new StringBuffer("");
3446:
3447:                if (getHideButtons().indexOf("copy") < 0) {
3448:                    displayHtml
3449:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"copyButton\" TITLE=\"Create a copy of the current record\"");
3450:
3451:                    if (action.equals(ACTION_SHOW_INSERT)
3452:                            || action.equals(ACTION_DELETE)
3453:                            || action.equals(ACTION_SHOW_COPY)
3454:                            || action.equals(ACTION_SHOW_QUERY)
3455:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3456:                            || action.equals(ACTION_SHOW_REPORT)
3457:                            || !getIsUpdateable()) {
3458:                        displayHtml.append(" DISABLED");
3459:                        displayHtml.append(" SRC=\"" + IMAGE_COPY_DISABLED
3460:                                + "\">\n");
3461:                    } else {
3462:                        displayHtml.append(" SRC=\"" + IMAGE_COPY + "\">\n");
3463:                    }
3464:
3465:                    displayHtml
3466:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Create a copy of the current record\" VALUE=\"Copy\"");
3467:
3468:                    if (action.equals(ACTION_SHOW_INSERT)
3469:                            || action.equals(ACTION_DELETE)
3470:                            || action.equals(ACTION_SHOW_COPY)
3471:                            || action.equals(ACTION_SHOW_QUERY)
3472:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3473:                            || action.equals(ACTION_SHOW_REPORT)
3474:                            || !getIsUpdateable()) {
3475:                        displayHtml.append(" DISABLED");
3476:                    }
3477:
3478:                    displayHtml.append(">\n");
3479:                }
3480:
3481:                return displayHtml.toString();
3482:            }
3483:
3484:            /**
3485:             * DOCUMENT ME!
3486:             *
3487:             * @param action 
3488:             *
3489:             * @return 
3490:             */
3491:            protected String displaySelectButton(String action) {
3492:                StringBuffer displayHtml = new StringBuffer("");
3493:
3494:                if (getHideButtons().indexOf("select") < 0) {
3495:                    displayHtml
3496:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"selectButton\" TITLE=\"Add and remove entities\"");
3497:
3498:                    if (action.equals(ACTION_SHOW_SELECT)
3499:                            || action.equals(ACTION_UPDATE_SELECT)
3500:                            || !getIsUpdateable()) {
3501:                        displayHtml.append(" DISABLED");
3502:                        displayHtml.append(" SRC=\"" + IMAGE_SELECT_DISABLED
3503:                                + "\">\n");
3504:                    } else {
3505:                        displayHtml.append(" SRC=\"" + IMAGE_SELECT + "\">\n");
3506:                    }
3507:
3508:                    displayHtml
3509:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Add and remove entities\" VALUE=\"Select\"");
3510:
3511:                    if (action.equals(ACTION_SHOW_SELECT)
3512:                            || action.equals(ACTION_UPDATE_SELECT)
3513:                            || !getIsUpdateable()) {
3514:                        displayHtml.append(" DISABLED");
3515:                    }
3516:
3517:                    displayHtml.append(">\n");
3518:                }
3519:
3520:                return displayHtml.toString();
3521:            }
3522:
3523:            /**
3524:             * DOCUMENT ME!
3525:             *
3526:             * @param action 
3527:             *
3528:             * @return 
3529:             */
3530:            protected String displayPrintButton(String action) {
3531:                StringBuffer displayHtml = new StringBuffer("");
3532:
3533:                if (getHideButtons().indexOf("print") < 0) {
3534:                    displayHtml
3535:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"printButton\" TITLE=\"Print the current record\"");
3536:
3537:                    if (action.equals(ACTION_SHOW_QUERY)
3538:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3539:                            || action.equals(ACTION_SHOW_REPORT)) {
3540:                        displayHtml.append(" DISABLED");
3541:                        displayHtml.append(" SRC=\"" + IMAGE_PRINT_DISABLED
3542:                                + "\">\n");
3543:                    } else {
3544:                        displayHtml.append(" DISABLED"); // Remove this when the print button is activated.
3545:                        displayHtml.append(" SRC=\"" + IMAGE_PRINT + "\">\n");
3546:                    }
3547:
3548:                    displayHtml
3549:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Print the current record\" VALUE=\"Print\"");
3550:
3551:                    if (action.equals(ACTION_SHOW_QUERY)
3552:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3553:                            || action.equals(ACTION_SHOW_REPORT)) {
3554:                        //			displayHtml.append(" DISABLED"); Uncomment this when the print button is activated.
3555:                    }
3556:
3557:                    displayHtml.append(" DISABLED"); // Remove this when the print button is activated.
3558:                    displayHtml.append(">\n");
3559:                }
3560:
3561:                return displayHtml.toString();
3562:            }
3563:
3564:            /**
3565:             * DOCUMENT ME!
3566:             *
3567:             * @param action 
3568:             *
3569:             * @return 
3570:             */
3571:            protected String displayCancelButton(String action) {
3572:                StringBuffer displayHtml = new StringBuffer("");
3573:
3574:                if (getHideButtons().indexOf("cancel") < 0) {
3575:                    displayHtml
3576:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"cancelButton\" TITLE=\"Cancel the current action\"");
3577:
3578:                    //		if (	action.equals(ACTION_SHOW_QUERY) || action.equals(ACTION_SHOW_QUERY_REPORT) || action.equals(ACTION_SHOW_REPORT)) {
3579:                    //			displayHtml.append(" DISABLED");
3580:                    //			displayHtml.append(" SRC=\"" + IMAGE_STOP_DISABLED + "\">\n");
3581:                    //		} else {
3582:                    displayHtml.append(" SRC=\"" + IMAGE_STOP + "\">\n");
3583:
3584:                    //		}
3585:                    displayHtml
3586:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Cancel the current action\" VALUE=\"Cancel\"");
3587:
3588:                    //		if (action.equals(ACTION_SHOW_QUERY) || action.equals(ACTION_SHOW_QUERY_REPORT) || action.equals(ACTION_SHOW_REPORT)) {
3589:                    //			displayHtml.append(" DISABLED");
3590:                    //		}
3591:                    displayHtml.append(">\n");
3592:                }
3593:
3594:                return displayHtml.toString();
3595:            }
3596:
3597:            /**
3598:             * DOCUMENT ME!
3599:             *
3600:             * @return 
3601:             */
3602:            protected String displayCustomizeButton() {
3603:                StringBuffer displayHtml = new StringBuffer("");
3604:
3605:                if (getHideButtons().indexOf("customize") < 0) {
3606:                    displayHtml.append("     <TD ALIGN=\"right\">\n");
3607:                    displayHtml
3608:                            .append("      <FORM METHOD=\"post\" ACTION=\"/sfa/control/uiScreenSectionCustomize\" TARGET=\"content\">\n");
3609:                    displayHtml
3610:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"sectionId\" VALUE=\""
3611:                                    + getSectionId() + "\">\n");
3612:                    displayHtml
3613:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" SRC=\""
3614:                                    + IMAGE_PROPERTIES
3615:                                    + "\" NAME=\"customizeButton\" TITLE=\"Customize this screen section\">\n");
3616:                    displayHtml
3617:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Customize this screen section\" VALUE=\"Customize\">\n");
3618:                    displayHtml.append("      </FORM>\n");
3619:                    displayHtml.append("     </TD>\n");
3620:                    displayHtml.append("\n");
3621:                }
3622:
3623:                return displayHtml.toString();
3624:            }
3625:
3626:            /**
3627:             * DOCUMENT ME!
3628:             *
3629:             * @param keyParams 
3630:             * @param sendQueryParams 
3631:             * @param action 
3632:             *
3633:             * @return 
3634:             */
3635:            protected String displayDetailButton(String keyParams,
3636:                    String sendQueryParams, String action) {
3637:                StringBuffer displayHtml = new StringBuffer("");
3638:
3639:                if (getHideButtons().indexOf("detail") < 0) {
3640:                    displayHtml.append("     <TD>\n");
3641:                    displayHtml.append("      <FORM METHOD=\"post\" ACTION=\""
3642:                            + getDetailButtonAction() + "\"");
3643:
3644:                    if ((getDetailButtonTarget() != null)
3645:                            && !getDetailButtonTarget().equals("")) {
3646:                        displayHtml.append(" TARGET=\""
3647:                                + getDetailButtonTarget() + "\"");
3648:                    }
3649:
3650:                    displayHtml.append(">\n");
3651:                    displayHtml.append(keyParams);
3652:                    displayHtml.append(sendQueryParams);
3653:                    displayHtml
3654:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"button\">\n");
3655:                    displayHtml
3656:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"image\" NAME=\"detailButton\" TITLE=\"Show detail for current record\"");
3657:
3658:                    if (action.equals(ACTION_SHOW_INSERT)
3659:                            || action.equals(ACTION_DELETE)
3660:                            || action.equals(ACTION_SHOW_COPY)
3661:                            || action.equals(ACTION_SHOW_QUERY)
3662:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3663:                            || action.equals(ACTION_SHOW_REPORT)
3664:                            || getDetailButtonAction().equals("")) {
3665:                        displayHtml.append(" DISABLED");
3666:                        displayHtml.append(" SRC=\"" + IMAGE_OPEN_DISABLED
3667:                                + "\">\n");
3668:                    } else {
3669:                        displayHtml.append(" SRC=\"" + IMAGE_OPEN + "\">\n");
3670:                    }
3671:
3672:                    displayHtml
3673:                            .append("       <INPUT CLASS=\"titleBarImageButton\" TYPE=\"submit\" NAME=\"buttonAction\" TITLE=\"Show detail for current record\" VALUE=\"Detail\"");
3674:
3675:                    if (action.equals(ACTION_SHOW_INSERT)
3676:                            || action.equals(ACTION_DELETE)
3677:                            || action.equals(ACTION_SHOW_COPY)
3678:                            || action.equals(ACTION_SHOW_QUERY)
3679:                            || action.equals(ACTION_SHOW_QUERY_REPORT)
3680:                            || action.equals(ACTION_SHOW_REPORT)
3681:                            || getDetailButtonAction().equals("")) {
3682:                        displayHtml.append(" DISABLED");
3683:                    }
3684:
3685:                    displayHtml.append(">\n");
3686:                    displayHtml.append("      </FORM>\n");
3687:                    displayHtml.append("\n");
3688:                    displayHtml.append("     </TD>\n");
3689:                    displayHtml.append("\n");
3690:                }
3691:
3692:                return displayHtml.toString();
3693:            }
3694:
3695:            /**
3696:             * DOCUMENT ME!
3697:             *
3698:             * @param sendQueryParams 
3699:             * @param queryId 
3700:             *
3701:             * @return 
3702:             *
3703:             * @throws GenericEntityException 
3704:             */
3705:            protected String displayQueryPicker(String sendQueryParams,
3706:                    String queryId) throws GenericEntityException {
3707:                StringBuffer displayHtml = new StringBuffer("");
3708:
3709:                if (getHideButtons().indexOf("querypicker") < 0) {
3710:                    displayHtml
3711:                            .append("     <TD CLASS=\"freeFormSectionDisplayTable\" ALIGN=\"right\">\n");
3712:
3713:                    List queryGVL = UIQuery.getUiQueryList(getDelegator(),
3714:                            getUserInfo().getPartyId(), getSectionName(),
3715:                            getUiScreen().getScreenName());
3716:
3717:                    displayHtml.append("      <FORM METHOD=\"post\" ACTION=\""
3718:                            + getSearchAction() + "\" TARGET=\""
3719:                            + getSearchTarget() + "\" NAME=\""
3720:                            + getSectionName() + "QueryForm\">\n");
3721:                    displayHtml
3722:                            .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
3723:                                    + ACTION_QUERY + "\">\n");
3724:                    displayHtml.append(sendQueryParams);
3725:                    displayHtml.append(UIDropDown.getSelectHtml("queryId", 1,
3726:                            "", "N", "querySelectBox", "Y",
3727:                            "onchange=\"document." + getSectionName()
3728:                                    + "QueryForm.submit();\"", UIDropDown
3729:                                    .decodeValueArray("queryId", "queryName",
3730:                                            "queryId", queryGVL), queryId,
3731:                            false));
3732:                    displayHtml.append("      </FORM>\n");
3733:                    displayHtml.append("     </TD>\n");
3734:                    displayHtml.append("\n");
3735:                }
3736:
3737:                return displayHtml.toString();
3738:            }
3739:
3740:            /**
3741:             * DOCUMENT ME!
3742:             *
3743:             * @param sendQueryParams 
3744:             * @param queryId 
3745:             *
3746:             * @return 
3747:             *
3748:             * @throws GenericEntityException 
3749:             */
3750:            protected String displayMultiPageForm(String sendQueryParams,
3751:                    String queryId) throws GenericEntityException {
3752:                StringBuffer displayHtml = new StringBuffer("");
3753:
3754:                displayHtml.append("      <FORM METHOD=\"post\" ACTION=\""
3755:                        + getSearchAction() + "\" TARGET=\""
3756:                        + getSearchTarget() + "\" NAME=\"" + getSectionName()
3757:                        + "PageForm\">\n");
3758:                displayHtml
3759:                        .append("       <INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\""
3760:                                + ACTION_QUERY + "\">\n");
3761:                displayHtml.append(sendQueryParams);
3762:
3763:                displayHtml.append("<INPUT TYPE=\"HIDDEN\" NAME=\""
3764:                        + getSectionName() + "_page_selector\" value=\"\">");
3765:                displayHtml.append("<SCRIPT LANGUAGE=\"javascript\">");
3766:                displayHtml.append("function " + getSectionName()
3767:                        + "_selectPage (value) {");
3768:                displayHtml.append("	document.forms[0]." + getSectionName()
3769:                        + "_page_selector.value=value;");
3770:                displayHtml.append(" document.forms[0].submit();");
3771:                displayHtml.append("}");
3772:                displayHtml.append("</SCRIPT>");
3773:
3774:                displayHtml.append("        Use Saved Query:\n");
3775:
3776:                /*                displayHtml.append(
3777:                                        UIDropDown.getSelectHtml(
3778:                                                "queryId",
3779:                                                1,
3780:                                                "",
3781:                                                "N",
3782:                                                "querySelectBox",
3783:                                                "Y",
3784:                                                "queryId",
3785:                                                "queryName",
3786:                                                "onchange=\"document." + getSectionName() + "QueryForm.submit();\"",
3787:                                                queryGVL,
3788:                                                queryId,
3789:                                                false
3790:                                        )
3791:                                );       */
3792:                displayHtml.append("      </FORM>\n");
3793:                displayHtml.append("     </TD>\n");
3794:                displayHtml.append("\n");
3795:
3796:                return displayHtml.toString();
3797:            }
3798:
3799:            /**
3800:             * DOCUMENT ME!
3801:             *
3802:             * @param hasPriorPage 
3803:             * @param priorPageStartRow 
3804:             * @param hasNextPage 
3805:             * @param nextPageStartRow 
3806:             *
3807:             * @return 
3808:             */
3809:            public String displayPageButtons(boolean hasPriorPage,
3810:                    int priorPageStartRow, boolean hasNextPage,
3811:                    int nextPageStartRow, String queryId) {
3812:                return "";
3813:            }
3814:
3815:            /**
3816:             * DOCUMENT ME!
3817:             *
3818:             * @return 
3819:             */
3820:            public int getFirstVisibleRow() {
3821:                return firstVisibleRow;
3822:            }
3823:
3824:            /**
3825:             * DOCUMENT ME!
3826:             *
3827:             * @param row 
3828:             */
3829:            public void setFirstVisibleRow(int row) {
3830:                firstVisibleRow = row;
3831:            }
3832:
3833:            public List getRelatedSectionQueryFields() {
3834:                try {
3835:                    List relatedFields = getDelegator()
3836:                            .findByAnd(
3837:                                    "UiRelatedSectionQueryFields",
3838:                                    UtilMisc.toMap("sectionId", getSectionId(),
3839:                                            "useInAdvancedQueries", "Y",
3840:                                            "isSearchable", "Y"),
3841:                                    UtilMisc.toList("relatedSectionId",
3842:                                            "displayOrder"));
3843:                    return relatedFields;
3844:                } catch (GenericEntityException e) {
3845:                    Debug.logError("Unable to get Related Screen Fields:"
3846:                            + e.getMessage(), module);
3847:                    e.printStackTrace();
3848:                    return null;
3849:                }
3850:            }
3851:
3852:            /**
3853:             * DOCUMENT ME!
3854:             *
3855:             * @param userInfo 
3856:             * @param screenName 
3857:             * @param sectionName 
3858:             * @param delegator 
3859:             * @param uiCache 
3860:             *
3861:             * @return 
3862:             *
3863:             * @throws GenericEntityException 
3864:             */
3865:            public static UIWebScreenSection getUiWebScreenSection(
3866:                    UserInfo userInfo, String screenName, String sectionName,
3867:                    GenericDelegator delegator, UICache uiCache)
3868:                    throws GenericEntityException {
3869:                // This method is here so a child class can specify a different screen section class.
3870:                Debug
3871:                        .logVerbose("Looking in cache for UIScreenSection",
3872:                                module);
3873:
3874:                UIScreenSection uiScreenSection = uiCache.getUiScreenSection(
3875:                        screenName, sectionName, userInfo.getPartyId());
3876:                UIWebScreenSection uiWebScreenSection = null;
3877:
3878:                if (uiScreenSection == null) {
3879:                    Debug.logVerbose(
3880:                            "Screen section not found in cache. Creating",
3881:                            module);
3882:
3883:                    uiWebScreenSection = new UIWebScreenSection(userInfo,
3884:                            screenName, sectionName, delegator, uiCache);
3885:                    uiCache.putUiScreenSection(screenName, sectionName,
3886:                            userInfo.getPartyId(),
3887:                            (UIScreenSection) uiWebScreenSection);
3888:                } else {
3889:                    Debug.logVerbose("Screen section found in cache", module);
3890:
3891:                    uiWebScreenSection = (UIWebScreenSection) uiScreenSection;
3892:                }
3893:
3894:                return uiWebScreenSection;
3895:            }
3896:
3897:            /**
3898:             * @return Returns the queryMode.
3899:             */
3900:            public String getQueryMode() {
3901:                return queryMode;
3902:            }
3903:
3904:            /**
3905:             * @param queryMode The queryMode to set.
3906:             */
3907:            public void setQueryMode(String queryMode) {
3908:                this.queryMode = queryMode;
3909:            }
3910:
3911:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.