Search in sources :

Example 26 with DumpTable

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

the class XMLCaster method toDumpData.

/**
 * Casts a XML Node to a HTML Presentation
 * @param node
 * @param pageContext
 * @return html output
 */
public static DumpData toDumpData(Node node, PageContext pageContext, int maxlevel, DumpProperties props) {
    if (maxlevel <= 0) {
        return DumpUtil.MAX_LEVEL_REACHED;
    }
    maxlevel--;
    // Document
    if (node instanceof Document) {
        DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
        table.setTitle("XML Document");
        table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlRoot"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLROOT, null), pageContext, maxlevel, props));
        return table;
    }
    // Element
    if (node instanceof Element) {
        DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
        table.setTitle("XML Element");
        table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props));
        table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props));
        table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props));
        return table;
    }
    // Text
    if (node instanceof Text) {
        DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
        table.setTitle("XML Text");
        Text txt = (Text) node;
        table.appendRow(1, new SimpleDumpData("XmlText"), new SimpleDumpData(txt.getData()));
        return table;
    }
    // Attr
    if (node instanceof Attr) {
        DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
        table.setTitle("XML Attr");
        table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
        table.appendRow(1, new SimpleDumpData("XmlValue"), DumpUtil.toDumpData(((Attr) node).getValue(), pageContext, maxlevel, props));
        table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true)));
        return table;
    }
    // Node
    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
    table.setTitle("XML Node (" + ListLast.call(null, node.getClass().getName(), ".") + ")");
    table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
    table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString()));
    table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString()));
    table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props));
    table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
    table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props));
    table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props));
    table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true)));
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Element(org.w3c.dom.Element) Text(org.w3c.dom.Text) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 27 with DumpTable

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

the class XMLNodeList method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    maxlevel--;
    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
    table.setTitle("Array (XML Node List)");
    int len = size();
    for (int i = 1; i <= len; i++) {
        table.appendRow(1, new SimpleDumpData(i), DumpUtil.toDumpData(item(i - 1), pageContext, maxlevel, dp));
    }
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 28 with DumpTable

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

the class ThreadsImpl method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    Key[] keys = keys();
    DumpTable table = new DumpTable("struct", "#9999ff", "#ccccff", "#000000");
    table.setTitle("Struct");
    maxlevel--;
    int maxkeys = dp.getMaxKeys();
    int index = 0;
    for (int i = 0; i < keys.length; i++) {
        Key key = keys[i];
        if (maxkeys <= index++)
            break;
        if (DumpUtil.keyValid(dp, maxlevel, key))
            table.appendRow(1, new SimpleDumpData(key.getString()), DumpUtil.toDumpData(get(key, null), pageContext, maxlevel, dp));
    }
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Example 29 with DumpTable

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

the class ArrayClassic method toDumpData.

/**
 * @return return array as ArrayList
 */
/*public synchronized ArrayList toArrayList() {
		ArrayList al=new ArrayList();
		for(int i=offset;i<offset+size;i++) {
			al.add(arr[i]);
		}
		return al;
	}*/
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    DumpTable table = new DumpTable("array", "#99cc33", "#ccff33", "#000000");
    table.setTitle("Array");
    int top = dp.getMaxlevel();
    if (size() > top)
        table.setComment("Rows: " + size() + " (showing top " + top + ")");
    else if (size() > 10 && dp.getMetainfo())
        table.setComment("Rows: " + size());
    int length = size();
    for (int i = 1; i <= length; i++) {
        Object o = null;
        try {
            o = getE(i);
        } catch (Exception e) {
        }
        table.appendRow(1, new SimpleDumpData(i), DumpUtil.toDumpData(o, pageContext, maxlevel, dp));
        if (i == top)
            break;
    }
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) ExpressionException(lucee.runtime.exp.ExpressionException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 30 with DumpTable

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

the class ArrayImpl method toDumpData.

@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
    DumpTable table = new DumpTable("array", "#99cc33", "#ccff33", "#000000");
    table.setTitle("Array");
    int top = dp.getMaxlevel();
    if (size() > top)
        table.setComment("Rows: " + size() + " (showing top " + top + ")");
    else if (size() > 10 && dp.getMetainfo())
        table.setComment("Rows: " + size());
    int length = size();
    for (int i = 1; i <= length; i++) {
        Object o = null;
        try {
            o = getE(i);
        } catch (Exception e) {
        }
        table.appendRow(1, new SimpleDumpData(i), DumpUtil.toDumpData(o, pageContext, maxlevel, dp));
        if (i == top)
            break;
    }
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) PageException(lucee.runtime.exp.PageException)

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