make EscherContainerRecord.toString() indent children even if they don't support toString(indent)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1151802 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
808014be4c
commit
02212c53d3
@ -17,14 +17,14 @@
|
|||||||
|
|
||||||
package org.apache.poi.ddf;
|
package org.apache.poi.ddf;
|
||||||
|
|
||||||
import org.apache.poi.util.HexDump;
|
import java.io.PrintWriter;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.io.PrintWriter;
|
|
||||||
|
import org.apache.poi.util.HexDump;
|
||||||
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escher container records store other escher records as children.
|
* Escher container records store other escher records as children.
|
||||||
@ -223,43 +223,35 @@ public final class EscherContainerRecord extends EscherRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
|
||||||
return toString("");
|
|
||||||
}
|
|
||||||
public String toString(String indent)
|
|
||||||
{
|
{
|
||||||
String nl = System.getProperty( "line.separator" );
|
String nl = System.getProperty( "line.separator" );
|
||||||
|
|
||||||
StringBuffer children = new StringBuffer();
|
StringBuffer children = new StringBuffer();
|
||||||
if (_childRecords.size() > 0) {
|
if ( _childRecords.size() > 0 )
|
||||||
|
{
|
||||||
children.append( " children: " + nl );
|
children.append( " children: " + nl );
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for ( Iterator<EscherRecord> iterator = _childRecords.iterator(); iterator.hasNext(); )
|
for ( Iterator<EscherRecord> iterator = _childRecords.iterator(); iterator
|
||||||
|
.hasNext(); )
|
||||||
{
|
{
|
||||||
String newIndent = indent + " ";
|
|
||||||
|
|
||||||
EscherRecord record = iterator.next();
|
EscherRecord record = iterator.next();
|
||||||
children.append(newIndent + "Child " + count + ":" + nl);
|
children.append( " Child " + count + ":" + nl );
|
||||||
|
String childResult = String.valueOf( record );
|
||||||
if(record instanceof EscherContainerRecord) {
|
childResult = childResult.replaceAll( "\n", "\n " );
|
||||||
EscherContainerRecord ecr = (EscherContainerRecord)record;
|
children.append( " " );
|
||||||
children.append( ecr.toString(newIndent));
|
children.append( childResult );
|
||||||
} else {
|
children.append( nl );
|
||||||
children.append( record.toString() );
|
|
||||||
}
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return getClass().getName() + " (" + getRecordName() + "):" + nl
|
||||||
indent + getClass().getName() + " (" + getRecordName() + "):" + nl +
|
+ " isContainer: " + isContainerRecord() + nl
|
||||||
indent + " isContainer: " + isContainerRecord() + nl +
|
+ " options: 0x" + HexDump.toHex( getOptions() ) + nl
|
||||||
indent + " options: 0x" + HexDump.toHex( getOptions() ) + nl +
|
+ " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
|
||||||
indent + " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
|
+ " numchildren: " + _childRecords.size() + nl
|
||||||
indent + " numchildren: " + _childRecords.size() + nl +
|
+ children.toString();
|
||||||
indent + children.toString();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EscherSpRecord getChildById(short recordId) {
|
public EscherSpRecord getChildById(short recordId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user