Search in sources :

Example 26 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class AbstrCFMLScriptTransformer method getTag.

private final Tag getTag(ExprData data, Body parent, TagLibTag tlt, Position start, Position end) throws TemplateException {
    try {
        Tag tag = tlt.getTag(data.factory, start, end);
        tag.setParent(parent);
        return tag;
    } catch (TagLibException e) {
        throw new TemplateException(data.srcCode, e);
    }
/*if(StringUtil.isEmpty(tlt.getTttClassName()))tag= new TagBase(line);
		else {
			try {
				Class<Tag> clazz = ClassUtil.loadClass(tlt.getTttClassName());
				Constructor<Tag> constr = clazz.getConstructor(new Class[]{Position.class});
				tag = constr.newInstance(new Object[]{line});
				
			} 
			catch (Exception e) {
            SystemOut.printDate(e);
				tag= new TagBase(line);
			}
		}*/
}
Also used : TemplateException(lucee.runtime.exp.TemplateException) TagLibTag(lucee.transformer.library.tag.TagLibTag) Tag(lucee.transformer.bytecode.statement.tag.Tag) TagLibException(lucee.transformer.library.tag.TagLibException)

Example 27 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class ApplicationContextSupport method _initTagDefaultAttributeValues.

private static void _initTagDefaultAttributeValues(Config config, TagLib lib, Map<Collection.Key, Map<Collection.Key, Object>> tagDefaultAttributeValues, Struct sct, boolean checkNameSpace) {
    if (sct == null)
        return;
    Iterator<Entry<Key, Object>> it = sct.entryIterator();
    // loop tags
    Struct attrs;
    TagLibTag tag;
    Iterator<Entry<Key, Object>> iit;
    Entry<Key, Object> e;
    Map<Collection.Key, Object> map;
    TagLibTagAttr attr;
    String name;
    while (it.hasNext()) {
        e = it.next();
        attrs = Caster.toStruct(e.getValue(), null);
        if (attrs != null) {
            tag = null;
            if (checkNameSpace) {
                name = e.getKey().getLowerString();
                if (StringUtil.startsWithIgnoreCase(name, lib.getNameSpaceAndSeparator())) {
                    name = name.substring(lib.getNameSpaceAndSeparator().length());
                    tag = lib.getTag(name);
                }
            } else
                tag = lib.getTag(e.getKey().getLowerString());
            if (tag != null) {
                sct.removeEL(e.getKey());
                map = new HashMap<Collection.Key, Object>();
                iit = attrs.entryIterator();
                while (iit.hasNext()) {
                    e = iit.next();
                    map.put(KeyImpl.init(e.getKey().getLowerString()), e.getValue());
                }
                tagDefaultAttributeValues.put(KeyImpl.init(tag.getFullName()), map);
            }
        }
    }
}
Also used : TagLibTagAttr(lucee.transformer.library.tag.TagLibTagAttr) TagLibTag(lucee.transformer.library.tag.TagLibTag) Entry(java.util.Map.Entry) Key(lucee.runtime.type.Collection.Key) Struct(lucee.runtime.type.Struct)

Example 28 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class GetTagList method _call.

private static lucee.runtime.type.Struct _call(PageContext pc, int dialect) throws PageException {
    Struct sct = new StructImpl();
    // synchronized(sct) {
    // hasSet=true;
    TagLib[] tlds;
    TagLibTag tag;
    tlds = ((ConfigImpl) pc.getConfig()).getTLDs(dialect);
    for (int i = 0; i < tlds.length; i++) {
        String ns = tlds[i].getNameSpaceAndSeparator();
        Map<String, TagLibTag> tags = tlds[i].getTags();
        Iterator<String> it = tags.keySet().iterator();
        Struct inner = new StructImpl();
        sct.set(ns, inner);
        while (it.hasNext()) {
            Object n = it.next();
            tag = tlds[i].getTag(n.toString());
            if (tag.getStatus() != TagLib.STATUS_HIDDEN && tag.getStatus() != TagLib.STATUS_UNIMPLEMENTED)
                inner.set(n.toString(), "");
        }
    }
    // }
    return sct;
}
Also used : TagLibTag(lucee.transformer.library.tag.TagLibTag) StructImpl(lucee.runtime.type.StructImpl) TagLib(lucee.transformer.library.tag.TagLib) Struct(lucee.runtime.type.Struct)

Aggregations

TagLibTag (lucee.transformer.library.tag.TagLibTag)28 Tag (lucee.transformer.bytecode.statement.tag.Tag)12 Attribute (lucee.transformer.bytecode.statement.tag.Attribute)11 TagLib (lucee.transformer.library.tag.TagLib)9 TagLibTagAttr (lucee.transformer.library.tag.TagLibTagAttr)8 Body (lucee.transformer.bytecode.Body)7 TemplateException (lucee.runtime.exp.TemplateException)6 Position (lucee.transformer.Position)6 BodyBase (lucee.transformer.bytecode.BodyBase)6 EvaluatorException (lucee.transformer.cfml.evaluator.EvaluatorException)6 LitString (lucee.transformer.expression.literal.LitString)6 Statement (lucee.transformer.bytecode.Statement)5 Entry (java.util.Map.Entry)3 Key (lucee.runtime.type.Collection.Key)3 Struct (lucee.runtime.type.Struct)3 FunctionBody (lucee.transformer.bytecode.FunctionBody)3 Page (lucee.transformer.bytecode.Page)3 ScriptBody (lucee.transformer.bytecode.ScriptBody)3 Expression (lucee.transformer.expression.Expression)3 ArrayList (java.util.ArrayList)2