use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class StructImplKey method toDumpData.
/**
* @see lucee.runtime.dump.Dumpable#toDumpData(lucee.runtime.PageContext, int)
*/
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
Iterator it = _map.keySet().iterator();
DumpTable table = new DumpTable("struct", "#9999ff", "#ccccff", "#000000");
table.setTitle("Struct");
maxlevel--;
int maxkeys = dp.getMaxKeys();
int index = 0;
while (it.hasNext()) {
Object key = it.next();
if (DumpUtil.keyValid(dp, maxlevel, key.toString())) {
if (maxkeys <= index++)
break;
table.appendRow(1, new SimpleDumpData(key.toString()), DumpUtil.toDumpData(_map.get(key), pageContext, maxlevel, dp));
}
}
return table;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class DateImpl method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
String str = castToString("");
DumpTable table = new DumpTable("date", "#ff9900", "#ffcc00", "#000000");
table.appendRow(1, new SimpleDumpData("Date"), new SimpleDumpData(str));
return table;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class ComponentImpl method thisScope.
static DumpTable thisScope(ComponentImpl ci, PageContext pc, int maxlevel, DumpProperties dp, int access) {
DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000");
DumpTable[] accesses = new DumpTable[4];
accesses[Component.ACCESS_REMOTE] = new DumpTable("#ccffcc", "#ffffff", "#000000");
accesses[Component.ACCESS_REMOTE].setTitle("remote");
accesses[Component.ACCESS_PUBLIC] = new DumpTable("#ffcc99", "#ffffcc", "#000000");
accesses[Component.ACCESS_PUBLIC].setTitle("public");
accesses[Component.ACCESS_PACKAGE] = new DumpTable("#ff9966", "#ffcc99", "#000000");
accesses[Component.ACCESS_PACKAGE].setTitle("package");
accesses[Component.ACCESS_PRIVATE] = new DumpTable("#ff6633", "#ff9966", "#000000");
accesses[Component.ACCESS_PRIVATE].setTitle("private");
maxlevel--;
ComponentSpecificAccess cw = new ComponentSpecificAccess(Component.ACCESS_PRIVATE, ci);
Collection.Key[] keys = cw.keys();
List<DumpRow>[] drAccess = new List[4];
for (int i = 0; i < drAccess.length; i++) // ACCESS_REMOTE=0, ACCESS_PUBLIC=1, ACCESS_PACKAGE=2, ACCESS_PRIVATE=3
drAccess[i] = new ArrayList();
Collection.Key key;
for (int i = 0; i < keys.length; i++) {
key = keys[i];
List<DumpRow> box = drAccess[ci.getAccess(key)];
Object o = cw.get(key, null);
if (o == ci)
o = "[this]";
if (DumpUtil.keyValid(dp, maxlevel, key)) {
String memberName = (o instanceof UDF) ? ((UDF) o).getFunctionName() : key.getString();
box.add(new DumpRow(1, new SimpleDumpData(memberName), DumpUtil.toDumpData(o, pc, maxlevel, dp)));
}
}
List<DumpRow> dumpRows;
for (int i = 0; i < drAccess.length; i++) {
dumpRows = drAccess[i];
if (!dumpRows.isEmpty()) {
Collections.sort(dumpRows, new Comparator<DumpRow>() {
@Override
public int compare(DumpRow o1, DumpRow o2) {
DumpData[] rowItems1 = o1.getItems();
DumpData[] rowItems2 = o2.getItems();
if (rowItems1.length >= 0 && rowItems2.length > 0 && rowItems1[0] instanceof SimpleDumpData && rowItems2[0] instanceof SimpleDumpData)
return String.CASE_INSENSITIVE_ORDER.compare(rowItems1[0].toString(), rowItems2[0].toString());
return 0;
}
});
DumpTable dtAccess = accesses[i];
dtAccess.setWidth("100%");
for (DumpRow dr : dumpRows) dtAccess.appendRow(dr);
table.appendRow(0, dtAccess);
}
}
// properties
if (ci.top.properties.persistent || ci.top.properties.accessors) {
Property[] properties = ci.getProperties(false, true, false, false);
DumpTable prop = new DumpTable("#99cc99", "#ccffcc", "#000000");
prop.setTitle("Properties");
prop.setWidth("100%");
Property p;
Object child;
for (int i = 0; i < properties.length; i++) {
p = properties[i];
child = ci.scope.get(KeyImpl.init(p.getName()), null);
DumpData dd;
if (child instanceof Component) {
DumpTable t = new DumpTable("component", "#99cc99", "#ffffff", "#000000");
t.appendRow(1, new SimpleDumpData(((Component) child).getPageSource().getDialect() == CFMLEngine.DIALECT_CFML ? "Component" : "Class"), new SimpleDumpData(((Component) child).getCallName()));
dd = t;
} else {
dd = DumpUtil.toDumpData(child, pc, maxlevel - 1, dp);
}
prop.appendRow(1, new SimpleDumpData(p.getName()), dd);
}
if (access >= ACCESS_PUBLIC && !prop.isEmpty()) {
table.appendRow(0, prop);
}
}
return table;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class ComponentImpl method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp, int access) {
boolean isCFML = getPageSource().getDialect() == CFMLEngine.DIALECT_CFML;
DumpTable table = isCFML ? new DumpTable("component", "#ff4542", "#ff9aad", "#000000") : new DumpTable("component", "#ca6b50", "#e9bcac", "#000000");
table.setTitle((isCFML ? "Component" : "Class") + " " + getCallPath() + "" + (" " + StringUtil.escapeHTML(top.properties.dspName)));
table.setComment("Only the functions and data members that are accessible from your location are displayed");
// Extends
if (!StringUtil.isEmpty(top.properties.extend, true))
table.appendRow(1, new SimpleDumpData("Extends"), new SimpleDumpData(top.properties.extend));
// Interfaces
if (!StringUtil.isEmpty(top.properties.implement, true))
table.appendRow(1, new SimpleDumpData("Implements"), new SimpleDumpData(top.properties.implement));
if (top.properties.modifier != Member.MODIFIER_NONE)
table.appendRow(1, new SimpleDumpData("Modifier"), new SimpleDumpData(ComponentUtil.toModifier(top.properties.modifier, "")));
if (top.properties.hint.trim().length() > 0)
table.appendRow(1, new SimpleDumpData("Hint"), new SimpleDumpData(top.properties.hint));
// this
DumpTable thisScope = thisScope(top, pageContext, maxlevel, dp, access);
if (!thisScope.isEmpty())
table.appendRow(1, new SimpleDumpData("this"), thisScope);
// static
DumpTable staticScope = _static._toDumpData(top, pageContext, maxlevel, dp, getAccess(pageContext));
if (!staticScope.isEmpty())
table.appendRow(1, new SimpleDumpData("static"), staticScope);
return table;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class InterfaceImpl method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DumpTable table = new DumpTable("interface", "#99cc99", "#ffffff", "#000000");
table.setTitle("Interface " + callPath + "" + (" " + StringUtil.escapeHTML(dspName)));
table.setComment("Interface can not directly invoked as a object");
// table.appendRow(1,new SimpleDumpData(""),_toDumpData(top,pageContext,maxlevel,access));
return table;
}
Aggregations