emul/compact/src/main/java/java/util/EventObject.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 28 Jan 2013 13:28:02 +0100
branchjdk7-b147
changeset 597 ee8a922f4268
permissions -rw-r--r--
More classes requested by FX team
jaroslav@597
     1
/*
jaroslav@597
     2
 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
jaroslav@597
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@597
     4
 *
jaroslav@597
     5
 * This code is free software; you can redistribute it and/or modify it
jaroslav@597
     6
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@597
     7
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@597
     8
 * particular file as subject to the "Classpath" exception as provided
jaroslav@597
     9
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@597
    10
 *
jaroslav@597
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@597
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@597
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@597
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@597
    15
 * accompanied this code).
jaroslav@597
    16
 *
jaroslav@597
    17
 * You should have received a copy of the GNU General Public License version
jaroslav@597
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@597
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@597
    20
 *
jaroslav@597
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@597
    22
 * or visit www.oracle.com if you need additional information or have any
jaroslav@597
    23
 * questions.
jaroslav@597
    24
 */
jaroslav@597
    25
jaroslav@597
    26
package java.util;
jaroslav@597
    27
jaroslav@597
    28
/**
jaroslav@597
    29
 * <p>
jaroslav@597
    30
 * The root class from which all event state objects shall be derived.
jaroslav@597
    31
 * <p>
jaroslav@597
    32
 * All Events are constructed with a reference to the object, the "source",
jaroslav@597
    33
 * that is logically deemed to be the object upon which the Event in question
jaroslav@597
    34
 * initially occurred upon.
jaroslav@597
    35
 *
jaroslav@597
    36
 * @since JDK1.1
jaroslav@597
    37
 */
jaroslav@597
    38
jaroslav@597
    39
public class EventObject implements java.io.Serializable {
jaroslav@597
    40
jaroslav@597
    41
    private static final long serialVersionUID = 5516075349620653480L;
jaroslav@597
    42
jaroslav@597
    43
    /**
jaroslav@597
    44
     * The object on which the Event initially occurred.
jaroslav@597
    45
     */
jaroslav@597
    46
    protected transient Object  source;
jaroslav@597
    47
jaroslav@597
    48
    /**
jaroslav@597
    49
     * Constructs a prototypical Event.
jaroslav@597
    50
     *
jaroslav@597
    51
     * @param    source    The object on which the Event initially occurred.
jaroslav@597
    52
     * @exception  IllegalArgumentException  if source is null.
jaroslav@597
    53
     */
jaroslav@597
    54
    public EventObject(Object source) {
jaroslav@597
    55
        if (source == null)
jaroslav@597
    56
            throw new IllegalArgumentException("null source");
jaroslav@597
    57
jaroslav@597
    58
        this.source = source;
jaroslav@597
    59
    }
jaroslav@597
    60
jaroslav@597
    61
    /**
jaroslav@597
    62
     * The object on which the Event initially occurred.
jaroslav@597
    63
     *
jaroslav@597
    64
     * @return   The object on which the Event initially occurred.
jaroslav@597
    65
     */
jaroslav@597
    66
    public Object getSource() {
jaroslav@597
    67
        return source;
jaroslav@597
    68
    }
jaroslav@597
    69
jaroslav@597
    70
    /**
jaroslav@597
    71
     * Returns a String representation of this EventObject.
jaroslav@597
    72
     *
jaroslav@597
    73
     * @return  A a String representation of this EventObject.
jaroslav@597
    74
     */
jaroslav@597
    75
    public String toString() {
jaroslav@597
    76
        return getClass().getName() + "[source=" + source + "]";
jaroslav@597
    77
    }
jaroslav@597
    78
}