org.openbp.jaspira.event
Class VetoableEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.openbp.jaspira.event.JaspiraEvent
          extended by org.openbp.jaspira.event.VetoableEvent
All Implemented Interfaces:
java.io.Serializable

public class VetoableEvent
extends JaspiraEvent

Event that precedes vetoable changes. Allows plugins to veto, i.e. prevent the execution of a certain action.

Author:
Stephan Moritz
See Also:
Serialized Form

Field Summary
protected  java.lang.Object newObject
          A second message object useful for oldState - newState messages.
 boolean vetoed
          Indicates if a veto has been received, never changes back once true.
 
Fields inherited from class org.openbp.jaspira.event.JaspiraEvent
CONSUMED, HANDELED, STACKABLE, TYPE_BOTTOM_UP, TYPE_DIRECT, TYPE_FLOOD, TYPE_GLOBAL, UNCONSUMABLE
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
VetoableEvent(Plugin source, java.lang.String eventName)
          Creates a VetoEvent without additional information.
VetoableEvent(Plugin source, java.lang.String eventName, java.lang.Object object)
          Creates a VetoEvent with a single message object.
VetoableEvent(Plugin source, java.lang.String eventName, java.lang.Object oldObject, java.lang.Object newObject)
          Creates a new VetoEvent with an old and a new state.
 
Method Summary
 java.lang.Object getNewObject()
          Returns the new Object or null if none.
 java.lang.Object getOldObject()
          Returns the old state.
 boolean isVetoed()
          Returns the veto-status of this event.
 void veto()
          Places a veto, i\.e\. sets vetoed to true.
 
Methods inherited from class org.openbp.jaspira.event.JaspiraEvent
brand, getBrand, getEventGroup, getEventName, getFlags, getLevel, getObject, getOriginalEvent, getSourcePlugin, getTargetClassName, getTargetPluginId, getType, isConsumed, isStackable, isUnconsumable, setObject, setTargetClassName, setTargetPluginId, toString, updateFlags, updateFlags
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vetoed

public boolean vetoed
Indicates if a veto has been received, never changes back once true.


newObject

protected java.lang.Object newObject
A second message object useful for oldState - newState messages.

Constructor Detail

VetoableEvent

public VetoableEvent(Plugin source,
                     java.lang.String eventName,
                     java.lang.Object oldObject,
                     java.lang.Object newObject)
Creates a new VetoEvent with an old and a new state.

Parameters:
source - The plugin that dispatches this event. Must not be null. Will be converted to lower case.
eventName - The name of the event
oldObject - Original object. Can be null.
newObject - Modified object. Can be null.

VetoableEvent

public VetoableEvent(Plugin source,
                     java.lang.String eventName)
Creates a VetoEvent without additional information.

Parameters:
source - The plugin that dispatches this event. Must not be null. Will be converted to lower case.
eventName - The name of the event

VetoableEvent

public VetoableEvent(Plugin source,
                     java.lang.String eventName,
                     java.lang.Object object)
Creates a VetoEvent with a single message object.

Parameters:
source - The plugin that dispatches this event. Must not be null. Will be converted to lower case.
eventName - The name of the event
object - The argument object
Method Detail

isVetoed

public boolean isVetoed()
Returns the veto-status of this event.

Returns:
true If a veto has been placed.
false if it has benn accepted so far.

veto

public void veto()
Places a veto, i\.e\. sets vetoed to true.


getOldObject

public java.lang.Object getOldObject()
Returns the old state. This is simply another naming for getObject () (for name-consistancy with getNewObject ()).


getNewObject

public java.lang.Object getNewObject()
Returns the new Object or null if none.



Copyright © 2011. All Rights Reserved.