1 17 18 19 20 package org.apache.fop.logging; 21 22 import java.util.List ; 23 import java.util.ListIterator ; 24 25 import org.apache.commons.logging.Log; 26 import org.apache.commons.logging.LogFactory; 27 import org.apache.fop.layoutmgr.ListElement; 28 import org.apache.fop.layoutmgr.ElementListObserver.Observer; 29 30 38 public class LoggingElementListObserver implements Observer { 39 40 41 public void observe(List elementList, String category, String id) { 42 Log log = LogFactory.getLog(LoggingElementListObserver.class.getName() + "." + category); 43 if (!log.isDebugEnabled()) { 44 return; 45 } 46 log.debug(" "); 47 log.debug("ElementList: category=" + category + ", id=" + id); 48 if (elementList == null) { 49 log.debug("<<empty list>>"); 50 return; 51 } 52 ListIterator tempIter = elementList.listIterator(); 53 ListElement temp; 54 while (tempIter.hasNext()) { 55 temp = (ListElement) tempIter.next(); 56 if (temp.isBox()) { 57 log.debug(tempIter.previousIndex() 58 + ") " + temp); 59 } else if (temp.isGlue()) { 60 log.debug(tempIter.previousIndex() 61 + ") " + temp); 62 } else { 63 log.debug(tempIter.previousIndex() 64 + ") " + temp); 65 } 66 if (temp.getPosition() != null) { 67 log.debug(" " + temp.getPosition()); 68 } 69 } 70 log.debug(" "); 71 } 72 73 } 74 | Popular Tags |