You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Stephan Albers <St...@af-software.de> on 1999/11/30 20:44:10 UTC

MessageHandler

(a few days no mail and your OUT)

James Tauber schrieb:
> public interface MessageHandler {
>     public void error(String message);
>     public void warning(String message);
>     public void progress(String message);
> }


I see errors and progress messages as two totally different things.

Progress Messages are typically shown on a device (window or console).
You can/could have multiple windows listening to your messages. The
current listener may be different from time to time.

public interface ProgressListener {
  public void progress(int percentage);
  public void progress(int percentage, String message);
}


Error are hard stuff, so:
- you will have a protocoll into a file
- there should be just one ErrorHandler at a time
- you have long/complex explanation..

It should have stuff like:
- error number
- severity factor
- long description (what can we do to overcome the problem)


> 1. how could we better internationalize this?
> Introduce codes and pass an array of Strings for any arguments to be
> included in the message
> eg public void warning(code int, String[] args)

I see this for errors but not neccessarily for progress messages.

(Internationalization:
the default implementation for ResourceBundle has to be encapsulated
because it really hurts. It throws exceptions and doesn't allow you to
change the translation contents dynamically which is a pain when you are
in the process of translating and you don't want to catch every label in
every frame).


> 2. how do we best make the particular MessageHandler implementation that is
> being used global? A lot of classes need to know about it.

Instead of having factories... what about using a global class and it's
class methods (similiar to System.out.println..). I don't see many
different implementations for error handlers:

- protocoll into file (configurable)
- with/without UI

Same is true for a Debug class that could also have assertions.

We have some "util"-classes that we started to use for the previewer, so
util could have:

- Debug
- AssertionException
- ProgressListener
- SecureResourceBundle
- ErrorMessage
- UserMessage (Infos, Hints, Warnings)

Stephan