Package com.itextpdf.commons.actions
Class AbstractContextBasedEventHandler
- java.lang.Object
-
- com.itextpdf.commons.actions.AbstractContextBasedEventHandler
-
- All Implemented Interfaces:
IEventHandler
- Direct Known Subclasses:
ProductEventHandler
public abstract class AbstractContextBasedEventHandler extends java.lang.Object implements IEventHandler
Base class for events handling depending on the context.
-
-
Field Summary
Fields Modifier and Type Field Description private IContext
defaultContext
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractContextBasedEventHandler(IContext onUnknownContext)
Creates a new instance of the handler with the defined fallback for events within unknown contexts.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
onAcceptedEvent(AbstractContextBasedITextEvent event)
Handles the accepted event.void
onEvent(IEvent event)
Performs context validation and if event is allowed to be processed passes it toonAcceptedEvent(AbstractContextBasedITextEvent)
.
-
-
-
Field Detail
-
defaultContext
private final IContext defaultContext
-
-
Constructor Detail
-
AbstractContextBasedEventHandler
protected AbstractContextBasedEventHandler(IContext onUnknownContext)
Creates a new instance of the handler with the defined fallback for events within unknown contexts.- Parameters:
onUnknownContext
- is a fallback for events within unknown context
-
-
Method Detail
-
onEvent
public final void onEvent(IEvent event)
Performs context validation and if event is allowed to be processed passes it toonAcceptedEvent(AbstractContextBasedITextEvent)
.- Specified by:
onEvent
in interfaceIEventHandler
- Parameters:
event
- to handle
-
onAcceptedEvent
protected abstract void onAcceptedEvent(AbstractContextBasedITextEvent event)
Handles the accepted event.- Parameters:
event
- to handle
-
-