|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface HeadlessViewer
Provides the ability to obtain a "view" of a domain object such that it can be interacted with as if through a viewer.
The "view" is a CGLib proxy that wraps the underlying domain object. The view can then be interacted with as follows:
Calling any of the above methods may result in a (subclass of) InteractionException if the
object disallows it. For example, if a property is annotated with Hidden then a
HiddenException will be thrown. Similarly if an action has a validate method and the
supplied arguments are invalid then a InvalidException will be thrown.
In addition, the following methods may also be called:
An exception will be thrown if any other methods are thrown.
| Nested Class Summary | |
|---|---|
static class |
HeadlessViewer.ExecutionMode
Whether interactions with the view are actually passed onto the underlying domain object. |
| Method Summary | ||
|---|---|---|
boolean |
addInteractionListener(InteractionListener listener)
Registers an InteractionListener, to be notified of interactions on all views. |
|
java.util.List<InteractionListener> |
getListeners()
All InteractionListeners that have been registered using addInteractionListener(InteractionListener). |
|
|
isView(T possibleView)
Whether the supplied object has been viewed. |
|
void |
notifyListeners(InteractionEvent ev)
|
|
boolean |
removeInteractionListener(InteractionListener listener)
Remove an InteractionListener, to no longer be notified of interactions on views. |
|
|
view(T domainObject)
Provides the "view" of the underlying domain object. |
|
|
view(T domainObject,
HeadlessViewer.ExecutionMode mode)
Same as view(Object), except the actual execution occurs only if the execute
parameter indicates. |
|
| Method Detail |
|---|
<T> T view(T domainObject)
If the object has (see isView(Object) already been viewed), then should just return the
object back unchanged.
addInteractionListener(InteractionListener)
<T> T view(T domainObject,
HeadlessViewer.ExecutionMode mode)
view(Object), except the actual execution occurs only if the execute
parameter indicates.
Otherwise, will do all the validations (raise exceptions as required etc.), but doesn't modify the model.
<T> boolean isView(T possibleView)
T - possibleView - -
object that might or might not be a view.
java.util.List<InteractionListener> getListeners()
InteractionListeners that have been registered using addInteractionListener(InteractionListener).
boolean addInteractionListener(InteractionListener listener)
InteractionListener, to be notified of interactions on all views.
This is retrospective: the listener will be notified of interactions even on views created before the listener was installed. (From an implementation perspective this is because the views delegate back to the container to fire the events).
listener -
boolean removeInteractionListener(InteractionListener listener)
InteractionListener, to no longer be notified of interactions on views.
This is retrospective: the listener will no longer be notified of any interactions created on any views, not just on those views created subsequently. (From an implementation perspective this is because the views delegate back to the container to fire the events).
listener -
void notifyListeners(InteractionEvent ev)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||