/*
 *	Modulname:	TextChangeEvent
 *	Autor:		Eyer Leander
 *	Datum:		03.03.2005
 *
 *	(c) Copyright 2005 by
 *		Eyer IT Services, Naters
 *	All rights reserved
 */
package survey.gui;

/**
 * The TextChangeEvent encapsulated the information that is passed from textfields to the ChangeListeners
 */
public class TextChangeEvent {

	/** Possible triggers for the TextChangeEvent */
	public enum Trigger {FOCUS_LOST, ACTION};

	/** TextField triggering the TextChangeEvent */
	private Object source;
	/** The old value of the textfield */
	private String oldValue;
	/** The new value of the textfield */
	private String newValue;
	/** Trigger of this event */
	private Trigger trigger;

	/**
	 * Create a new TextChangeEvent
	 * @param source		The TextField triggering the event
	 * @param oldValue 		The old value of the textfield
	 * @param newValue		The new value of the textfield
	 * @param trigger		The kind of event that triggered the TextChangeEvent
	 */
	public TextChangeEvent(Object source, String oldValue, String newValue, Trigger trigger) {
		this.source = source;
		this.oldValue = oldValue;
		this.newValue = newValue;
		this.trigger = trigger;
	}

	/** TextField triggering the TextChangeEvent */
	public Object getSource() {
		return source;
	}

	/** The old value of the textfield */
	public String getOldValue() {
		return oldValue;
	}

	/** The new value of the textfield */
	public String getNewValue() {
		return newValue;
	}

	/** Trigger of this event */
	public Trigger getTrigger() {
		return trigger;
	}

}

