de.cau.cs.kieler.sim.kiem.config.extension
Class KiemEventListener

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.config.extension.KiemEventListener
All Implemented Interfaces:
IKiemEventListener

public final class KiemEventListener
extends Object
implements IKiemEventListener

Listens to all events from the main KIEM Plugin and handles file related events.

Rating proposed yellow
(2010-01-27)

Constructor Summary
KiemEventListener()
          Creates a new FileEventListener.
 
Method Summary
static KiemEventListener getInstance()
          Returns the instance of the file event listener.
 void notifyEvent(KiemEvent event)
          This is the basic notify method that is called by KIEM whenever an event occurs for which this EventListener is registered (see IKiemEventListener.provideEventOfInterest()).
 KiemEvent provideEventOfInterest()
           Return a KiemEvent type (integer value) that represents a number of events this component wants to listen to.
 void resetLoadImminent()
          Notify the listener that the load failed and it should not expect it.
 void resetSaveImminent()
          Notify the listener that the save failed and it should not expect it.
 void setLoadImminent()
          Notify the listener that the plugin will report a load soon but the listener should ignore it as it was plugin-triggered.
 void setSaveImminent()
          Notify the listener that the plugin will report a save soon but the listener should ignore it as it was plugin-triggered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KiemEventListener

public KiemEventListener()
Creates a new FileEventListener.

Method Detail

getInstance

public static KiemEventListener getInstance()
Returns the instance of the file event listener.

Returns:
the instance

notifyEvent

public void notifyEvent(KiemEvent event)
This is the basic notify method that is called by KIEM whenever an event occurs for which this EventListener is registered (see IKiemEventListener.provideEventOfInterest()).

Specified by:
notifyEvent in interface IKiemEventListener
Parameters:
event - the KiemEvent with additional attached information, depending on the specific event

provideEventOfInterest

public KiemEvent provideEventOfInterest()

Return a KiemEvent type (integer value) that represents a number of events this component wants to listen to.

A KiemEvent can be a combination of several events. The simplest way to register for two events that e.g., indicate a step-command and the removal of the component is to have the following code:

public KiemEvent provideEventOfInterest() {
int[] events = {CMD_STEP, DELETED}
return new KiemEvent(events);
}

Specified by:
provideEventOfInterest in interface IKiemEventListener
Returns:
the KiemEvent type indicating the events of interest

setLoadImminent

public void setLoadImminent()
Notify the listener that the plugin will report a load soon but the listener should ignore it as it was plugin-triggered.


resetLoadImminent

public void resetLoadImminent()
Notify the listener that the load failed and it should not expect it.


setSaveImminent

public void setSaveImminent()
Notify the listener that the plugin will report a save soon but the listener should ignore it as it was plugin-triggered.


resetSaveImminent

public void resetSaveImminent()
Notify the listener that the save failed and it should not expect it.