All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jgcomptech.tools.events.ActionEvent Maven / Gradle / Ivy

package com.jgcomptech.tools.events;

import java.util.List;

/**
 * An {@link Event} representing some type of action.
 * @since 1.4.0
 */
public class ActionEvent extends Event {
    /** The only valid EventType for the ActionEvent. */
    public static final EventType ACTION = new EventType<>(Event.ANY, "ACTION");

    /** Common supertype for all action event types. */
    public static final EventType ANY = ACTION;

    /**
     * Construct a new {@code ActionEvent} with the specified event target.
     * All ActionEvents have their type set to {@code ACTION}.
     * @param target    the event target to associate with the event
     */
    public ActionEvent(final EventTarget target) { super(target, ACTION); }

    /**
     * Construct a new {@code ActionEvent} with the specified event target and type.
     * All ActionEvents have their type set to {@code ACTION}.
     * @param target    the event target to associate with the event
     * @param eventType the event type
     */
    public ActionEvent(final EventTarget target,
                       final EventType eventType) {
        super(target, eventType);
    }

    /**
     * Construct a new {@code ActionEvent} with the specified event target, type and args.
     * All ActionEvents have their type set to {@code ACTION}.
     * @param target    the event target to associate with the event
     * @param eventType the event type
     * @param args arguments to make available to the EventHandler
     */
    public ActionEvent(final EventTarget target,
                       final EventType eventType,
                       final List args) {
        super(target, eventType, args);
    }

    @Override
    public EventType getEventType() {
        return (EventType) super.getEventType();
    }

    @Override
    public ActionEvent copyFor(final Object newSource, final EventTarget newTarget) {
        return (ActionEvent) super.copyFor(newSource, newTarget);
    }
}