final Vector<Object> vecAuxiliar = new Vector<Object>();
final StringBuffer htmlHidden = new StringBuffer();
if (efdauxiliar != null) {
for (int i = 0; i < efdauxiliar.length; i++) {
final WADControl auxControl = new WADHidden(efdauxiliar[i].getField("columnname"), Sqlc
.TransformaNombreColumna(efdauxiliar[i].getField("columnname")), "", true);
auxControl.setReportEngine(xmlEngine);
htmlHidden.append(auxControl.toString()).append("\n");
vecAuxiliar.addElement(FormatUtilities.replace(efdauxiliar[i].getField("columnname")));
}
}
final FieldsData[] dataReload = FieldsData.selectValidationTab(pool, strTab);
final Vector<Object> vecReloads = new Vector<Object>();
if (dataReload != null && dataReload.length > 0) {
for (int z = 0; z < dataReload.length; z++) {
String code = dataReload[z].whereclause
+ ((!dataReload[z].whereclause.equals("") && !dataReload[z].referencevalue.equals("")) ? " AND "
: "") + dataReload[z].referencevalue;
if (code.equals("") && dataReload[z].type.equals("R"))
code = "@AD_Org_ID@";
WadUtility.getComboReloadText(code, vecFields, parentsFieldsData, vecReloads, "",
dataReload[z].columnname);
}
}
final Properties importsCSS = new Properties();
final Properties importsJS = new Properties();
final Properties javaScriptFunctions = new Properties();
final StringBuffer displayLogicFunction = new StringBuffer();
final StringBuffer readOnlyLogicFunction = new StringBuffer();
final StringBuffer validations = new StringBuffer();
final StringBuffer onload = new StringBuffer();
final StringBuffer html = new StringBuffer();
String strFieldGroup = "";
int fieldGroupElements = 0;
boolean fieldGroupHasDisplayLogic = false;
StringBuffer strGroupDisplayLogic = new StringBuffer();
int columnType = 0;
html.append("<tr>\n");
html.append(" <td class=\"TableEdition_OneCell_width\"></td>\n");
html.append(" <td class=\"TableEdition_TwoCells_width\"></td>\n");
html.append(" <td class=\"TableEdition_OneCell_width\"></td>\n");
html.append(" <td class=\"TableEdition_TwoCells_width\"></td>\n");
html.append("</tr>\n");
for (int i = 0; i < efd.length; i++) {
WADControl auxControl = null;
try {
auxControl = WadUtility.getControl(pool, efd[i], isreadonly, tabName, strLanguage,
xmlEngine, (WadUtility.isInVector(vecDisplayLogic, efd[i].getField("columnname"))),
WadUtility.isInVector(vecReloads, efd[i].getField("columnname")), WadUtility
.isInVector(vecReadOnlyLogic, efd[i].getField("columnname")), false,
isReadOnlyDefinedTab);
} catch (final Exception ex) {
throw new ServletException(ex);
}
if (WadUtility.isNewGroup(auxControl, strFieldGroup)) {
if (fieldGroupHasDisplayLogic && (fieldGroupElements != 0)) {
strGroupDisplayLogic.append(")");
displayLogicFunction.append(WadUtility.getDisplayLogicForGroups(strFieldGroup,
strGroupDisplayLogic));
}
strGroupDisplayLogic = new StringBuffer("(");
fieldGroupElements = 0;
fieldGroupHasDisplayLogic = true;
strFieldGroup = auxControl.getData("AD_FieldGroup_ID");
html.append(" <tr><td colspan=\"4\">\n");
html
.append(" <table border=0 cellspacing=0 cellpadding=0 class=\"FieldGroup\" id=\"fldgrp"
+ strFieldGroup + "\"><tr class=\"FieldGroup_TopMargin\"></tr>\n<tr>\n");
html
.append("<td class=\"FieldGroupTitle_Left\"><img src=\"../../../../../web/images/blank.gif\" class=\"FieldGroupTitle_Left_bg\" border=0/></td>");
String strText = "";
strText = EditionFieldsData.fieldGroupName(pool, strFieldGroup);
final WADLabelControl fieldLabel = new WADLabelControl();
fieldLabel.setLabelType(WADLabelControl.FIELD_GROUP_LABEL);
fieldLabel.setFieldGroupId(strFieldGroup);
fieldLabel.setColumnName(strText);
fieldLabel.setLinkable(false);
final WadControlLabelBuilder fieldGroupLabelBuilder = new WadControlLabelBuilder(fieldLabel);
fieldGroupLabelBuilder.buildLabelControl();
final String labelText = fieldGroupLabelBuilder.getBasicLabelText();
html.append("<td class=\"FieldGroupTitle\">").append(labelText).append("</td>");
html
.append("<td class=\"FieldGroupTitle_Right\"><img src=\"../../../../../web/images/blank.gif\" class=\"FieldGroupTitle_Right_bg\" border=0/></td>");
html
.append("<td class=\"FieldGroupContent\"> </td></tr>\n<tr class=\"FieldGroup_BottomMargin\"></tr></table>");
html.append(" </td></tr>\n");
}
// insert display logic for field groups
if (auxControl.getData("IsDisplayed").equals("Y") && fieldGroupHasDisplayLogic
&& !strFieldGroup.equals("")) {
String displ = WadUtility.displayLogic(auxControl.getData("DisplayLogic"),
new Vector<Object>(), parentsFieldsData, vecAuxiliar, vecFields, windowId,
new Vector<Object>());
if (displ.length() != 0) {
displ = "(" + displ + ")";
if (!strGroupDisplayLogic.toString().contains(displ)) {
strGroupDisplayLogic.append((fieldGroupElements == 0 ? "" : " || ") + displ);
fieldGroupElements++;
}
} else {
fieldGroupHasDisplayLogic = false;
}
}
if (log4j.isDebugEnabled())
log4j.debug("Column: " + auxControl.getData("ColumnName") + ", col: " + columnType);
// hidden inputs
if (auxControl.getData("IsDisplayed").equals("N")) {
htmlHidden.append(auxControl.toString()).append("\n");
} else {
if (auxControl instanceof WADButton) {
((WADButton) auxControl).setShortcuts(shortcuts);
}
if (auxControl.getData("IsSameLine").equals("Y")) {
columnType = COLUMN_2_OF_2;
html.append("<td");
} else if (i < efd.length - 1 && efd[i + 1].getField("issameline").equals("Y")
&& efd[i + 1].getField("isdisplayed").equals("Y")) {
columnType = COLUMN_1_OF_2;
html.append("<tr><td");
} else {
columnType = COLUMN_1_OF_1;
html.append("<tr><td");
}
auxControl.setData("ColumnNameLabel", auxControl.getData("ColumnName"));
auxControl.setData("AdColumnId", efd[i].getField("adColumnId"));
WadUtility.setLabel(pool, auxControl, isSOTrx.equals("Y"), "inp"
+ Sqlc.TransformaNombreColumna(keyColumnName));
final String label = auxControl.toLabel();
if (!label.equals("")) {
html.append(" class=\"TitleCell\" id=\"").append(auxControl.getData("ColumnName"))
.append("_lbl_td\">").append(label.replace("\n", ""));
if (columnType == COLUMN_1_OF_1)
html.append("</td>\n<td colspan=\"3\" class=\"").append(auxControl.getType()).append(
"_ContentCell\" id=\"").append(auxControl.getData("ColumnName")).append(
"_inp_td\">");
else
html.append("</td>\n<td class=\"").append(auxControl.getType()).append(
"_ContentCell\" id=\"").append(auxControl.getData("ColumnName")).append(
"_inp_td\">");
} else {
html.append(" class=\"").append(auxControl.getType()).append("_ContentCell\" id=\"")
.append(auxControl.getData("ColumnName")).append("_inp_td\"");
if (columnType == COLUMN_1_OF_1)
html.append(" colspan=\"4\">");
else
html.append(" colspan=\"2\">");
}
final boolean isCombo = (auxControl.getData("AD_Reference_ID").equals("17")
|| auxControl.getData("AD_Reference_ID").equals("18") || auxControl.getData(
"AD_Reference_ID").equals("19"));
if (columnType == COLUMN_1_OF_1) {
if (Integer.valueOf(auxControl.getData("DisplayLength")).intValue() < (MAX_SIZE_EDITION_1_COLUMNS / 4)) {
auxControl.setData("DisplayLength", Double.toString(MAX_SIZE_EDITION_1_COLUMNS
* (isCombo ? 7.5 : 1)));
auxControl.setData("CssSize", "OneCell");
} else if (Integer.valueOf(auxControl.getData("DisplayLength")).intValue() > (MAX_SIZE_EDITION_1_COLUMNS / 2)) {
auxControl.setData("DisplayLength", Double.toString(MAX_SIZE_EDITION_1_COLUMNS
* (isCombo ? 7.5 : 1)));
auxControl.setData("CssSize", "FiveCells");
} else {
auxControl.setData("DisplayLength", Double.toString((MAX_SIZE_EDITION_1_COLUMNS / 2)
* (isCombo ? 7.5 : 1)));
auxControl.setData("CssSize", "TwoCells");
}
} else {
if (Integer.valueOf(auxControl.getData("DisplayLength")).intValue() > (MAX_SIZE_EDITION_2_COLUMNS / 2)) {
auxControl.setData("DisplayLength", Double.toString(MAX_SIZE_EDITION_2_COLUMNS
* (isCombo ? 7.5 : 1)));
auxControl.setData("CssSize", "TwoCells");
} else {
auxControl.setData("DisplayLength", Double.toString((MAX_SIZE_EDITION_2_COLUMNS / 2)
* (isCombo ? 7.5 : 1)));
auxControl.setData("CssSize", "OneCell");
}
}
html.append(auxControl.toString());
// end of input tag
html.append("</td>\n");
if (columnType == COLUMN_1_OF_1 || columnType == COLUMN_2_OF_2)
html.append("</tr>\n");
// Getting JavaScript
{
final Vector<String[]> auxJavaScript = auxControl.getJSCode();
if (auxJavaScript != null) {
for (int j = 0; j < auxJavaScript.size(); j++) {
final String[] auxObj = auxJavaScript.elementAt(j);
javaScriptFunctions.setProperty(auxObj[0], auxObj[1]);
}
}
} // End getting JavaScript
// Getting css imports
{
final Vector<String[]> auxCss = auxControl.getCSSImport();
if (auxCss != null) {
for (int j = 0; j < auxCss.size(); j++) {
final String[] auxObj = auxCss.elementAt(j);
importsCSS.setProperty(auxObj[0], auxObj[1]);
}
}
} // End getting css imports
// Getting js imports
{
final Vector<String[]> auxJs = auxControl.getImport();
if (auxJs != null) {
for (int j = 0; j < auxJs.size(); j++) {
final String[] auxObj = auxJs.elementAt(j);
importsJS.setProperty(auxObj[0], auxObj[1]);
}
}
} // End getting js imports
if (!auxControl.getValidation().equals(""))
validations.append(auxControl.getValidation()).append("\n");
if (!auxControl.getOnLoad().equals(""))
onload.append(auxControl.getOnLoad()).append("\n");
displayLogicFunction.append(WadUtility.getDisplayLogic(auxControl, new Vector<Object>(),
parentsFieldsData, vecAuxiliar, vecFields, windowId, new Vector<Object>(), isreadonly));
if (!isreadonly)
readOnlyLogicFunction.append(WadUtility.getReadOnlyLogic(auxControl,
new Vector<Object>(), parentsFieldsData, vecAuxiliar, vecFields, windowId,