public class FilteredEventListener extends Object implements IEventListener
Modifier and Type | Field and Description |
---|---|
protected List<IEventListener> |
delegates |
protected List<IEventFilter[]> |
filters |
Constructor and Description |
---|
FilteredEventListener()
Constructs a FilteredEventListener empty instance.
|
FilteredEventListener(IEventListener delegate, IEventFilter... filterSet)
Constructs a FilteredEventListener instance with one delegate.
|
Modifier and Type | Method and Description |
---|---|
|
attachEventListener(T delegate, IEventFilter... filterSet)
Attaches another IEventListener delegate with its filters.
|
void |
eventOccurred(IEventData data, EventType type)
Called when some event occurs during parsing a content stream.
|
Set<EventType> |
getSupportedEvents()
Provides the set of event types this listener supports.
|
protected final List<IEventListener> delegates
protected final List<IEventFilter[]> filters
public FilteredEventListener()
FilteredEventListener
empty instance. Use attachEventListener(IEventListener, IEventFilter...)
to add an event listener along with its filters.
public FilteredEventListener(IEventListener delegate, IEventFilter... filterSet)
FilteredEventListener
instance with one delegate. Use attachEventListener(IEventListener, IEventFilter...)
to add more IEventListener
delegates along with their filters.
delegate
- a delegate that fill be called when all the corresponding filters for an event pass
filterSet
- filters attached to the delegate that will be tested before passing an event on to the delegate
publicIEventListener> T attachEventListener(T delegate, IEventFilter... filterSet)
IEventListener
delegate with its filters. When all the filters attached to the delegate for an event accept the event, the event will be passed on to the delegate. You can attach multiple delegates to this FilteredEventListener
instance. The content stream will be parsed just once, so it is better for performance than creating multiple FilteredEventListener
instances and parsing the content stream multiple times. This is useful, for instance, when you want to extract content from multiple regions of a page.
delegate
- a delegate that fill be called when all the corresponding filters for an event pass
filterSet
- filters attached to the delegate that will be tested before passing an event on to the delegate
public void eventOccurred(IEventData data, EventType type)
IEventListener
eventOccurred
in interface IEventListener
data
- Combines the data required for processing corresponding event type.
type
- Event type.
public Set<EventType> getSupportedEvents()
IEventListener
getSupportedEvents
in interface IEventListener
Copyright © 1998–2017 iText Group NV. All rights reserved.