Search in sources :

Example 16 with DumpTable

use of lucee.runtime.dump.DumpTable in project Lucee by lucee.

the class COMObject method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    DumpTable table = new DumpTable("com", "#ff3300", "#ff9966", "#660000");
    table.appendRow(1, new SimpleDumpData("COM Object"), new SimpleDumpData(name));
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 17 with DumpTable

use of lucee.runtime.dump.DumpTable in project Lucee by lucee.

the class UDFUtil method toDumpData.

public static DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp, UDF udf, short type) {
    if (!dp.getShowUDFs()) {
        if (TYPE_UDF == type)
            return new SimpleDumpData("<UDF>");
        if (TYPE_BIF == type)
            return new SimpleDumpData("<BIF>");
        if (TYPE_CLOSURE == type)
            return new SimpleDumpData("<Closure>");
        if (TYPE_LAMBDA == type)
            return new SimpleDumpData("<Lambda>");
    }
    // arguments
    FunctionArgument[] args = udf.getFunctionArguments();
    DumpTable atts;
    if (TYPE_UDF == type)
        atts = new DumpTable("udf", "#ca5095", "#e9accc", "#000000");
    else if (TYPE_CLOSURE == type)
        atts = new DumpTable("udf", "#9cb770", "#c7e1ba", "#000000");
    else if (TYPE_BIF == type)
        atts = new DumpTable("udf", "#e1c039", "#f1e2a3", "#000000");
    else
        atts = new DumpTable("udf", "#f3d5bd", "#f6e4cc", "#000000");
    atts.appendRow(new DumpRow(63, new DumpData[] { new SimpleDumpData("label"), new SimpleDumpData("name"), new SimpleDumpData("required"), new SimpleDumpData("type"), new SimpleDumpData("default"), new SimpleDumpData("hint") }));
    for (int i = 0; i < args.length; i++) {
        FunctionArgument arg = args[i];
        DumpData def;
        try {
            Object oa = udf.getDefaultValue(pageContext, i, null);
            if (oa == null)
                oa = "null";
            def = new SimpleDumpData(Caster.toString(oa));
        } catch (PageException e) {
            def = new SimpleDumpData("");
        }
        atts.appendRow(new DumpRow(0, new DumpData[] { new SimpleDumpData(arg.getDisplayName()), new SimpleDumpData(arg.getName().getString()), new SimpleDumpData(arg.isRequired()), new SimpleDumpData(arg.getTypeAsString()), def, new SimpleDumpData(arg.getHint()) }));
    // atts.setRow(0,arg.getHint());
    }
    DumpTable func;
    String label = udf.getDisplayName();
    if (TYPE_CLOSURE == type) {
        func = new DumpTable("#9cb770", "#c7e1ba", "#000000");
        func.setTitle(StringUtil.isEmpty(label) ? "Closure" : "Closure " + label);
    } else if (TYPE_UDF == type) {
        func = new DumpTable("#ca5095", "#e9accc", "#000000");
        String f = "Function ";
        try {
            f = StringUtil.ucFirst(ComponentUtil.toStringAccess(udf.getAccess()).toLowerCase()) + " " + f;
        } catch (ApplicationException e) {
        }
        f += udf.getFunctionName();
        if (udf instanceof UDFGSProperty)
            f += " (generated)";
        func.setTitle(f);
    } else if (TYPE_BIF == type) {
        String f = "Build in Function " + (!StringUtil.isEmpty(label) ? label : udf.getFunctionName());
        func = new DumpTable("#e1c039", "#f1e2a3", "#000000");
        func.setTitle(f);
    } else {
        func = new DumpTable("#f3d5bd", "#f6e4cc", "#000000");
        func.setTitle(StringUtil.isEmpty(label) ? "Lambda" : "Lambda " + label);
    }
    // Source
    String src = udf.getSource();
    if (!StringUtil.isEmpty(src))
        func.setComment("source:" + src);
    String hint = udf.getHint();
    String desc = udf.getDescription();
    if (!StringUtil.isEmpty(desc))
        addComment(func, desc);
    if (!StringUtil.isEmpty(hint))
        addComment(func, hint);
    if (Component.MODIFIER_NONE != udf.getModifier())
        func.appendRow(1, new SimpleDumpData("modifier"), new SimpleDumpData(ComponentUtil.toModifier(udf.getModifier(), "")));
    func.appendRow(1, new SimpleDumpData("arguments"), atts);
    func.appendRow(1, new SimpleDumpData("return type"), new SimpleDumpData(udf.getReturnTypeAsString()));
    return func;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) PageException(lucee.runtime.exp.PageException) ApplicationException(lucee.runtime.exp.ApplicationException) DumpRow(lucee.runtime.dump.DumpRow) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) UDFGSProperty(lucee.runtime.type.UDFGSProperty) FunctionArgument(lucee.runtime.type.FunctionArgument) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpData(lucee.runtime.dump.DumpData)

