aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/messaging/MessageEvent.java
blob: 92a742aaaa6836d2276c331865dbde2d6fd8f816 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * $Id$
 * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
 * For details on use and redistribution please refer to the
 * LICENSE file included with these sources.
 */

package org.apache.fop.messaging;

import java.util.EventObject;

/**
 * a container for the text and the type of a message
 * MessageEvents are created by MessageHandler and can be received by any
 * MessageListener, which is added to MessageHandler;
 */
public class MessageEvent extends EventObject {
    public static final int LOG = 0;
    public static final int ERROR = 1;
    String message;
    int messageType = MessageEvent.LOG;

    public MessageEvent(Object source) {
        super(source);
        message = (String)source;    // MessageHandler.getMessage()
    }

    /**
     * retrieves the message
     * @return String containing the message
     *
     */
    public String getMessage() {
        return message;
    }

    /**
     * sets the message type
     * @param messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR
     *
     */
    void setMessageType(int messageType) {
        this.messageType = messageType;
    }

    /**
     * returns the type of message as int
     *
     * @return messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR
     */
    public int getMessageType() {
        return messageType;
    }

}