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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations