to.etc.domui.dom.errors
Class ErrorFenceHandler

java.lang.Object
  extended by to.etc.domui.dom.errors.ErrorFenceHandler
All Implemented Interfaces:
IErrorFence
Direct Known Subclasses:
PropagatingErrorFenceHandler

public class ErrorFenceHandler
extends java.lang.Object
implements IErrorFence

When controls or business logic encounters errors that need to be reported back to the user they add an error to either a control (usually for validation/conversion errors) or to the page itself (for errors where there's no clear "location" where the problem has occured). Making these errors visible is not the responsibility of a component, but is delegated to one or more ErrorMessageListeners. These listeners get called when an error is registered with a component (or when an error is cleared). The error listener is responsible for handling the actual reporting of the error, and it usually does this by altering the output tree, for instance by adding the error message to the page's defined "error box" and making that box visible. Other listeners can change the CSS Class of the error node in question, causing it to be displayed in a different color for instance. If a page has no registered error handlers it "inherits" the default error handlers from the current Application. By overriding that one you can easily alter the way errors are reported in the entire application. Special components that handle error messages also exist, and these components usually register themselves as listeners when they are added to the tree. This is the best method of handling error reporting because the page designer can easily determine where they are shown.


Constructor Summary
ErrorFenceHandler(NodeContainer container)
           
 
Method Summary
 void addErrorListener(IErrorMessageListener eml)
          Add a new error message listener to the page.
 void addMessage(NodeBase source, UIMessage uim)
           
 void clearGlobalMessages(NodeBase source, java.lang.String code)
           
 NodeContainer getContainer()
           
 void removeErrorListener(IErrorMessageListener eml)
          Discard an error message listener.
 void removeMessage(NodeBase source, UIMessage uim)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorFenceHandler

public ErrorFenceHandler(NodeContainer container)
Method Detail

getContainer

public NodeContainer getContainer()

addErrorListener

public void addErrorListener(IErrorMessageListener eml)
Add a new error message listener to the page.

Specified by:
addErrorListener in interface IErrorFence

removeErrorListener

public void removeErrorListener(IErrorMessageListener eml)
Discard an error message listener.

Specified by:
removeErrorListener in interface IErrorFence
Parameters:
eml -

addMessage

public void addMessage(NodeBase source,
                       UIMessage uim)
Specified by:
addMessage in interface IErrorFence

removeMessage

public void removeMessage(NodeBase source,
                          UIMessage uim)
Specified by:
removeMessage in interface IErrorFence

clearGlobalMessages

public void clearGlobalMessages(NodeBase source,
                                java.lang.String code)
Specified by:
clearGlobalMessages in interface IErrorFence