⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uiwebscreensection.java

📁 国外的一套开源CRM
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	
	                if (colSpan > 1) {
	                    displayHtml.append(" COLSPAN=\"" + String.valueOf(colSpan) +
	                        "\"");
	                }
	
	                displayHtml.append(">\n");
	            }
	
	            // Write all fields with display order greater than zero.  The ones that are not visible
	            // may be created as hidden fields.
	            if ( fieldInfo.getIsVisible() || ( (fieldInfo.getDisplayOrder() > 0) && ( fieldInfo.getUiDisplayObject().getDisplayTypeId().equals(UIDisplayObject.DISPLAY_TYPE_HIDDEN) ) ) )
	            {
	            displayHtml.append(displayField(fieldInfo, entityDetailsVector,
	                    action, 0, isSubsection, tabOffset));
	            displayHtml.append("\n");
	            }
	
	            // If this is a required field, add it to the list of fields to be validated.
	            if (fieldInfo.getIsVisible() && fieldInfo.getIsMandatory()) {
	                requiredFields.add(fieldInfo);
	            }
	
	            if (fieldInfo.getIsVisible()) {
	                // Close the cell.
	                displayHtml.append("      </TD>\n");
	
	                // Mark used cells in the matrix.
	                // Mark all used rows.
	                for (int markRow = row; markRow < (row + rowSpan); markRow++) {
	                    // Mark all used columns, including the label.  That's why we have to add 1 here:
	                    for (int markColumn = column;
	                            markColumn < (column + colSpan + 1);
	                            markColumn++) {
	                        cellUsed[markRow][markColumn] = true;
	                    }
	                }
	
	
	                // Get ready for next time through the loop by adding the column span plus 1 for the label.
	                column += (1 + colSpan);
	
	                if (column > htmlColumnCount) {
	                    Debug.logVerbose("[displayFreeFormSection] Ending row " +
	                            String.valueOf(row), module);
	
	                    if (trOpen) {
	                        displayHtml.append("     </TR>\n");
	                        trOpen = false;
	                    }
	
	                    column = 1;
	                    row++;
	                }
	            }
	        }
	
	        if (TIMER) {
	            timer.timerString(1,
	                "[UIWebScreenSection.displayFreeFormSection] Finished fields");
	        }
	
	        if (trOpen) {
	            displayHtml.append("     </TR>\n");
	            trOpen = false;
	        }
	
	        displayHtml.append("\n");
		}
		
        if (!isSubsection) {
            displayHtml.append("     <TR HEIGHT=\"*\">\n");
            displayHtml.append(
                "      <TD CLASS=\"freeFormSectionSaveButtonArea\" COLSPAN=\"" +
                String.valueOf(htmlColumnCount) + "\">\n");

            if (action.equals(ACTION_SHOW_QUERY) ||
                    action.equals(ACTION_SHOW_QUERY_REPORT) ||
                    action.equals(ACTION_SHOW_REPORT)) {
                displayHtml.append("       Save Query  Definition:\n");
                displayHtml.append(
                    "       <INPUT TYPE=\"text\" WIDTH=\"40\" NAME=\"queryName\">\n");
				displayHtml.append("       Save Results to List:\n");
				displayHtml.append(
					"       <INPUT TYPE=\"text\" WIDTH=\"40\" NAME=\"listName\">\n");
				displayHtml.append(
					"       <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\"" +
					getSectionName() +
                    "SaveButton\" VALUE=\"Run/Save Query\">\n");
            } else {
                if (!getProtect(action)) {
                    displayHtml.append(
                        "       <INPUT TYPE=\"submit\" CLASS=\"button\" NAME=\"" +
                        getSectionName() +
                        "SaveButton\" VALUE=\"Save\" onClick=\"return verifyRequired" +
                        getSectionName() + "(this.form)\">\n");
                }
            }

            displayHtml.append("      </TD>\n");
            displayHtml.append("     </TR>\n");
            displayHtml.append("    </FORM>\n");
            displayHtml.append("\n");
        }

        displayHtml.append("   </TABLE>\n");
        displayHtml.append("\n");

        // Add the javascript methods for confirming delete and validating required fields.
        displayHtml.append(UIWebUtility.writeConfirmDeleteScript());
        displayHtml.append(UIWebUtility.writeVerifyRequiredScript(
                getSectionName(), requiredFields));

        if (TIMER) {
            timer.timerString(1,
                "[UIWebScreenSection.displayFreeFormSection] End");
        }

        return displayHtml.toString();
    }

    /**
     * DOCUMENT ME!
     *
     * @param dataMatrix 
     * @param action 
     * @param sectionTitle 
     * @param queryId 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public String displayTabularSection(DataMatrix dataMatrix, String action,
        String sectionTitle, String queryId) throws GenericEntityException {

        Debug.logVerbose("[displayTabularSection()] Screen name: " +
                getUiScreen().getScreenName() + " - SectionName = " +
                getSectionName(), module);

        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(1,
                "[UIWebScreenSection.displayTabularSection] Start");
        }

        // Get the extra query parameters so the form can pass them to the next page.
        Debug.logVerbose("displayTabularSection] getSendQueryParameterValueMap: " +
                getSendQueryParameterValueMap().toString(), module);

        String sendQueryParams = UIWebUtility.getHiddenArgs(getSendQueryParameterValueMap(),
                "       ");

        Debug.logVerbose("[displayTabularSection] sendQueryParams: " +
                sendQueryParams, module);

        StringBuffer displayHtml = new StringBuffer(5000);

        int row = 0;
        int rows = dataMatrix.getCurrentBuffer().getContents().size();

        hasPriorPage = firstVisibleRow > 0;
        hasNextPage = (rowsPerPage > 0) && (totalRows > rowsPerPage );
        priorPageStartRow = firstVisibleRow - rowsPerPage;

        if (priorPageStartRow < 0) {
            priorPageStartRow = 0;
        }

        nextPageStartRow = firstVisibleRow + rowsPerPage;

        Debug.logVerbose("hasPrior=" + hasPriorPage + ", hasNext=" +
                hasNextPage + ",priorStart=" + priorPageStartRow +
                ",nextStart=" + nextPageStartRow, module);

        /*        int lastVisibleRow = rows + 1;
                int numPages = 1;
                if ( (rowsPerPage > 0) && (rows > rowsPerPage) )
                {
                   lastVisibleRow = firstVisibleRow + rowsPerPage -1;
                   numPages = rows/rowsPerPage;
                   if (rows % rowsPerPage > 0)
                       numPages++;
                }
        */
        displayHtml.append(displayTabularSectionHeader(action, sectionTitle,
                queryId, rows, sendQueryParams));

        Iterator entityDetailsVectorIterator = dataMatrix.getCurrentBuffer()
                                                         .getContents()
                                                         .iterator();

        while (entityDetailsVectorIterator.hasNext()) {
            // Get the next item from the vector of entity vectors.
            Vector entityDetailsVector = (Vector) entityDetailsVectorIterator.next();

            // Display the row of fields.
            displayHtml.append(displayTabularSectionRow(row++, rows,
                    entityDetailsVector, action));
        }

        if (hasPriorPage || hasNextPage) {
            displayHtml.append(displayPageButtons(hasPriorPage,
                    priorPageStartRow, hasNextPage, nextPageStartRow, queryId));
        }

        // Display the closing HTML tags, and the alpha search for the screen section.
        displayHtml.append(displayTabularSectionFooter(action, sendQueryParams, queryId));

        Debug.logVerbose("[displayTabularSection()] Finished Screen name: " +
                getUiScreen().getScreenName() + " - SectionName = " +
                getSectionName(), module);

        if (TIMER) {
            timer.timerString(1,
                "[UIWebScreenSection.displayTabularSection] End");
        }

        return displayHtml.toString();
    }

    /**
     * DOCUMENT ME!
     *
     * @param action 
     * @param sectionTitle 
     * @param queryId 
     * @param rows 
     * @param sendQueryParams 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public String displayTabularSectionHeader(String action,
        String sectionTitle, String queryId, int rows, String sendQueryParams)
        throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(2,
                "[UIWebScreenSection.displayTabularSectionHeader] Start");
        }

        StringBuffer displayHtml = new StringBuffer(2000);

        displayHtml.append("<SCRIPT>\n");
        displayHtml.append(" function selectRow" + getSectionName() +
            "(aLinkObj, aClickedObj) {\n");

        if (WEB_DEBUG) {
            displayHtml.append("  alert('[selectRow" + getSectionName() +
                "] Clicked object name: ' + aClickedObj.name);\n");
        }

        if (WEB_DEBUG) {
            displayHtml.append("  alert('[selectRow" + getSectionName() +
                "] Clicked object ID: ' + aClickedObj.id);\n");
        }

        if (WEB_DEBUG) {
            displayHtml.append("  alert('[selectRow" + getSectionName() +
                "] Clicked object tag name: ' + aClickedObj.tagName);\n");
        }

        displayHtml.append("  if (aClickedObj.tagName == 'TD') {\n");
        displayHtml.append(
            "   // An empty space in the row was clicked.  Go ahead and click the hidden anchor.\n");
        displayHtml.append(
            "   // Note: Catch exception to get rid of the 'undefined error' that pops up if the cancel \n");
        displayHtml.append(
            "   // button is clicked in response to the onBeforeUnload processing.\n");
        displayHtml.append("   try {\n");
        displayHtml.append("    aLinkObj.click();\n");
        displayHtml.append("   } catch (Exception) {\n");
        displayHtml.append("   }\n");
        displayHtml.append("  } else {\n");
        displayHtml.append(
            "   // Either an anchor was clicked by the user, in which case that link\n");
        displayHtml.append(
            "   // will take care of reloading pages, or a drop down was clicked, in which case\n");
        displayHtml.append(
            "   // we don't want to select a new row, or this function is executing a second time\n");
        displayHtml.append(
            "   // as the result of the click() it just triggered on the aLinkObj anchor.\n");
        displayHtml.append("   // Don't do anything here.  \n");
        displayHtml.append("  }\n");
        displayHtml.append(" }\n");

        // Insert the preSubmit function to prevent the onBeforeUnload popup window from being displayed
        // if the Save button was just clicked.
        if (getIsUpdateable()) {
            displayHtml.append(" function preSubmit" + getSectionName() +
                "() {\n");
            displayHtml.append("  // Prevent the onBeforeUnload popup window\n");
            displayHtml.append("  window.onbeforeunload = null;\n");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -