// if ("hidden".equals(inputproperties.get("type")))
// continue;
/// 改为新UI,增加。Lin
//录入页,用新UI
if(pageobj.isInp) {
if (inputproperties.get("value") == null){//这里必需用下面的办法获取value
inputproperties.put("value","${"+dxm+"."+f.name+"}");
}
String richTextInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_html, //组件类弄
inputproperties,//组件属性
vo,
fieldname
);
inputContent = inputContent.replace(temp[0], richTextInputContent);
filterNames.add(fieldname);
} else if (isBaseInfo) {
///
/* 再改,内容 表增加 对象名、对象ID 字段 -- 对象的附件 -- 还有审核时的附件,在 TagComper。Lin
String c = "
//
//
String d = "
\r\n";
d += "
\r\n";
// d+="\r\n";
/* 改。Lin
d += "
\r\n";
*/ d += "
\r\n";
inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
if (isBaseInfo)
/* 改。Lin
d="
\r\n"+d+"\r\n";
*/ d = "
\r\n"+ d +"\r\n";
baseInfoContent = baseInfoContent.replace(temp[0], d);
filterNames.add(fieldname);
} // 改为新UI,增加。Lin
/// 改为新UI,增加。Lin
/**
* 新UI:
* 图片部件,如:
*
* 旧UI的图片部件发布程序,是baseInfo和录入页,都是调用下面的程序的
*/
///
/* String 改为 int。Lin
} else if (f.type.equals(ObjC.FIELD_photoType)) { // Field.TYPE_PHOTO。Lin
*/
/* 再改,先改 FIELD_photoType("photo") 为 FIELD_imgType("img"),原 FIELD_imgType("img") 暂时改为 FIELD_img1Type("img1")。Lin
* "picture" 用到再弄 -- 只有 wz.object.xml 用到,"标题图片文件"、"滚动图片文件":type="picture" width= height=
} else if (f.type == ObjC.FIELD_photoType) { // 考虑去掉 photo,共用 img???Lin
*/ } else if (f.type == ObjC.FIELD_imgType) { // "photo"。Lin
/// 改为新UI,增加。Lin
//录入页,用新UI
if(pageobj.isInp) {
if (inputproperties.get("value") == null){//这里必需用下面的办法获取value
inputproperties.put("value","${"+dxm+"."+f.name+"}");
}
String imgInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_img, //组件类弄
inputproperties,//组件属性
vo,
fieldname
);
inputContent = inputContent.replace(temp[0], imgInputContent);
filterNames.add(fieldname);
}
else if (isBaseInfo) {//查看页先用回老UI的
///
//
//
//
//
//
//
//
//
//
//
//
//
// String fileType = " fileType='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
// String c = "
\r\n";
// c += "
\r\n";
// c += "
\r\n";
// c += "\r\n";
// c += "
\r\n";
// c += "
\r\n";
// c += "\r\n";
// c += "
\r\n";
// c += "\r\n";
// c += "
\r\n";
// c += "
\r\n";
String value = "${##tableName.##fileName}";
if (inputproperties.get("value") != null)
value = inputproperties.get("value");
String c = "
\r\n";
c += "
![]()
\r\n";
c += "
\r\n";
c += "
\r\n";
/* 改。Lin
c += "
\r\n";
*/ c += "
\r\n";
// c+="
";
//
//
//
//
//
//
//
//
String d = "
";
/* 改。Lin
d += "
";
*/ d += "";
/* 改。Lin
d += "
";
*/
/* 再改,增加 type="img",分开处理图片的 上传、下载 -- sltwj 字段 -- \""
+ " id=\""+ snameVal
+ "img\" onerror_=\"this.src='${sessionScope['wd.yh'].skinDir}image/"
+ inputproperties.get("placeholder") +"'\" />";
*/ d += "
\""
+ " id=\""+ snameVal
+ "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/"
+ inputproperties.get("placeholder") +"'\" />";
/* 改。Lin
d += "";
d += "
";
*/
d += "";
d += "";
d += "
";
/* 改。Lin
d += "";
*/ d += "";
d += "
";
d += "\r\n";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm)
.replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix))
.replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm)
.replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix))
.replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
/// 改为新UI,增加。Lin
//原来录入页的html代码
///
inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
if (isBaseInfo)
/* 改。Lin
d="
\r\n"+d+"\r\n";
*/ d = "
\r\n"+ d +"\r\n";
/// 改为新UI,增加。Lin
//原来查看页的html代码
///
baseInfoContent = baseInfoContent.replace(temp[0], d);
filterNames.add(fieldname);
} // 改为新UI,增加。Lin
/* String 改为 int。Lin
} else if (f.type.equals(ObjC.FIELD_imgType)) { // Field.TYPE_PICTURE。Lin
*/
/* 再改,先改 FIELD_photoType("photo") 为 FIELD_imgType("img"),原 FIELD_imgType("img") 暂时改为 FIELD_img1Type("img1")。Lin
* "picture" 用到再弄 -- 只有 wz.object.xml 用到,"标题图片文件"、"滚动图片文件":type="picture" width= height=
} else if (f.type == ObjC.FIELD_imgType) {
*/ } else if (f.type == ObjC.FIELD_img1Type) { // "picture"。Lin
//
//
//
//
//
//
//
//
/* 改。Lin
String fileType = " fileType='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
*/
/* 再改,改了 upload.js,去掉 ""。Lin
String fileType = " type='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
*/ String fileType = " type='jpg,jpeg,png,bpm,gif' ";
String c = "
\r\n"
+ "\r\n"
+ "
\r\n"
+ "
\r\n"
/* 改。Lin
+ "
\r\n";
*/ + "\"/>\r\n";
String d = "
";
/* 改。Lin
* 先不改 type="img",用到再弄 -- 见上面的 ObjC.FIELD_img1Type("photo")
d += "
";
d += "
";
d += "";
d += "
";
*/
d += "";
d += "
\""
+ " id=\"" + snameVal
+ "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/" + inputproperties.get("placeholder") + "'\" />";
d += "";
d += "";
d += "
";
/* 改。Lin
d += "";
*/ d += "";
d += "
";
d += "\r\n";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix)).replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix)).replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
if (isBaseInfo)
/* 改。Lin
d="
\r\n"+d+"\r\n";
*/ d = "
\r\n"+ d +"\r\n";
baseInfoContent = baseInfoContent.replace(temp[0], d);
filterNames.add(fieldname);
/* String 改为 int。Lin
} else if (f.type.equals(ObjC.FIELD_timeType) && f.isDate39) { // Field.TYPE_TIME。春季/秋季入学。Lin
*/
/* 再改,FIELD_date39Type 再改为转为 FIELD_dateType 了。Lin
} else if (f.type == ObjC.FIELD_timeType && f.isDate39) {
*/ } else if (f.type == ObjC.FIELD_dateType && f.isDate39) {
// 入学年度
//
//
//
//
//
// |
/* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
if (inputproperties.get("value") == null)
inputproperties.put("value", "${empty ##tableName.##fileName ?0:##tableName.##fileName}");
*/ inputproperties.putIfAbsent("value", "${empty ##tableName.##fileName ?0:##tableName.##fileName}");
String d = "
\r\n";
// d += "
\r\n";
// d += "
\r\n";
// d += "
\r\n";
// d += "
\r\n";
// d += ""
/* 改。Lin
d+="\r\n";
*/ d += "\r\n";
//
// |
String c = "";
c += "\r\n";
// c += "\r\n"
/* 改。Lin
c+="\r\n";
*/ c += "\r\n";
// wdEdit=
// String g = "";
// g += "\r\n";
// g += "\r\n";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
// g = g.replaceAll("##fileName", f.getName()).replaceAll("##tableName", dxm);
/* 再改,IDEA:'f.isWdEdit == false' can be simplified to '!f.isWdEdit'。Lin
String xxx = ((wdReadonly || f.isWdEdit == false) ? c : d);
*/ String xxx = ((wdReadonly || !(f.isWdEdit)) ? c : d);
inputContent = inputContent.replace(temp[0], xxx.replace("##edit", "edit"));
// if(isBaseInfo){
// d="\r\n"+d+"\r\n";
// }
/* 改。Lin
c="\r\n"+c.replace("##edit", "play")+"\r\n";
*/ c = "\r\n"
+ c.replace("##edit", "play") + "\r\n";
// System.out.println(c);
baseInfoContent = baseInfoContent.replace(temp[0], c);
// today
filterNames.add(fieldname);
/* String 改为 int。Lin
} else if (f.type.equals(ObjC.FIELD_pwdType)) { // Field.TYPE_PASSWORD。Lin
*/ } else if (f.type == ObjC.FIELD_pwdType) {
/* 此段程序有错,对 inputContent,用的是 =,导致页面前、后的字段都被去掉了 -- 只剩 "密码" 这个字段。Lin
inputContent = "";
inputContent = inputContent.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm);
*/
String d = "";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm);
inputContent = inputContent.replace(temp[0], d);
baseInfoContent = baseInfoContent.replace(temp[0], "");
filterNames.add(fieldname);
/* 再改,不能用 == 去比较 ObjFieldB。Lin
* 改用 .name,准备去掉 ObjB.idField(ObjFieldB) -- 去掉时再跟着改
} else if (f == vo.idField && (StringUtils.isBlank(f.cbName))) {
*/
/* 再改,去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin
} else if (f.name.equals(vo.idField.name) && (StringUtils.isBlank(f.cbName))) {
*/ } else if (f.name.equals(vo.idName) && (StringUtils.isBlank(f.cbName))) {
// 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
/* 再改为 -- 页面有 value= 时,不替换 value。Lin
String d = "";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
*/
String d;
String valueStr = inputproperties.get("value");
if (StringUtils.isBlank(valueStr)) {
d = "";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
} else {
d = "";
d = d.replaceAll("##fileName", f.name).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
}
inputContent = inputContent.replace(temp[0], d);
baseInfoContent = baseInfoContent.replace(temp[0], "");
filterNames.add(fieldname);
/* String 改为 int。Lin
}else if(f.type.equals(ObjC.FIELD_cmsType)){ // Field.TYPE_CMS。Lin
*/ } else if (f.type == ObjC.FIELD_cmsType) {
if (StringUtils.isBlank(widthStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
widthStr = " width=\"100%\" ";
if (StringUtils.isBlank(widthStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
heightStr = " height=\"100%\" ";
String d = "\r\n";
d += "\r\n";
/* 改。Lin
d+="";
*/ d += "";
String dd = "\r\n";
dd += "\r\n";
/* 改。Lin
dd+="";
*/ dd += "";
d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
dd = dd.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
inputContent = inputContent.replace(temp[0], wdReadonly ? dd : d);
baseInfoContent = baseInfoContent.replace(temp[0], dd);
filterNames.add(fieldname);
// } else { // 再去掉,空 else 程序块 -- 按 IDEA 规范。Lin
}
} // if (f != null)。去掉 if (f == null) 空程序块 -- 按 IDEA 规范。Lin
}
{
for (Entry> entry : onoffbutton_inputs.entrySet()) { // onoffbutton_inputs 不含 。Lin
List inputs = entry.getValue();
boolean isRadio = false;
boolean nullable = true;
/* 去掉,没用到。Lin
boolean checked = false;
*/
String elValue = "${"+ dxm +"."+ entry.getKey() +"}";
String wdCallback = null;
for (int i = 0; i < inputs.size(); i ++) {
String[] temp = inputs.get(i);
Map m = inputElementProperties_input(temp[0]);
String wdRadioStr = m.get("ssRad"); // ("wdRadio")。Lin
if (StringUtils.isBlank(wdRadioStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
wdRadioStr = m.get("wdCheckbox");
if (StringUtils.isNotBlank(m.get("ssRun"))) // ("wdCallback")))。Lin
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
wdCallback = m.get("ssRun"); // ("wdCallback")。Lin
/* 不加左、右的 "{"、"}"。Lin
* 待确认源头在哪 -- 在源头加 -- 页面 \r\n"; // +"\" wdValue=\""+。Lin
if (i == inputs.size() -1) {
/* 改。Lin
* 再改,\r\n";
*/ inputStr += "\r\n";
if (isBaseInfo) {
/* 改。Lin
inputStr+="\r\n";
*/ inputStr += "\r\n";
}
}
if (i == 0 && isBaseInfo) {
/* 改。Lin
inputStr="\r\n"+inputStr;
*/ inputStr = "\r\n"+ inputStr;
}
inputContent = inputContent.replace(temp[0], inputStr.replace("##edit", "edit"));
baseInfoContent = baseInfoContent.replace(temp[0], inputStr.replace("##edit", "play"));
}
}
}
{// 自动添加校验标签
/* 改。Lin
String[] validations = findLabelName(baseInfoContent, "wd:validation", "name");
*/
/* 再改。Lin
* "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
String[] validations = StrWeb.findLabelName(baseInfoContent, "wd:validation", "name");
*/ String[] validations = StrWeb.findLabelName(baseInfoContent, "ichk\\.ss", "name");
if (validations != null)
baseInfoContent = baseInfoContent.replace(validations[0], "");
// validations = findLabelName(inputContent, "wd:validation", "name"); // 去掉,没用到。Lin
// 改为无论是否校验配置文件存在,都发布校验自定义标签到页面
// Map vmap = webapp
// .getNameKeyValidationMap();
// if (validations==null&&vmap != null&&
// vmap.get(pageobj.getTempcode().getName()) != null) {
/* 去掉 Tempcode。Lin
String t = "\r\n" + "\r\n";
*/
/* 再改。Lin
String t = "\r\n"+ "\r\n";
*/ String t = "\r\n"+ "\r\n";
/* 再改为 IDEA 规范。Lin
* Redundant character escape '\\<' in RegExp
* Redundant character escape '\\/' in RegExp
* Redundant character escape '\\>' in RegExp
String reg = "\\<\\/(body|BODY)\\s*?\\>";
*/ String reg = "(body|BODY)\\s*?>";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(inputContent);
if (matcher.find()) {// 追加到body
inputContent = inputContent.replaceFirst(reg, Matcher.quoteReplacement(t + matcher.group()));
} else {
inputContent += t;
}
// }
}
// request设置一个标记,之后的的服务,标记为强制校验
/* 再改,IDEA:'captchaField.size() > 0' can be replaced with '!captchaField.isEmpty()'。Lin
if (!isInfo && captchaField.size() > 0) {
*/ if (!isInfo && !(captchaField.isEmpty())) {
/* 去掉 Tempcode。Lin
if (pageobj.getTempcode().getName().contains("_input")
&& pageobj.getTempcode().getName().endsWith("_public")) {
*/ if ((pageobj.name).contains(PageC.PAGE_inpSfx)
&& (pageobj.name).endsWith(PageC.PAGE_pubEnd)) { // 先保留,没有存在 "_public" 结尾的 JSP 文件。Lin
inputContent = "\r\n<% request.setAttribute(\""+ ss.WebC.REQ_captcha +"\",\""+ captchaField.size() +"\"); %>\r\n"
+ inputContent;
/* 再改,IDEA:String concatenation '+=' in loop。Lin
String t = "";
t += "\r\n";
*/ t.append("\r\n");
/* 再改为 IDEA 规范。Lin
* Redundant character escape '\\<' in RegExp
* Redundant character escape '\\/' in RegExp
* Redundant character escape '\\>' in RegExp
String reg = "\\<\\/(body|BODY)\\s*?\\>";
*/ String reg = "(body|BODY)\\s*?>";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(inputContent);
if (matcher.find()) {// 追加到body
inputContent = inputContent.replaceFirst(reg, Matcher.quoteReplacement(t + matcher.group()));
} else {
inputContent += t;
}
}
}
// { // 再去掉,没必要。Lin
/* 再改,IDEA:'defaultValueField.size()>0' can be replaced with '!defaultValueField.isEmpty()'。Lin
if(!isBaseInfo && !isInfo && defaultValueField.size()>0){
*/ if(!isBaseInfo && !isInfo && !(defaultValueField.isEmpty())){
/* 再改,IDEA:String concatenation '+=' in loop。Lin
String t = "";
t += "\r\n";
*/ t.append("})\r\n\r\n");
inputContent += t;
}
// } // 再去掉,没必要。Lin
// { // 再去掉,没意义。Lin
if(!inputContent.toLowerCase().contains("")&&!inputContent.toLowerCase().contains(""))
inputContent += PageCompC.ADD_REMOVE_TOKEN_SCRIPT;
// } // 再去掉,没意义。Lin
/* 去掉 appName,直接用 PrjApp.prjName。Lin
* 移到 PageCompU
reader = new StringReader(transformCommonwrite(isInfo ? baseInfoContent : inputContent, appName, ymid, wzid, gdba));
*/
reader = new StringReader(PageCompU.compTag(isInfo? baseInfoContent : inputContent));
}
// #######################################################################
// 添加objectpicker下拉
BufferedReader in = new BufferedReader(reader);
StringBuffer sb = new StringBuffer();
// String s = ""; // 再去掉,移到下面用到的地方。IDEA -- Variable 's' initializer '""' is redundant。Lin
/* 去掉,改用 TagComper.transform(str),没改盖过。Lin
ObjPickerTagComper obectPickerTransformer = new ObjPickerTagComper();
TxtTagComper textTransformer = new TxtTagComper();
GrowhTagComper growHeightTransformer = new GrowhTagComper();
OnoffTagComper onoffbuttonTransform = new OnoffTagComper();
OptTagComper wdoptionTransform = new OptTagComper();
*/
/// 改为新UI,增加。Lin
boolean ccpIsNewUI = true;//如果为真,切换级联菜单是新UI
///
try {
List allInputTab = new LinkedList<>();
Map> allonoffbutton = new HashMap<>();
List allObjectPicker = new LinkedList<>();
// 所有页面级联
// List allcascadingTagExist = new LinkedList();//
List allcascadingSelect_input = new LinkedList<>();//
List allcascadingInputNames = new LinkedList<>();//
List notHandleCascadingInputNames = new LinkedList<>();//
Map allcascadingInputNamesObject = new HashMap<>();//
/// 增加,保存 prfx -- 支持共用 ccp 定义。Lin
Map cascadingPrfx = new HashMap<>();
///
Map namesValue = new HashMap<>();//
// Map cascadingTagNew = new HashMap();//级联标签
Map> cascadingTagNewAttribute = new HashMap<>();//级联标签属性
String s; // 再,从上面移到这。Lin
while ((s = in.readLine()) != null) {
// input
String[] inputTab = StrWeb.findLabelName(s, "input", null);
// objectpicker
/* 去掉 TagTransformerAdapter.prefix,统一用 PageConst.HTML_TAG_PREFIX。Lin
String[] existObjectPicker = findLabelName(s,
obectPickerTransformer.prefix +":"+ obectPickerTransformer.getTagType(), null);
*/
/* 改。Lin
* "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
String[] existObjectPicker = StrWeb.findLabelName(s, "cw:op", null);
*/ String[] existObjectPicker = StrWeb.findLabelName(s, "objp\\.ss", null);
// cascading
/* 改。Lin
* "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
String[] existcascadingSelect = StrWeb.findLabelName(s, "wd:cascadingSelect", "name");
*/ String[] existcascadingSelect = StrWeb.findLabelName(s, "ccp\\.ss", "name");
if (inputTab != null){
allInputTab.add(inputTab);
Map m = inputElementProperties_input(inputTab[0]);
if (StringUtils.isNotBlank(m.get("value"))) // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
namesValue.put(inputTab[1], m.get("value"));
boolean wdReadonly="true".equals(m.get("wdReadonly"));
String wdCascadingSelect = m.get("ssCcp"); // ("wdCascadingSelect")。Lin
if (StringUtils.isNotBlank(wdCascadingSelect)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
try {
// name:’ cxlbjl’, filter:{cslbdl:’0000’}
/* 不加左、右的 "{"、"}"。Lin
* 待确认源头在哪 -- 在源头加
JsonObject json = JsonParser.parseString("{"+ wdCascadingSelect +"}").getAsJsonObject();
*/
/* 再改, 负责人员、联系部门 > 联系人员,共用 部门 > 人员。Lin
String prfx = json.has("prfx")? json.get("prfx").getAsString() : "";
///
/* 去掉 appName,直接用 PrjApp.。Lin
CascadingSelectObject mm = webapp.getCascadingSelectObject().get(cascadingname);
*/ CcpB mm = prjApp.ccpMap.get(cascadingname); // = PrjApp.。再,支持对象名。Lin
if (mm != null) { // (mm != null)。Lin
/* 再,不用 Clone -- 浅克隆没用,深克隆麻烦。Lin
/// 增加,支持共用 ccp 定义。Lin
CcpB mm = mmOri.clone();
mm.combField.name = prfx + mm.combField.name;
for(CcpFieldB input : mm.combField.fieldList){
input.name = prfx + input.name;
}
///
*/
/* 支持多个了。Lin
* 增加了可以直接写单个 Field, () -- 可以没有
if(StringUtil.notNull(mm.getInputs().getName())){
allcascadingInputNames.add(mm.getInputs().getName());
allcascadingInputNamesObject.put(mm.getInputs().getName(), mm);
}
for(Input input: mm.getInputs().getInputList()){
allcascadingInputNames.add(input.getName());
allcascadingInputNamesObject.put(input.getName(), mm);
}
*/
/* 暂时只支持有且只有一个 。Lin
* 暂时不支持单个Field
for(CascaderCombFieldB inputs : mm.combFieldMap.values()){
allcascadingInputNames.add(inputs.name);
allcascadingInputNamesObject.put(inputs.name, mm);
for(CascaderFieldB input : inputs.fieldMap.values()){
allcascadingInputNames.add(input.name);
allcascadingInputNamesObject.put(input.name, mm);
}
}
for(CascaderSglFieldB sglField : mm.sglFieldMap.values()){ // 单个 Field。Lin
allcascadingInputNames.add(sglField.name);
allcascadingInputNamesObject.put(sglField.name, mm);
}
*/
/* 再, 增加支持共用 ccp 定义。Lin
if (StringUtils.isNotBlank(mm.combField.name)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
allcascadingInputNames.add(mm.combField.name);
allcascadingInputNamesObject.put(mm.combField.name, mm);
}
for(CcpFieldB input: mm.combField.fieldList){
allcascadingInputNames.add(input.name);
allcascadingInputNamesObject.put(input.name, mm);
}
*/
if (StringUtils.isNotBlank(mm.combField.name)) {
allcascadingInputNames.add(prfx + mm.combField.name);
allcascadingInputNamesObject.put(prfx + mm.combField.name, mm);
cascadingPrfx.put(prfx + mm.combField.name, prfx);
}
for (CcpFieldB input : mm.combField.fieldList) {
allcascadingInputNames.add(prfx + input.name);
allcascadingInputNamesObject.put(prfx + input.name, mm);
cascadingPrfx.put(prfx +input.name, prfx);
}
// int si = mm.getInputs().getInputList().size() - 1;
// String lastInputName = mm.getInputs().getInputList().get(si).getName();
// String filterStr = StringUtil.notNull(cascadingfilter) ? ("filter=\"" + cascadingfilter + "\"") : "";
Map map = new HashMap<>();
map.put("name", cascadingname); // 这里不用加 prfx -- 增加支持共用 ccp 定义。Lin
if (cascadingfilter != null)
map.put("filter", cascadingfilter);
map.put("mode", (wdReadonly||isInfo)?"play":"edit");
/// 保存 prfx,增加 支持多个了。Lin
* 增加了可以直接写单个 Field, () -- 可以没有
if(StringUtil.notNull(mm.getInputs().getName())){
notHandleCascadingInputNames.add(mm.getInputs().getName());
allcascadingInputNames.add(mm.getInputs().getName());
allcascadingInputNamesObject.put(mm.getInputs().getName(), mm);
}
for(Input input: mm.getInputs().getInputList()){
notHandleCascadingInputNames.add(input.getName());
allcascadingInputNames.add(input.getName());
allcascadingInputNamesObject.put(input.getName(), mm);
}
*/
/* 暂时只支持有且只有一个 。Lin
* 暂时不支持单个Field
for(CascaderCombFieldB inputs : mm.combFieldMap.values()){
notHandleCascadingInputNames.add(inputs.name);
allcascadingInputNames.add(inputs.name);
allcascadingInputNamesObject.put(inputs.name, mm);
for(CascaderFieldB input : inputs.fieldMap.values()){
notHandleCascadingInputNames.add(input.name);
allcascadingInputNames.add(input.name);
allcascadingInputNamesObject.put(input.name, mm);
}
}
for(CascaderSglFieldB sglField : mm.sglFieldMap.values()){ // 单个 Field。Lin
notHandleCascadingInputNames.add(sglField.name);
allcascadingInputNames.add(sglField.name);
allcascadingInputNamesObject.put(sglField.name, mm);
}
*/
if (StringUtils.isNotBlank(mm.combField.name)) {
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
notHandleCascadingInputNames.add(mm.combField.name);
allcascadingInputNames.add(mm.combField.name);
allcascadingInputNamesObject.put(mm.combField.name, mm);
}
for(CcpFieldB input: mm.combField.fieldList){
notHandleCascadingInputNames.add(input.name);
allcascadingInputNames.add(input.name);
allcascadingInputNamesObject.put(input.name, mm);
}
}
}
/* 再改,IDEA:String concatenation as argument to 'StringBuffer.append()' call。Lin
sb.append(s + "\r\n");
*/ sb.append(s).append("\r\n");
}
List removeList = new LinkedList<>();
Set repeatName = new HashSet<>();
Set repeatName_ = new HashSet<>();
for (String[] temp : allInputTab) {
String name = temp[1];
boolean isRemove = false;
if (repeatName_.contains(name)) {
repeatName.add(name);
}
repeatName_.add(name);
for (String[] temp1 : allObjectPicker) {
if (temp1[1].equals(name) || (temp1[1] + "id").equals(name) || (temp1[1] + "m").equals(name)) {
isRemove = true;
break;
}
// input=true隐藏字段可能会加id,m
}
//noinspection SuspiciousIndentAfterControlStatement
if(!isRemove)
try {
// for (String[] temp1 : allcascadingTagExist) {
// if (temp1[1].equals(name)) {
// isRemove = true;
// break;
// }
//
// CascadingSelectObject m =webapp.getCascadingSelectObject().get(temp1[1]);
// if (m != null && m.getPrimaryNam().contains(name)) {
// isRemove = true;
// break;
// }
// }
if(allcascadingInputNames.contains(name))
isRemove = true;
if (isRemove)
allcascadingSelect_input.add(temp);
} catch (Exception e) {
/* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
e.printStackTrace();
*/ log4j.error("PageComper.addViewObjectTools( 异常", e);
}
// xxx_1,xxx2为onoffbutton,放到指定集合
// 、。Lin
/* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
if (name.matches(".*?\\_[0-9yesno]+$")) {
*/ if (name.matches(".*?_[0-9yesno]+$")) {
// String fName = name.split("\\_")[0];
/* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
String fName = name.replaceAll("\\_[0-9yesno]+$", "");
*/ String fName = name.replaceAll("_[0-9yesno]+$", "");
/* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
if (allonoffbutton.get(fName) == null)
allonoffbutton.put(fName, new LinkedList<>());
*/ allonoffbutton.computeIfAbsent(fName, k -> new LinkedList<>());
allonoffbutton.get(fName).add(temp);
isRemove = true;
}
/// 增加,支持 -- 像普通字段一样写。Lin
else {
ObjFieldB field = vo.fieldMap.get(name);
if (field != null && field.type == ObjC.FIELD_boolType) {
/* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
if (allonoffbutton.get(name) == null)
allonoffbutton.put(name, new LinkedList<>());
*/ allonoffbutton.computeIfAbsent(name, k -> new LinkedList<>());
allonoffbutton.get(name).add(temp);
isRemove = true;
}
}
///
if (isRemove)
removeList.add(temp);
}
for (String[] temp : allInputTab) {
if (repeatName.contains(temp[1]))
removeList.add(temp);
}
for (String[] temp1 : removeList) {
allInputTab.remove(temp1);
}
// String tabProgram = ""; // 再去掉,移到下面用到的地方。Lin
// 判断是否查看部件
if (isInfo) { //???看 allInputTab、allcascadingSelect_input
/* 再去掉,按 IDEA 规范 -- Variable is already assigned to this value。Lin
isInfo = true;
*/
/* 没有 WD 了,与应用放到一起。Lin
* 去掉 appName,直接用 PrjApp.
String foldA = WD.webRoot() + "/main/sheji/object/baseInfo/init.jsp";
String foldB = WD.webRoot() + "/main/sheji/object/baseInfo/" + appName + "/source.jsp";
*/
/* 再,不复制,直接用 init.jsp。Lin
String foldA = AppB.webRoot +"main/sheji/object/baseInfo/init.jsp";
String foldB = AppB.webRoot +"main/sheji/object/baseInfo/"+ PrjApp.prjName +"/source.jsp";
if (new File(foldA).exists()) {
if (new File(foldB).exists() == false) {
new File(foldB).getParentFile().mkdirs();
FileU.copyFile(foldA, foldB);
}
StringBuffer newsb = new StringBuffer();
String sourceContent = FileU.rdStr(foldB);
*/
/* 改为新UI。Lin
* 与 新UI 的 header.jsp 放在一起
String foldA = AppB.webRoot +"pms/clip/baseInfo.jsp"; // = AppB.appRoot +。仅出现在 PMS 项目里。Lin
*/ String foldA = AppB.webRoot +"page/clip/baseInfo.jsp"; // = AppB.appRoot +。仅出现在 PMS 项目里。Lin
if (new File(foldA).exists()) {
StringBuffer newsb = new StringBuffer();
String sourceContent = FileU.rdStr(foldA);
/* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
Pattern p = Pattern.compile("#include\\_baseInfo");
*/ Pattern p = Pattern.compile("#include_baseInfo");
Matcher m = p.matcher(sourceContent);
while (m.find()) {
m.appendReplacement(newsb, Matcher.quoteReplacement(sb.toString()));
}
m.appendTail(newsb);
sb = newsb;
}
// input部件
}
// else if (bjdm.toLowerCase().matches(vo.getName() + "_.*input")) {
//
// } else {
// // return new StringReader(sb.toString());
// }
String content = sb.toString();
/* 再改为 IDEA 规范。Lin
* Variable 'tabProgram' initializer '""' is redundant
* String concatenation '+=' in loop
String tabProgram = ""; // 再,从上面移到这。Lin
*/ StringBuilder tabProgram; // 再,从上面移到这。Lin
// BaseBean bean = (BaseBean) Class.forName(vo.getObjClass())
// .newInstance();
// 处理单个input类型 wd:translate, objectpicker
for (String[] temp : allInputTab) {
String name = temp[1];
ObjFieldB field = vo.fieldMap.get(name);
if (field == null)
continue;
String value = "${"+ dxm +"."+ field.name +"}";
Map wdWriteproperties = inputElementProperties_WdWrite(temp[0]);
Map inputproperties = inputElementProperties_input(temp[0]);
boolean wdReadonly="true".equals(inputproperties.get("wdReadonly")); // 用到再弄???Lin
if (inputproperties.get("ssBtn") != null) { // ("wdButton")
inputproperties.put("button", inputproperties.get("ssBtn")); // ("wdButton"))。Lin
}
// 忽略input type=button/hidden
// if("button".equals(inputproperties.get("type")))continue;
if (StringUtils.isNotBlank(inputproperties.get("type"))
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
&& !"text".equals(inputproperties.get("type"))) {
if (filterNames.contains(name))
continue;
if (Arrays.asList(ObjC.FIELD_cmsType, ObjC.FIELD_htmlType).contains(field.type))
// Field.TYPE_CMS, Field.TYPE_HTML。Lin
continue;
/* 改。Lin
if (!"hidden".equals(inputproperties.get("type")))
continue;
*/
if ("hidden".equals(inputproperties.get("type"))) {
//加上对隐藏字段新UI的发布处理 Ben(20260413)
//录入页,用新UI
if(pageobj.isInp) {
String oneLine = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_hiden, //组件类弄
inputproperties,//组件属性
vo,
field.getName()
);
content = content.replace(temp[0], oneLine);
}
continue;
}
/* 下面代码,是对象配置中type="picture"的隐藏字段,替换一下,作发布准备的
但是现在对象配置只用"photo",已经取消"picture",所以下面对##这些变量replace一下这个代码已经没用
所以注释掉 Ben(20260413)
if (inputproperties.get("value")!=null)
value=inputproperties.get("value");
String c = "";
c += "\r\n";
c = c.replaceAll("##fileName", field.name)
.replaceAll("##tableName", dxm)
.replaceAll("##fieldNamePrefix",Matcher.quoteReplacement(fieldNamePrefix))
.replaceAll("##fieldNameValPrefix",Matcher.quoteReplacement(fieldNameValPrefix));
content =content.replace(temp[0],(wdReadonly||isInfo)?"": c);
*/
continue;
}
if (wdWriteproperties.get("format") == null &&
/* String 改为 int。Lin
field.type.equals(ObjC.FIELD_timeType)) { // Field.TYPE_TIME。Lin
*/
/* 再改,保留 FIELD_dateType 了 -- 不转为 FIELD_timeType 了。Lin
field.type == ObjC.FIELD_timeType) {
*/ (field.type == ObjC.FIELD_dateType || field.type == ObjC.FIELD_timeType)) {
wdWriteproperties.put("miniDate", "false");
/* 改,去掉 Display() 了,用 。Lin
wdWriteproperties.put("format", field.getDisplay().getFormat());
*/ wdWriteproperties.put("format", field.fmt);
}
if (wdReadonly || isInfo) {// 查看部件
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
*/ tabProgram = new StringBuilder("\r\n<%--自动生成:"+ dxm +"."+ name +"--%>");
/* 再改,IDEA:String concatenation '+=' in loop。Lin
String writeStr = "";
*/ StringBuilder writeStr = new StringBuilder();
// if(inputproperties.get("size")!=null)wdWriteproperties.put("length",
// inputproperties.get("size"));
/* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
if (wdWriteproperties.get("value") == null)
wdWriteproperties.put("value", value);
*/ wdWriteproperties.putIfAbsent("value", value);
//
// if (false && inputproperties.get("width") != null) {
// inputproperties.put("style",
// "width:" + inputproperties.get("width"));
// inputproperties.remove("width");
// }
// 翻译codebook
/* 去掉 _view.jsp 了。Lin
if (isViewJsp) {
// if(inputproperties.get("size")!=null){
// tabProgram+=TextTag.trimText(demoText,
// Integer.parseInt(inputproperties.get("size")));
// }else{
if (inputproperties.get("style") != null || inputproperties.get("width") != null)
writeStr += getDemoText();
// }
} else */
/* String 改为 int。Lin
if (field.type.equals(ObjC.FIELD_boolType)) { // "boolean" = Field.TYPE_BOOLEAN。Lin
*/ if (field.type == ObjC.FIELD_boolType) {
/* 再改,IDEA:String concatenation '+=' in loop。Lin
writeStr += TagComper.compTag(
// wdoptionTransform.transform(str) 移到 transform(tagAtrMap) 后,
// 就可以用 TagComper.transform(str) 了。Lin
/// * 改。Lin
// "");
/// *
"");
*/ writeStr.append(TagComper.compTag(
""));
} else if (StringUtils.isNotBlank(field.cbName)) {
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
// String
// lengthStr=inputproperties.get("size")!=null?("length=\""+inputproperties.get("size")+"\""):("");
// String lengthStr = ""; // 去掉,没用到。Lin
/* 改。Lin
writeStr += "";
*/
/* 再改,IDEA:String concatenation '+=' in loop。Lin
writeStr += ""; // 不用编译 "); // 不用编译 entry : wdWriteproperties.entrySet()) {
writeStr += entry.getKey() + "=\"" + entry.getValue() + "\" ";
}
*/
writeStr.append(" entry : wdWriteproperties.entrySet()) {
key = entry.getKey();
if ("value".equals(key)) // 增加,转为新标准。Lin
key = "val";
else if ("format".equals(key)) // 增加,转为新标准。Lin
key = "fmt";
/* 再改用 '',避免与字符串里的 "" 冲突。Lin
writeStr += (key +"=\""+ entry.getValue() +"\" ");
*/
/* 再改,IDEA:String concatenation '+=' in loop。Lin
writeStr += (key +"='"+ entry.getValue() +"' ");
*/ writeStr.append(key).append("='").append(entry.getValue()).append("' ");
}
/* 再改,IDEA:String concatenation '+=' in loop。Lin
writeStr += "/>";
writeStr = TagComper.compTag(writeStr);
// textTransformer.transform(str) 移到 transform(tagAtrMap) 后,
// 就可以用 TagComper.transform(str) 了。Lin
*/
writeStr.append("/>");
writeStr = new StringBuilder(TagComper.compTag(writeStr.toString()));
}
String styleStr = getAttributeStr(inputproperties, "style");
String widthStr = getAttributeStr(inputproperties, "width");
String heightStr = getAttributeStr(inputproperties, "height");
/* 去掉,没用到。Lin
String nameStr = getAttributeStr(inputproperties, "name");
*/
String buttonStr = getAttributeStr(inputproperties, "button");
if (StringUtils.isNotBlank(buttonStr)) // 增加,转为新标准。Lin
buttonStr = buttonStr.replace("button=", "btn=");
String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
/* 去掉,Dead code。Lin
if (true || field.type.equals(ObjC.FIELD_txtType)) { // field.TYPE_TEXT。Lin
*/
// 默认值
//
//
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += ""+ writeStr +"
";
tabProgram += TagComper.compTag(
// 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
/// * 改。Lin
// "");
*/
tabProgram.append("").append(writeStr).append("
");
tabProgram.append(TagComper.compTag(
""));
/* 去掉,Dead code。Lin
} else {
tabProgram += ""+ writeStr +"
";
}
*/
if (isBaseInfo)
/* 改。Lin
tabProgram = "\r\n"
+ tabProgram +"\r\n";
*/
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram = "\r\n"
+ tabProgram +"\r\n"; // 不用编译 \r\n"
+ tabProgram +"\r\n"); // 不用编译 ";
inputproperties.remove("value");
inputproperties.remove("onchange");
inputproperties.put("name", fieldNamePrefix+name + "Name");
inputproperties.put("type", "text");
/// * 没有 _view.jsp 了。Lin
// if (isViewJsp) {
// inputproperties.put("value", getDemoText());
// }
/// *
/// * 再改,IDEA:String concatenation '+=' in loop。Lin
// String inputElement = " entry : inputproperties.entrySet()) {
/// * 再改,IDEA:String concatenation '+=' in loop。Lin
// inputElement += entry.getKey() + "=\"" + entry.getValue() + "\" ";
/// *
inputElement.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\" ");
}
/// * 再改,IDEA:String concatenation '+=' in loop。Lin
// inputElement += "/>";
/// *
inputElement.append("/>");
String inputValue = inputproperties.get("wdInput") == null?
inputproperties.get("input") : inputproperties.get("wdInput");
if (StringUtils.isBlank(inputValue)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
inputValue = ((field.inpable)? "true" : "false");
// objectpicker
///// * 改。Lin
// tabProgram = " 0)?
// (" filterField=\""+ StringUtils.join((field.filterList).toArray(), ',') +"\"")
// // 去掉 StrU.join(),直接用 StringUtils.join()。Lin
// : "")
/// *
// + "\"" +((field.filterStr != null)?(" filterField=\""+ field.filterStr +"\"") : "")
// + "/>";
///// *
///// * 再改,增加 field.inpCbName 和 field.cbParmStr。Lin
// * 需要判断 页面的 wdCodebook 和 配置文件的 field.inpCbName 和 field.cbName -- wdCodebook > .inpCbName > .cbName
// * 需要判断 页面的 ssFilter 和 配置文件的 field.cbParmStr -- ssFilter > .cbParm=
// * 太复杂,不好阅读
// tabProgram = new StringBuilder("");
///// *
///// * 再改,分开 ");
///// *
tabProgram = new StringBuilder();
tabProgram.append("");
/// * 再改,IDEA:String concatenation '+=' in loop。Lin
// *??? 另,考虑把 直接改为 wd.edit.objectPicker.createObjectPicker(
// tabProgram = "<%--自动生成:"
// + dxm +"."+ name +"@"
// + Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
// + "--%>"
// + hiddenElement +"\r\n"
// + inputElement + "\r\n"
// + TagComper.compTag(tabProgram);
// // obectPickerTransformer.transform(str) 移到 transform(tagAtrMap) 后,
// // 就可以用 TagComper.transform(str) 了。Lin
/// *
tabProgram = new StringBuilder("<%--自动生成:"
+ dxm +"."+ name +"@"
+ Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
+ "--%>"
+ hiddenElement +"\r\n"
+ inputElement +"\r\n"
+ TagComper.compTag(tabProgram.toString()));
*/
String objPickerInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_objp, //组件类弄
inputproperties,//组件属性
vo,
field.getName()
);
tabProgram = new StringBuilder(objPickerInputContent);
/* 再去掉,移到 if-else 后 -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
content = content.replace(temp[0], tabProgram);
*/
} else { // 下面,不含 -- 被移到 allonoffbutton 里了。Lin
// 生成录入框
// 这里的 entry : wdWriteproperties.entrySet()) {
tabProgram += entry.getKey() + "='" + entry.getValue() + "' ";
}
*/
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram = " entry : wdWriteproperties.entrySet()) {
key = entry.getKey(); // 增加。Lin
if ("value".equals(key)) // 增加,转为新标准。Lin
key = "val";
else if ("format".equals(key)) // 增加,转为新标准。Lin
key = "fmt";
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += (key +"='"+ entry.getValue() +"' ");
*/ tabProgram.append(key).append("='").append(entry.getValue()).append("' ");
}
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += "/>";
tabProgram = TagComper.compTag(tabProgram);
// textTransformer.transform(str) 移到 transform(tagAtrMap) 后,
// 就可以用 TagComper.transform(str) 了。Lin
*/
tabProgram.append("/>");
tabProgram = new StringBuilder(TagComper.compTag(tabProgram.toString()));
} else {
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram = wdWriteproperties.get("value"); // "value"。Lin
valueWithTag = tabProgram.contains("<");
*/
tabProgram = new StringBuilder(wdWriteproperties.get("value")); // "value"。Lin
valueWithTag = tabProgram.toString().contains("<");
}
/* 没有 _view.jsp 了。Lin
if (isViewJsp) {
tabProgram = getDemoText();
}
*/
// SsLog.print(name +"-"+ field.type); // 去掉,干扰。Lin
/* 再改,IDEA:String concatenation '+=' in loop。Lin
inputproperties.put("value", tabProgram);
*/
/* 再改,没区分查看和录入,现在改为下面:Ben(20260512)
inputproperties.put("value", tabProgram.toString());
*/
if(isInfo) {//是查看页才使用这个标签,因为这个标签会特殊字符转义 Ben(20260512)
inputproperties.put("value", tabProgram.toString());
}else{
/// **
// * Ben(20260512)
// * 是录入页直接使用EL表达式如:${zy.mc},不用"' assigned to 'tabProgram' is never used。Lin
tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
*/
/* 再去掉,与上面两行是一样的。Lin
if (inputproperties.get("type") == null)
inputproperties.put("type", "text");
*/
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
*/ tabProgram = new StringBuilder("\r\n<%--自动生成:"+ dxm +"."+ name +"--%>");
// Boolean clearbutton=false;
/* String 改为 int。Lin
if (field.type.equals(ObjC.FIELD_timeType)) { // field.TYPE_TIME。Lin
*/
/* 再改,保留 FIELD_dateType 了 -- 不转为 FIELD_timeType 了。Lin
if (field.type == ObjC.FIELD_timeType) {
*/ if (field.type == ObjC.FIELD_dateType || field.type == ObjC.FIELD_timeType) {
/* 改为新UI。Lin
inputproperties.remove("width");
String onpickedStr = (StringUtils.isNotBlank(wdCallback))?
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
(",onpicked:function(){"+wdCallback+"();}") : "";
/// * 去掉 Display,用 .format。Lin
// inputproperties.put("onClick", "wd.edit.datePicker({dateFmt:'" + field.getDisplay().getFormat() + "'"+onpickedStr+"});");
/// *
inputproperties.put("onClick", "wd.edit.datePicker({dateFmt:'"+ field.fmt +"'"+ onpickedStr +"});");
inputproperties.put("autocomplete", "off");
///// * 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
// if (inputproperties.get("placeholder") == null)
/// * 去掉 Display,用 .format。Lin
// inputproperties.put("placeholder", field.getDisplay().getFormat());
/// *
// inputproperties.put("placeholder", field.fmt);
///// *
inputproperties.computeIfAbsent("placeholder", k -> field.fmt);
*/
/**
* 新UI:
* 日期,时间选择
*/
if(pageobj.isInp) {
String type = PageCompC.FORM_PLUGIN_JS_TYPE_time;
if (field.type == ObjC.FIELD_dateType) //只要有日期的,类似年朋日时分这样的,也必需在obj.xml配置为日期格式
type = PageCompC.FORM_PLUGIN_JS_TYPE_date;
String code = PageCompU.getInputCode(type, //组件类弄
inputproperties,//组件属性
vo, name);
tabProgram.append(code);
}
}
/* String 改为 int。Lin
if (field.type.equals(ObjC.FIELD_txtType) // field.TYPE_TEXT。Lin
|| field.type.equals(ObjC.FIELD_numType)) { // field.TYPE_NUMBER。Lin
*/
/* 再改,把 if 改为 else if,不然日期录入的 input 也会跑下面的 else 中多生成出一个文本框在页面。Ben(20251208)
if (field.type == ObjC.FIELD_txtType || field.type == ObjC.FIELD_numType) {
*/ else if (field.type == ObjC.FIELD_txtType || field.type == ObjC.FIELD_numType) {
// 默认值
/* 改为新UI。Lin
String heightStr = getAttributeStr(inputproperties, "height");
String widthStr = getAttributeStr(inputproperties, "width");
String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
String buttonStr = getAttributeStr(inputproperties, "button");
if (StringUtils.isNotBlank(buttonStr)) // 增加,转为新标准。Lin
buttonStr = buttonStr.replace("button=", "btn=");
String nameStr = getAttributeStr(inputproperties, "name");
//
//
///// * 再改,IDEA:String concatenation '+=' in loop。Lin
// tabProgram += ""
// + inputproperties.get("value") + "
";
// tabProgram += TagComper.compTag(
// // 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
/// * 改。Lin
// "");
/// *
// "");
///// *
tabProgram.append("")
.append(inputproperties.get("value")).append("
");
tabProgram.append(TagComper.compTag(
""));
*/
/**
* 新UI:
* 普通文本录入
*/
if(pageobj.isInp) {
String code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_input, //组件类弄
inputproperties,//组件属性
vo, name);
tabProgram.append(code);
}
} else if (valueWithTag) {// value写带有标签:input标签不处理
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += temp[0];
*/ tabProgram.append(temp[0]);
} else { // 在下面,增加生成 是否 字段的 entry : inputproperties.entrySet()) {
// System.out.println(entry.getKey()+"="+entry.getValue());
/* 再改,IDEA:'\'' is unnecessarily escaped。Lin
String quota = entry.getValue().contains("\"")? "\'" : "\"";
*/ String quota = entry.getValue().contains("\"")? "'" : "\"";
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += entry.getKey() +"="+ quota + entry.getValue() + quota +" ";
*/ tabProgram.append(entry.getKey()).append("=").append(quota)
.append(entry.getValue()).append(quota).append(" ");
}
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += " />";
*/ tabProgram.append(" />");
}
// clearbutton=true;
if ("true".equals(inputproperties.get("clear")))
/* 再改,IDEA:String concatenation '+=' in loop。Lin
tabProgram += "";
*/ tabProgram.append("");
/* 再去掉,移到 if-else 后 -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
content = content.replace(temp[0], tabProgram);
*/
}
}
/// 再,把 if 和 else 的公共部分移到这(if-else 后) -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
/* 再改,IDEA:String concatenation '+=' in loop。Lin
content = content.replace(temp[0], tabProgram);
*/ content = content.replace(temp[0], tabProgram.toString());
///
}
// 处理 :onoffbutton
//
//
// <%--默认选项第一个--%>
//
for (Entry> entry : allonoffbutton.entrySet()) {
String name = entry.getKey();
ObjFieldB field = vo.fieldMap.get(name);
if (field == null)
continue;
/* String 改为 int。Lin
if (!(field.type.equals(ObjC.FIELD_boolType))) // Field.TYPE_BOOLEAN。Lin
*/ if (field.type != ObjC.FIELD_boolType)
continue;
/* 改,增加支持 -- 只写一行。Lin
if (entry.getValue().size() != 2)
*/ if (entry.getValue().size() != 1 && entry.getValue().size() != 2)
continue;
String value = "${"+ dxm +"."+ field.name +"}";
String c = "";
for (int i = 0; i < entry.getValue().size(); i++) {
String[] temp = entry.getValue().get(i);
///// 增加,支持 -- 像普通字段一样写。Lin
/// 再增加,支持 。Lin
String ssRun = StrWeb.findAtrVal(temp[0], "ssRun", 1);
///
if (!(temp[1].contains("_"))) {
// \r\n"; // 不用编译 \r\n";
/// *
"\" ssVal=\""+ AppC.IF_true +"\"/>\r\n";
// "否" 按钮。Lin
vvvv = field.optMap.get(0);
c += "\r\n";
/// *
"\" ssVal=\""+ AppC.IF_false +"\"/>\r\n";
String tabStr = "。Lin
((StringUtils.isNotBlank(ssRun))? (" run=\""+ ssRun +"\"") : "") +
///
" mode=\"" + (isInfo ? "play" : "edit") + "\"/>";
tabStr = TagComper.compTag(tabStr);
// 用 TagComper.transform(),onoffbuttonTransform 没盖写过。Lin
c += tabStr;
*/
Map inputproperties = new HashMap<>();
inputproperties.put("value",value);
//20251024新加 getInputCode方法的param参数
Map param = new HashMap<>();
param.put("isInfo",isInfo);
/* 改,查看页和录入页分开处理 Ben(20260413)。Lin
String code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_onoffbtn, //组件类弄
inputproperties,//组件属性
vo,
fieldNamePrefix + name, //input的name属性
param
);
*/
String code = null;
//查看页和录入页分开处理 Ben(20260413)
if(isInfo){
code = "";
}else{
code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_onoffbtn, //组件类弄
inputproperties,//组件属性
vo,
fieldNamePrefix + name, //input的name属性
param
);
}
c += code;
// 。Lin
if (isBaseInfo)
c+="\r\n"; // 不用编译 。Lin
content = content.replace(temp[0], c);
continue; // 没有后续处理了。Lin
}
/////
// String wdValue = temp[1].split("\\_")[1];
/* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
String[] vv = temp[1].split("\\_");
*/ String[] vv = temp[1].split("_");
String wdValue = vv[vv.length -1];
if ("yes".equalsIgnoreCase(wdValue))
wdValue = "1";
if ("no".equalsIgnoreCase(wdValue))
wdValue = "0";
String vvvv = field.optMap.get(Integer.valueOf(wdValue));
c += "\r\n"; // "\" wdValue=\""+。Lin
if (entry.getValue().size() - 1 > i) {
String newContent="";
if (isBaseInfo && i == 0){
/* 改。Lin
newContent="\r\n";
*/ newContent="\r\n";
}
content = content.replace(temp[0], newContent);
} else {
/* null="true" 改为 field.nullable。Lin
* 尾端不能是 "/>\r\n",只能是 "/>" -- TagComper.transform() 会判别尾端是 ">" 还是 "/>"
* 再改,\r\n";
*/ String tabStr = "";
tabStr = TagComper.compTag(tabStr);
// 用 TagComper.transform(),onoffbuttonTransform 没盖写过。Lin
c += tabStr;
if(isBaseInfo){
if(entry.getValue().size() - 1==i){
/* 改。Lin
c+="\r\n";
*/ c+="\r\n";
}
}
content = content.replace(temp[0], c);
}
}
}
// Map name_inputs = new HashMap();
//
// for (String[] temp : allcascadingSelect_input) {
// String name = temp[1];
// name_inputs.put(name, temp);
//
// }
//
// for (String[] temp : allcascadingTagExist) {
// // String name = temp[1];
// CascadingSelectObject m = WD.getApp(appName).getCascadingSelectObject().get(temp[1]);
// if (m == null)
// continue;
// String growHeigthScript = "";
//
// for (int i = 0; i < m.getInputs().getInputList().size(); i++) {
// String inputName = m.getInputs().getInputList().get(i).getName();
// String[] temp1 = name_inputs.get(inputName);
// if (temp1 == null)
// continue;
// Map inputproperties = inputElementProperties_input(temp1[0]);
//
// String heightStr = getAttributeStr(inputproperties, "height");
// String widthStr = getAttributeStr(inputproperties, "width");
// String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
// String buttonStr = getAttributeStr(inputproperties, "button");
//
// String playDiv = "";
// content = content.replace(temp1[0], temp1[0] + "\r\n" + playDiv);
//
//// growHeigthScript += growHeightTransformer.transform("");
//
// }
//
// }
/// 改为新UI,增加。Lin
Map> inp2CcpMap = new HashMap<>();//新UI专用:key是input的name,value是input对应的级联配置
//初始化inp2CcpMap
//下面的inpName本身就是带前缀的
for (String inpName : allcascadingInputNamesObject.keySet()) {
CcpB ccpB = allcascadingInputNamesObject.get(inpName);
String prfx = cascadingPrfx.get(inpName);
if(ccpB.combField!=null&&StringUtils.isNotBlank(ccpB.combField.rule)){
//如果是有编码规则的隐藏字段
if((prfx + ccpB.combField.name).equals(inpName)){
List list = inp2CcpMap.get(inpName);
if(list==null){
list = new ArrayList<>();
inp2CcpMap.put(inpName,list);
}
list.add(ccpB);
continue;
}
}
/* 再去掉,共用 CcpB.combField.fieldList(List) 里的 CcpFieldB.name。Lin
for (Integer index : ccpB.fieldNameMap.keySet()) {
String fieldNameWithoutPrfx = ccpB.fieldNameMap.get(index);
*/
for (CcpFieldB field : ccpB.combField.fieldList) {
String fieldNameWithoutPrfx = field.name;
String fullFieldName = prfx+fieldNameWithoutPrfx;
if(fullFieldName.equals(inpName)){
/* 再去掉,共用 CcpB.combField.fieldList(List) 里的 CcpFieldB.name。Lin
for (Integer j : ccpB.fieldNameMap.keySet()) {
String fieldNameWithoutPrfx2 = ccpB.fieldNameMap.get(j);
*/
for (CcpFieldB f : ccpB.combField.fieldList) {
String fieldNameWithoutPrfx2 = f.name;
String fullFieldName2 = prfx+fieldNameWithoutPrfx2;
List list = inp2CcpMap.get(fullFieldName2);
if(list==null||list.size()==0){
list = new ArrayList<>();
inp2CcpMap.put(fullFieldName2,list);
}
boolean allReadyHave = false;
for (CcpB b : list) {
if(b.name.equals(ccpB.name)){
allReadyHave = true;
break;
}
}
if(!allReadyHave)
list.add(ccpB);
}
continue;
}
}
}
///
// System.out.println(cascadingTagNewAttribute.keySet());
//
// System.out.println(notHandleCascadingInputNames);
/// 改为新UI,增加。Lin
//所有级联菜单的代码,在下面这循环生成
///
for (String[] temp : allcascadingSelect_input) {
Map inputproperties = inputElementProperties_input(temp[0]);
boolean wdReadonly = "true".equals(inputproperties.get("wdReadonly"));
String inputName = temp[1]; // name(String) 改为 inputName -- 与 lastInputName 对应。Lin
/* 再改,IDEA:String concatenation '+=' in loop。Lin
String thisContent=temp[0];
*/ StringBuilder thisContent= new StringBuilder(temp[0]); // 。Lin
CcpB ccp = allcascadingInputNamesObject.get(inputName); // m(CcpB) 改为 ccp。Lin
/// 增加,获取 prfx -- 支持共用 ccp 定义。Lin
String prfx = cascadingPrfx.get(inputName);
///
boolean haveRules = StringUtils.isNotBlank(ccp.combField.rule); //带掩码
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
/* 增加支持共用 ccp 定义。Lin
boolean isinputs = (m.combField.name != null && m.combField.name.equals(name));
*/ boolean isinputs = (ccp.combField.name != null && (prfx + ccp.combField.name).equals(inputName));
// if(isinputs)continue;
// SsLog.print("name:"+ name +"---"+ m.name); // 去掉,干扰。Lin
if(notHandleCascadingInputNames.contains(inputName))
continue;
/* 增加支持共用 ccp 定义。Lin
if(cascadingTagNewAttribute.get(m.name)==null)
*/ if(cascadingTagNewAttribute.get(prfx + ccp.name) == null)
continue;
/* 改用 .lastFieldName。Lin
* List 改为 Map
int si = m.getInputs().getInputList().size() - 1;
String lastInputName = m.getInputs().getInputList().get(si).getName();
*/
/* 再增加,支持共用 ccp 定义。Lin
String lastInputName = m.combField.lastFieldName;
*/ String lastInputName = prfx + ccp.combField.lastFieldName;
/// 改为新UI,增加。Lin
//新UI:生成初始化级联菜单的script
//旧UI:生成级联自定义标签
if(ccpIsNewUI){
StringBuilder scriptSb = new StringBuilder();
if(pageobj.isInp){//是发布录入页
String script = null;
if (lastInputName.equals(inputName)) { // 在最后的 。Lin
String componentType = null;
if (haveRules) {//有编码规则的级联菜单
componentType = PageCompC.FORM_PLUGIN_JS_TYPE_ccpsingle;
}else {
componentType = PageCompC.FORM_PLUGIN_JS_TYPE_ccpmutiple;
}
//返回初始化级联菜单录入组件的JS
script = PageCompU.getInitInputCcpComponentJs(componentType, //组件类弄
ccp,//级联菜单配置
prfx, //级联配置中的前缀
dxm, //对象名
null
);
thisContent.append(script);
}
} else if (pageobj.isInfo) {//是发布baseInfo页
///
/* 改为新UI。Lin
* 去掉,抽取到 doCcpByInfo(,在下面共用。Lin
* m(CcpB) 改为 ccp,name(String) 改为 inputName
if (lastInputName.equals(inputName)) { // 在最后的 。Lin
/// * 再改,IDEA:String concatenation '+=' in loop。Lin
// String v="";
/// *
StringBuilder v = new StringBuilder();
if (haveRules) {
/// * 改。Lin
// * 支持共用 ccp 定义 -- 增加前缀 改为 Map。Lin
// for(int i=0;i 直接改为 wd.edit.objectPicker.createObjectPicker(
// thisContent+="\r\n";
/// *
thisContent.append("/>");
}
*/ doCcpByInfo(inputName, lastInputName, ccp, haveRules, prfx,
namesValue, cascadingTagNewAttribute, vo, dxm, thisContent);
/// 改为新UI,增加。Lin
}
} else {
/* 改为新UI。Lin
* 去掉,共用上面抽取出来的 doCcpByInfo(。Lin
* m(CcpB) 改为 ccp,name(String) 改为 inputName
if (lastInputName.equals(inputName)) { // 在最后的 。Lin
StringBuilder v = new StringBuilder();
if (haveRules) {//有编码规则的级联菜单
if (namesValue.get(prfx + ccp.combField.name) != null) {
v = new StringBuilder(namesValue.get(prfx + ccp.combField.name));
} else if (vo.fieldMap.get(prfx + ccp.combField.name) != null) {
v = new StringBuilder("${"+ dxm +"."+ prfx + ccp.combField.name +"},");
}
} else {//没编码规则的级联菜单
for (CcpFieldB input : ccp.combField.fieldList) {
String n = prfx + input.name;
if (namesValue.get(n) != null) {
v.append(namesValue.get(n)).append(",");
} else if (vo.fieldMap.get(n) != null) {
v.append("${").append(dxm).append(".").append(n).append("},");
} else {
v.append(",");
}
}
v = new StringBuilder(v.substring(0, v.length() -1));
}
cascadingTagNewAttribute.get(prfx + ccp.name).put("value", v.toString());
thisContent.append("\r\n");
}
*/ doCcpByInfo(inputName, lastInputName, ccp, haveRules, prfx,
namesValue, cascadingTagNewAttribute, vo, dxm, thisContent);
}
///
ObjFieldB field = vo.fieldMap.get(inputName);
/// 改为新UI,增加。Lin
// m(CcpB) 改为 ccp,name(String) 改为 inputName
if (ccpIsNewUI) {
if (isInfo || wdReadonly) {//替换baseInfo页的级联菜单代码
if (!haveRules) {
String v=Optional.ofNullable(inputproperties.get("value")).orElse("${"+ dxm +"."+ inputName +"}");
String writeStr="";
String codebook111=Optional.ofNullable(
inputproperties.get("wdCodebook")).orElse((field != null)? field.cbName : null);
if (StringUtils.isNotBlank(codebook111)) {
writeStr += "";
} else {
writeStr="-object未定义codebook-";
SsLog.log("XXXXXXXX -object未定义codebook-");
}
writeStr = ""
+ writeStr +"
";
writeStr += TagComper.compTag(
"");
if (isBaseInfo && (field != null)) {
writeStr="\r\n"
+ writeStr +"\r\n";
}
thisContent = new StringBuilder(thisContent.toString().replace(temp[0], writeStr));
}
} else if(pageobj.isInp) {//新UI 替换录入页的级联菜单代码
List ccpList = inp2CcpMap.get(inputName);
if (ccpList != null) {
String html = null;
//如果是带编码规则的级联菜单
if (haveRules) {
boolean isCombField = (prfx + ccp.combField.name).equals(inputName);
//返回初始化录入级联组件的JS
html = PageCompU.getCcpInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_ccpsingle, //组件类弄
inputproperties,//组件属性
vo,
inputName, //input的name属性
isCombField, //是隐藏字段
ccpList, //级联菜单配置
prfx, //级联菜单前缀
cascadingTagNewAttribute //级联菜单filter放在这
);
} else {
//返回初始化录入级联组件的JS
html = PageCompU.getCcpInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_ccpmutiple, //组件类弄
inputproperties,//组件属性
vo,
inputName, //input的name属性
false, //是隐藏字段
ccpList, //级联菜单配置
prfx, //级联菜单前缀
cascadingTagNewAttribute //级联菜单filter放在这
);
}
thisContent = new StringBuilder(thisContent.toString().replace(temp[0], html));
}
}
if (isBaseInfo && haveRules) {
if (lastInputName.equals(inputName)) {
thisContent.append("\r\n\r\n"); // 不用编译 \r\n"+ temp[0]); // 不用编译 ");
}else{
*/ if (!haveRules) {
String v=Optional.ofNullable(inputproperties.get("value")).orElse("${"+ dxm +"."+ inputName +"}");
String writeStr="";
String codebook111=Optional.ofNullable(
inputproperties.get("wdCodebook")).orElse((field != null)? field.cbName : null);
if (StringUtils.isNotBlank(codebook111)) {
// 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
/* 改。Lin
* 不用编译
";
} else {
writeStr="-object未定义codebook-";
SsLog.log("XXXXXXXX -object未定义codebook-");
}
writeStr = "
";
writeStr += TagComper.compTag(
// 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
/* 改。Lin
"