jcckit.plot.PlotEvent Maven / Gradle / Ivy
/*
* Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details
* (http://www.gnu.org/copyleft/lesser.html).
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package jcckit.plot;
/**
* A plot event signales some changes of a {@link Plot}.
* It has three attributes:
* - source: Indicates the Plot instance responsible
* for this event.
*
- type: The type of event.
*
- message: The message object. Its meaning depends on the
* type of event:
*
* Type Meaning of the message object
* {@link PlotEventType#DATA_PLOT_CONNECTED},
* {@link PlotEventType#DATA_PLOT_DISCONNECTED}
* The {@link jcckit.data.DataPlot} (dis)connected with the
* {@link Plot} instance specified by the source.
* {@link PlotEventType#DATA_PLOT_CHANGED}
* An Integer indicating the lowest index of
* those curves which have been changed.
* {@link PlotEventType#DATA_CURVE_CHANGED}
* An Integer indicating the index of the curve
* which has been changed.
*
*
*
*
* @author Franz-Josef Elmer
*/
public class PlotEvent {
private final Plot _source;
private final PlotEventType _type;
private final Object _message;
/**
* Creates a new event for the specified source, type, and message.
* @param source Plot causing this event.
* @param type Type of the event. Possible values are
* {@link PlotEventType#DATA_PLOT_CHANGED},
* {@link PlotEventType#DATA_CURVE_CHANGED},
* {@link PlotEventType#DATA_PLOT_CONNECTED}, and
* {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
* @param message Message object. Can be null
*/
public PlotEvent(Plot source, PlotEventType type, Object message) {
_source = source;
_type = type;
_message = message;
}
/** Returns the source of this event. */
public Plot getSource() {
return _source;
}
/**
* Returns the event type.
* @return either {@link PlotEventType#DATA_PLOT_CHANGED},
* {@link PlotEventType#DATA_CURVE_CHANGED},
* {@link PlotEventType#DATA_PLOT_CONNECTED}, or
* {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
*/
public PlotEventType getType() {
return _type;
}
/** Returns the message object. */
public Object getMessage() {
return _message;
}
}