You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MessageEvent.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.messaging;
  8. import java.util.EventObject;
  9. /**
  10. * a container for the text and the type of a message
  11. * MessageEvents are created by MessageHandler and can be received by any
  12. * MessageListener, which is added to MessageHandler;
  13. */
  14. public class MessageEvent extends EventObject {
  15. public static final int LOG = 0;
  16. public static final int ERROR = 1;
  17. String message;
  18. int messageType = MessageEvent.LOG;
  19. public MessageEvent(Object source) {
  20. super(source);
  21. message = (String)source; // MessageHandler.getMessage()
  22. }
  23. /**
  24. * retrieves the message
  25. * @return String containing the message
  26. *
  27. */
  28. public String getMessage() {
  29. return message;
  30. }
  31. /**
  32. * sets the message type
  33. * @param messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR
  34. *
  35. */
  36. void setMessageType(int messageType) {
  37. this.messageType = messageType;
  38. }
  39. /**
  40. * returns the type of message as int
  41. *
  42. * @return messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR
  43. */
  44. public int getMessageType() {
  45. return messageType;
  46. }
  47. }