Example 18 with DumpTable

use of lucee.runtime.dump.DumpTable in project Lucee by lucee.

the class DumpStruct method call.

public static Struct call(PageContext pc, Object object, double maxLevel, String show, String hide, double keys, boolean metainfo, boolean showUDFs, String label) {
    if (show != null && "all".equalsIgnoreCase(show.trim()))
        show = null;
    if (hide != null && "all".equalsIgnoreCase(hide.trim()))
        hide = null;
    Set<String> setShow = (show != null) ? ListUtil.listToSet(show.toLowerCase(), ",", true) : null;
    Set<String> setHide = (hide != null) ? ListUtil.listToSet(hide.toLowerCase(), ",", true) : null;
    DumpProperties properties = new DumpProperties((int) maxLevel, setShow, setHide, (int) keys, metainfo, showUDFs);
    DumpData dd = DumpUtil.toDumpData(object, pc, (int) maxLevel, properties);
    if (!StringUtil.isEmpty(label)) {
        DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000");
        table.appendRow(1, new SimpleDumpData(label));
        table.appendRow(0, dd);
        dd = table;
    }
    RefBoolean hasReference = new RefBooleanImpl(false);
    Struct sct = toStruct(dd, object, hasReference);
    sct.setEL("hasReference", hasReference.toBoolean());
    addMetaData(sct, object);
    return sct;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) RefBoolean(lucee.commons.lang.types.RefBoolean) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpProperties(lucee.runtime.dump.DumpProperties) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpData(lucee.runtime.dump.DumpData) Struct(lucee.runtime.type.Struct)

Example 19 with DumpTable

use of lucee.runtime.dump.DumpTable in project Lucee by lucee.

the class DumpStruct method toStruct.

private static Struct toStruct(DumpData dd, Object object, RefBoolean hasReference) {
    DumpTable table;
    if (dd instanceof DumpTable)
        table = (DumpTable) dd;
    else {
        if (dd == null)
            dd = new SimpleDumpData("null");
        table = new DumpTable("#ffffff", "#cccccc", "#000000");
        table.appendRow(1, dd);
    }
    return toCFML(table, object, hasReference, null);
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 20 with DumpTable

use of lucee.runtime.dump.DumpTable in project Lucee by lucee.

the class Image method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    DumpData dd = _info().toDumpData(pageContext, maxlevel, dp);
    if (dd instanceof DumpTable) {
        DumpTable dt = ((DumpTable) dd);
        dt.setTitle("Struct (Image)");
        try {
            dt.setComment("<img style=\"margin:5px\" src=\"data:image/png;base64," + getBase64String("png") + "\">");
        } catch (PageException e) {
        }
    }
    return dd;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) PageException(lucee.runtime.exp.PageException) DumpData(lucee.runtime.dump.DumpData)

Aggregations

DumpTable (lucee.runtime.dump.DumpTable)48 SimpleDumpData (lucee.runtime.dump.SimpleDumpData)39 DumpData (lucee.runtime.dump.DumpData)6 PageException (lucee.runtime.exp.PageException)5 Collection (lucee.runtime.type.Collection)4 Key (lucee.runtime.type.Collection.Key)4 SQL (lucee.runtime.db.SQL)3 DumpRow (lucee.runtime.dump.DumpRow)3 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)3 Struct (lucee.runtime.type.Struct)3 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 Binding (javax.wsdl.Binding)2 BindingOperation (javax.wsdl.BindingOperation)2 Operation (javax.wsdl.Operation)2 Port (javax.wsdl.Port)2 QName (javax.xml.namespace.QName)2 DumpProperties (lucee.runtime.dump.DumpProperties)2 DumpWriter (lucee.runtime.dump.DumpWriter)2 ExpressionException (lucee.runtime.exp.ExpressionException)2