Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.swt.widgets
Class MessageBuffer

java.lang.Object
  extended by org.xj3d.ui.swt.widgets.MessageBuffer
All Implemented Interfaces:
java.lang.Runnable, org.j3d.util.ErrorReporter, ErrorHandler

public class MessageBuffer
extends java.lang.Object
implements java.lang.Runnable, ErrorHandler

A buffer for holding messages and a runnable instance for flushing the messages to the console Text widgets on the display thread.

Version:
$Revision: 1.4 $
Author:
Rex Melton

Constructor Summary
MessageBuffer()
          Constructor
 
Method Summary
 void append(java.lang.String message)
          Append the argument message to the buffer
 void clear()
          Clear the buffer
 void error(VRMLException vpe)
          Notification of a recoverable error in the parsing.
 void errorReport(java.lang.String msg, java.lang.Exception e)
          Notification of a recoverable error.
 void fatalError(VRMLException vpe)
          Notification of a non-recoverable error.
 void fatalErrorReport(java.lang.String msg, java.lang.Exception e)
          Notification of a non-recoverable error that halts the entire system.
 void messageReport(java.lang.String msg)
          Notification of an informational message from the system.
 void partialReport(java.lang.String msg)
          Notification of an partial message from the system.
 void redirectSystemMessages()
          Redirect system messages to the console.
 void run()
          Called on the display thread to flush the buffered messages to the text widget
 void setDocumentLocator(Locator loc)
          Set the document locator that can be used by the implementing code to find out information about the current line information.
 void setTextWidget(org.eclipse.swt.widgets.Text text)
          Set the text widget to use for displaying the messages.
 void warning(VRMLException vpe)
          Notification of a warning in the way the code has been handled.
 void warningReport(java.lang.String msg, java.lang.Exception e)
          Notification of a warning in the way the system is currently operating.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBuffer

public MessageBuffer()
Constructor

Method Detail

setDocumentLocator

public void setDocumentLocator(Locator loc)
Set the document locator that can be used by the implementing code to find out information about the current line information. This method is called by the parser to your code to give you a locator to work with. If this has not been set by the time startDocument() has been called, you can assume that you will not have one available.

Specified by:
setDocumentLocator in interface ErrorHandler
Parameters:
loc - The locator instance to use

warning

public void warning(VRMLException vpe)
             throws VRMLException
Notification of a warning in the way the code has been handled. The parser will continue through the file after this. Throw another exception if we want the parser to halt as a result.

Parameters:
vpe - The exception that caused this warning
Throws:
VRMLException - Create a further warning condition

error

public void error(VRMLException vpe)
           throws VRMLException
Notification of a recoverable error in the parsing. The parser will continue to keep parsing after this error. Throw another exception if we really want the parser to stop at this point.

Parameters:
vpe - The exception that caused this warning
Throws:
VRMLException - Create a further warning condition

fatalError

public void fatalError(VRMLException vpe)
                throws VRMLException
Notification of a non-recoverable error. The parser will not continue after calling this method. Throw another exception if we really want to make note of this, the parser will stop anyway.

Parameters:
vpe - The exception that caused this warning
Throws:
VRMLException - Create a further warning condition

partialReport

public void partialReport(java.lang.String msg)
Notification of an partial message from the system. When being written out to a display device, a partial message does not have a line termination character appended to it, allowing for further text to appended on that same line.

Parameters:
msg - The text of the message to be displayed

messageReport

public void messageReport(java.lang.String msg)
Notification of an informational message from the system. For example, it may issue a message when a URL cannot be resolved.

Specified by:
messageReport in interface org.j3d.util.ErrorReporter
Parameters:
msg - The text of the message to be displayed

warningReport

public void warningReport(java.lang.String msg,
                          java.lang.Exception e)
Notification of a warning in the way the system is currently operating. This is a non-fatal, non-serious error. For example you will get an warning when a value has been set that is out of range.

Specified by:
warningReport in interface org.j3d.util.ErrorReporter
Parameters:
msg - The text of the message to be displayed
e - The exception that caused this warning. May be null

errorReport

public void errorReport(java.lang.String msg,
                        java.lang.Exception e)
Notification of a recoverable error. This is a serious, but non-fatal error, for example trying to add a route to a non-existent node or the use of a node that the system cannot find the definition of.

Specified by:
errorReport in interface org.j3d.util.ErrorReporter
Parameters:
msg - The text of the message to be displayed
e - The exception that caused this warning. May be null

fatalErrorReport

public void fatalErrorReport(java.lang.String msg,
                             java.lang.Exception e)
Notification of a non-recoverable error that halts the entire system. After you recieve this report the runtime system will no longer function - for example a non-recoverable parsing error. The best way out is to reload the file or restart the application internals.

Specified by:
fatalErrorReport in interface org.j3d.util.ErrorReporter
Parameters:
msg - The text of the message to be displayed
e - The exception that caused this warning. May be null

run

public void run()
Called on the display thread to flush the buffered messages to the text widget

Specified by:
run in interface java.lang.Runnable

append

public void append(java.lang.String message)
Append the argument message to the buffer

Parameters:
message - - The message

clear

public void clear()
Clear the buffer


setTextWidget

public void setTextWidget(org.eclipse.swt.widgets.Text text)
Set the text widget to use for displaying the messages.

Parameters:
text - - The Text widget displaying the messages

redirectSystemMessages

public void redirectSystemMessages()
Redirect system messages to the console.


Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium