public class ExtensionsInvoker<A extends Action>
extends java.lang.Object
implements java.lang.Iterable<A>
Registry.useExtensions(ClientContext, ExtensionsFilter, String...)
to create an invoker object. With this object you can
iterate()
over all actions created by the extensions, or
use one of the render methods to render all actions automatically.
The renderDefault()
method uses the default render objects
registered with the extension points and/or extensions (see
ExtensionPoint.getRendererFactory()
and Extension.getRendererFactory()
).
Since the registration of rendering factories are optional, the
renderDefault()
method only works with extensions that have
done so. If an action can't be associated with a renderer, an exception
is thrown.
If there is no default rendering factory or if you want to override the default
renderer, you can use the render(Renderer)
method. This will force
the use of the specified renderer for all extensions, ignoring all renderers
set by extension points or extensions.
Modifier and Type | Field and Description |
---|---|
private boolean |
clearErrors |
private java.util.Collection<ExtensionContext<A>> |
contexts |
Constructor and Description |
---|
ExtensionsInvoker(java.util.Collection<ExtensionContext<A>> contexts)
Creates a new invoker object.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumExtensions()
Get the number of enabled extensions in this invokation.
|
ActionIterator<A> |
iterate()
Create an iterator that iterates over all
Action :s created
by the extensions. |
java.util.Iterator<A> |
iterator() |
void |
render(Renderer<A> renderer)
Render all actions using a specific renderer.
|
void |
renderDefault()
Render all actions using the renderers created by the
default renderer factories as specified by the registered
extension points and/or extensions.
|
void |
renderDefault(WrappingRenderer<A> wrapper)
Render all actions by wrapping the default renderers by the
given wrapping renderer.
|
void |
renderWithEvent(Renderer<A> renderer,
EventType event)
Render all actions using a specific renderer and send the specified event
to event handlers.
|
void |
setClearErrors(boolean clearErrors)
Set a flag to indicate if existing errors should be cleared
before an action is rendered.
|
private final java.util.Collection<ExtensionContext<A extends Action>> contexts
private boolean clearErrors
ExtensionsInvoker(java.util.Collection<ExtensionContext<A>> contexts)
public void setClearErrors(boolean clearErrors)
clearErrors
- TRUE to clear old errors, FALSE to keep thempublic int getNumExtensions()
public ActionIterator<A> iterate()
Action
:s created
by the extensions. The iterator may return zero actions if none
has been created.public void renderDefault()
public void renderDefault(WrappingRenderer<A> wrapper)
wrapper
- A wrapping renderer, or null to not wrap
the default rendererspublic void render(Renderer<A> renderer)
public void renderWithEvent(Renderer<A> renderer, EventType event)
event
- The event to send or null to not send any event