au.com.zip.cs
Class ContextAdaptor

java.lang.Object
  extended by au.com.zip.cs.ContextAdaptor
All Implemented Interfaces:
Context
Direct Known Subclasses:
FileContext, SimpleContext, WebPageContext, WebPageTabbedPaneContext

public abstract class ContextAdaptor
extends Object
implements Context

A partial implementation of a context for reporting errors and warnings.

Author:
Cameron Simpson <cs@zip.com.au> 12apr2003

Constructor Summary
ContextAdaptor(Context p)
          Construct a new Context with the specified parent.
 
Method Summary
 Context getParentContext()
          Return the parent context of this context.
 int print(Writer w)
          Transcribe this FileContext to a Writer.
 void printMsg(Writer w, String msg)
          Print a message with the current context to a Writer.
 void setParentContext(Context p)
          Set the parent of this context.
 String toString()
          Transcribe this context to a String.
 String toStringOnly()
          Transcribe this context, but not its ancestors, to a String.
 void whinge(String complaint)
          Print a message with the current context to the system error stream via Util.errWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface au.com.zip.cs.Context
printOnly
 

Constructor Detail

ContextAdaptor

public ContextAdaptor(Context p)
Construct a new Context with the specified parent.

Parameters:
p - the parent Context, if any
Method Detail

getParentContext

public final Context getParentContext()
Return the parent context of this context.

Specified by:
getParentContext in interface Context

setParentContext

public final void setParentContext(Context p)
Set the parent of this context.

Specified by:
setParentContext in interface Context
Parameters:
p - the new parent

toString

public final String toString()
Transcribe this context to a String.

Specified by:
toString in interface Context
Overrides:
toString in class Object
Returns:
the transcription

toStringOnly

public String toStringOnly()
Transcribe this context, but not its ancestors, to a String.

Specified by:
toStringOnly in interface Context
Returns:
the transcription

print

public final int print(Writer w)
                throws IOException
Transcribe this FileContext to a Writer.

Specified by:
print in interface Context
Parameters:
w - the Writer
Returns:
the indent for associated messages
Throws:
IOException

printMsg

public final void printMsg(Writer w,
                           String msg)
                    throws IOException
Print a message with the current context to a Writer.

Specified by:
printMsg in interface Context
Parameters:
w - the Writer
msg - the message
Throws:
IOException

whinge

public final void whinge(String complaint)
                  throws IOException
Print a message with the current context to the system error stream via Util.errWriter.

Specified by:
whinge in interface Context
Parameters:
complaint - the message
Throws:
IOException