Search in sources :

Example 1 with CFTagCore

use of lucee.runtime.tag.CFTagCore in project Lucee by lucee.

the class GetBaseTagList method getName.

private static String getName(PageContext pc, Tag tag) {
    Class clazz = tag.getClass();
    if (clazz == CFImportTag.class)
        clazz = CFTag.class;
    String className = clazz.getName();
    TagLib[] tlds = ((ConfigImpl) pc.getConfig()).getTLDs(pc.getCurrentTemplateDialect());
    TagLibTag tlt;
    for (int i = 0; i < tlds.length; i++) {
        // String ns = tlds[i].getNameSpaceAndSeparator();
        Map tags = tlds[i].getTags();
        Iterator it = tags.keySet().iterator();
        while (it.hasNext()) {
            tlt = (TagLibTag) tags.get(it.next());
            if (tlt.getTagClassDefinition().isClassNameEqualTo(className)) {
                // custm tag
                if (tag instanceof AppendixTag) {
                    AppendixTag atag = (AppendixTag) tag;
                    if (atag.getAppendix() != null && !(tag instanceof Module)) {
                        return tlt.getFullName().toUpperCase() + atag.getAppendix().toUpperCase();
                    }
                }
                // built in cfc based custom tag
                if (tag instanceof CFTagCore) {
                    if (((CFTagCore) tag).getName().equals(tlt.getAttribute("__name").getDefaultValue()))
                        return tlt.getFullName().toUpperCase();
                    continue;
                }
                return tlt.getFullName().toUpperCase();
            }
        }
    }
    return ListUtil.last(className, ".", true).toUpperCase();
}
Also used : TagLibTag(lucee.transformer.library.tag.TagLibTag) CFTag(lucee.runtime.tag.CFTag) CFTagCore(lucee.runtime.tag.CFTagCore) TagLib(lucee.transformer.library.tag.TagLib) Iterator(java.util.Iterator) AppendixTag(lucee.runtime.ext.tag.AppendixTag) Module(lucee.runtime.tag.Module) Map(java.util.Map) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 2 with CFTagCore

use of lucee.runtime.tag.CFTagCore in project Lucee by lucee.

the class GetBaseTagData method getParentCFTag.

public static CFTag getParentCFTag(Tag tag, String trgTagName, int minLevel) {
    String pureName = trgTagName;
    int level = 0;
    CFTag cfTag;
    while (tag != null) {
        if (tag instanceof CFTag && minLevel <= (level++)) {
            cfTag = (CFTag) tag;
            if (cfTag instanceof CFTagCore) {
                CFTagCore tc = (CFTagCore) cfTag;
                if ((tc.getName() + "").equalsIgnoreCase(pureName))
                    return cfTag;
                if (StringUtil.startsWithIgnoreCase(pureName, "cf")) {
                    pureName = pureName.substring(2);
                }
                if ((tc.getName() + "").equalsIgnoreCase(pureName))
                    return cfTag;
            } else if (cfTag.getAppendix().equalsIgnoreCase(pureName)) {
                return cfTag;
            } else if (StringUtil.startsWithIgnoreCase(pureName, "cf_")) {
                pureName = pureName.substring(3);
                if (cfTag.getAppendix().equalsIgnoreCase(pureName))
                    return cfTag;
            }
        }
        tag = tag.getParent();
    }
    return null;
}
Also used : CFTag(lucee.runtime.tag.CFTag) CFTagCore(lucee.runtime.tag.CFTagCore)

Aggregations

CFTag (lucee.runtime.tag.CFTag)2 CFTagCore (lucee.runtime.tag.CFTagCore)2 Iterator (java.util.Iterator)1 Map (java.util.Map)1 ConfigImpl (lucee.runtime.config.ConfigImpl)1 AppendixTag (lucee.runtime.ext.tag.AppendixTag)1 Module (lucee.runtime.tag.Module)1 TagLib (lucee.transformer.library.tag.TagLib)1 TagLibTag (lucee.transformer.library.tag.TagLibTag)1