Search in sources :

Example 6 with DumpTable

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;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Iterator(java.util.Iterator) StringIterator(lucee.runtime.type.it.StringIterator) EntryIterator(lucee.runtime.type.it.EntryIterator)

Example 7 with DumpTable

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;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 8 with DumpTable

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;
}
Also used : DumpRow(lucee.runtime.dump.DumpRow) ArrayList(java.util.ArrayList) DumpData(lucee.runtime.dump.DumpData) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpTable(lucee.runtime.dump.DumpTable) UDF(lucee.runtime.type.UDF) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Collection(lucee.runtime.type.Collection) List(java.util.List) ArrayList(java.util.ArrayList) EvaluateComponent(lucee.runtime.functions.dynamicEvaluation.EvaluateComponent) UDFGSProperty(lucee.runtime.type.UDFGSProperty) Property(lucee.runtime.component.Property) ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey)

Example 9 with DumpTable

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;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 10 with DumpTable

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;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable)

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