logahawk.formatters
Class SwingParentArgFormatter

java.lang.Object
  extended by logahawk.formatters.AbstractArgumentFormatter
      extended by logahawk.formatters.ParentObjectArgFormatter
          extended by logahawk.formatters.SwingParentArgFormatter
All Implemented Interfaces:
ArgumentFormatter

public class SwingParentArgFormatter
extends ParentObjectArgFormatter

Uses a SwingArgFormatter to format AWT/Swing objects to show its context within its parent AWT/Swing objects. This should not be added in an ArgumentFormatterContainer with a SwingArgFormatter because both classes have the same implementation of ParentObjectArgFormatter.canFormat(Object). (That means calls to AbstractArgumentFormatter.getChildObjectFormat(Object, Collection, int) from this class, which the default of implementation of ParentObjectArgFormatter uses, will be unable to distinguish which class should be used to format the objects.)


Field Summary
 
Fields inherited from class logahawk.formatters.ParentObjectArgFormatter
childFormatter, collectionArgFormatter, parentFormatter
 
Fields inherited from class logahawk.formatters.AbstractArgumentFormatter
indentor
 
Constructor Summary
SwingParentArgFormatter()
          Defaults the CollectionArgFormatter to using "->" for the separator, "[ " and " ]" for the prefix and suffix.
SwingParentArgFormatter(ArgumentFormatter formatter, CollectionArgFormatter collectionArgFormatter)
           
SwingParentArgFormatter(CollectionArgFormatter collectionArgFormatter)
           
 
Method Summary
protected  Object getParent(Object obj)
          Returns the parent of the provided object.
 
Methods inherited from class logahawk.formatters.ParentObjectArgFormatter
canFormat, format
 
Methods inherited from class logahawk.formatters.AbstractArgumentFormatter
findFormatter, getChildObjectFormat, getIndentor, setIndentor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingParentArgFormatter

public SwingParentArgFormatter()
Defaults the CollectionArgFormatter to using "->" for the separator, "[ " and " ]" for the prefix and suffix.


SwingParentArgFormatter

public SwingParentArgFormatter(CollectionArgFormatter collectionArgFormatter)
Parameters:
collectionArgFormatter - Used to formats the final result after formatting the logged object and parents.

SwingParentArgFormatter

public SwingParentArgFormatter(ArgumentFormatter formatter,
                               CollectionArgFormatter collectionArgFormatter)
Parameters:
formatter - Used to format the child and parent Swing objects.
collectionArgFormatter - Used to formats the final result after formatting the logged object and parents.
Method Detail

getParent

protected Object getParent(Object obj)
Description copied from class: ParentObjectArgFormatter
Returns the parent of the provided object. If there is no parent, this should return null.

Specified by:
getParent in class ParentObjectArgFormatter
Parameters:
obj - Either the original object or another parent.