use of org.beetl.core.TagFactory in project beetl2.0 by javamonkey.
the class HTMLTagSupportWrapper method render.
@Override
public void render() {
if (args.length == 0 || args.length > 2) {
throw new RuntimeException("参数错误,期望child,Map .....");
}
String child = (String) args[0];
// 首先查找 已经注册的Tag
TagFactory tagFactory = null;
String functionTagName = child.replace(':', '.');
tagFactory = this.gt.getTagFactory(functionTagName);
if (tagFactory == null) {
String path = getHtmlTagResourceId(child);
callHtmlTag(path);
} else {
callTag(tagFactory);
}
}
use of org.beetl.core.TagFactory in project beetl2.0 by javamonkey.
the class TagStatement method execute.
@Override
public void execute(Context ctx) {
Tag tag = null;
try {
TagFactory tagFactory = ctx.gt.getTagFactory(this.tagName);
tag = tagFactory.createTag();
Object[] args = null;
if (paras.length == 0) {
args = ObjectUtil.EMPTY_OBJECT_ARRAY;
} else {
args = new Object[paras.length];
for (int i = 0; i < args.length; i++) {
args[i] = paras[i].evaluate(ctx);
}
}
tag.init(ctx, args, block);
runTag(tag, ctx);
} catch (BeetlException ex) {
ex.pushToken(this.token);
throw ex;
} catch (RuntimeException ex) {
BeetlException bex = new BeetlException(BeetlException.TAG_INSTANCE_ERROR, ex.getMessage(), ex);
bex.pushToken(token);
throw bex;
}
}
use of org.beetl.core.TagFactory in project beetl2.0 by javamonkey.
the class HTMLTagVarBindingWrapper method init.
public void init(Context ctx, Object[] args, Statement st) {
super.init(ctx, args, st);
if (args.length == 0 || args.length > 3) {
throw new RuntimeException("参数错误,期望child,Map .....");
}
String child = (String) args[0];
// 已经注册的Tag
TagFactory tagFactory = null;
String functionTagName = child.replace(':', '.');
tagFactory = this.gt.getTagFactory(functionTagName);
if (tagFactory == null) {
throw new RuntimeException("标签初始化错误,未找到指定的标签实现类" + functionTagName);
}
tag = tagFactory.createTag();
if (tag == null) {
throw new RuntimeException("找不到注册的Tag");
} else if (!(tag instanceof TagVarBinding)) {
throw new RuntimeException(tag.getClass() + " 必须是TagVarBinding的实现类");
}
tag.init(ctx, args, st);
}
Aggregations