【仅供内部供应商使用,不提供对外解答和培训】
...
| Code Block | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
package com.fr.stable.fun;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.mark.Mutable;
/**
* Created by richie on 16/4/26.
* 脚本占位,用于在page.html或者form.html中引入脚本
*/
public interface JavaScriptPlaceHolder extends Mutable {
String MARK_STRING = "JavaScriptPlaceHolder";
int CURRENT_LEVEL = 2;
/**
* 占位的内容
* @return 内容
*/
String placeHolderContent();
/**
* 脚本内容
* @return 脚本描述对象
*/
ScriptTag[] holderScripts();
class ScriptTag {
private String type;
private String src;
private String text;
public static ScriptTag build() {
return new ScriptTag();
}
private ScriptTag() {
}
public ScriptTag type(String type) {
this.type = type;
return this;
}
public ScriptTag src(String src) {
this.src = src;
return this;
}
public ScriptTag text(String text) {
this.text = text;
return this;
}
public String toTag() {
StringBuilder sb = new StringBuilder();
sb.append("<script");
if (StringUtils.isNotEmpty(type)) {
sb.append(" ");
sb.append("type=");
sb.append("\"");
sb.append(type);
sb.append("\"");
}
if (StringUtils.isNotEmpty(src)) {
sb.append(" ");
sb.append("src=");
sb.append("\"");
sb.append(src);
sb.append("\"");
}
sb.append(">");
if (StringUtils.isNotEmpty(text)) {
sb.append(text);
}
sb.append("</script>");
return sb.toString();
}
}
}
|
...