AbstractDomainEvent

Superclass for all domain events that are raised by the framework when interacting with actions, properties or collections.

The main purpose of the class is to define the protocol by which subscribers can influence an interaction (eg hide a collection, disable a property, validate action arguments).

The class also provides a simple mechanism to allow adhoc sharing of user data between different phases.

API

AbstractDomainEvent.java
class AbstractDomainEvent<S> {
  AbstractDomainEvent()     (1)
  AbstractDomainEvent(final S source)     (2)
  AbstractDomainEvent(final S source, final Identifier identifier)
  S getSource()     (3)
  void setMixedIn(final Object mixedIn)     (4)
  T getSubject()     (5)
  void setEventPhase(final Phase phase)     (6)
  void setIdentifier(final Identifier identifier)     (7)
  void hide()     (8)
  void hideIf(final boolean condition)     (9)
  void hideIf(final BooleanSupplier shouldHide)     (10)
  boolean isDisabled()
  void disable(final String reason)     (11)
  void disable(final TranslatableString reason)     (12)
  void disableIfReason(final Supplier<String> reasonSupplier)     (13)
  void disableIfTranslatableReason(final Supplier<TranslatableString> reasonSupplier)     (14)
  boolean isInvalid()
  void invalidate(final String reason)     (15)
  void invalidate(final TranslatableString reason)     (16)
  void invalidateIfReason(final Supplier<String> reasonSupplier)     (17)
  void invalidateIfTranslatableReason(final Supplier<TranslatableString> reasonSupplier)     (18)
  void veto(final String reason, final Object... args)     (19)
  void veto(final TranslatableString translatableReason)     (20)
  Object get(final Object key)     (21)
  void put(final Object key, final Object value)     (22)
  String toString()
}
1 AbstractDomainEvent()

If used then the framework will set state via (non-API) setters.

2 AbstractDomainEvent(S)

If used then the framework will set the remaining state via (non-API) setters.

3 getSource()

The domain object raising this event.

4 setMixedIn(Object)

Not API - set by the framework.

5 getSubject()

The subject of the event, which will be either the #getSource() source for a regular action, or the #getMixedIn() mixed-in domain object for a mixin.

6 setEventPhase(Phase)

Not API, set by the framework.

7 setIdentifier(Identifier)

Not API, set by the framework if the no-arg constructor is used.

8 hide()

API for subscribers to hide the member.

9 hideIf(boolean)

Same as …​ if(condition) hide();

10 hideIf(BooleanSupplier)

Same as …​ if(shouldHide.getAsBoolean()) hide();

11 disable(String)

API for subscribers to disable the member, specifying the reason why.

12 disable(TranslatableString)

API for subscribers to disable the member, specifying the reason why as a TranslatableString .

13 disableIfReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) disable(reasonSupplier.get());

14 disableIfTranslatableReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) disable(reasonSupplier.get());

15 invalidate(String)

API for subscribers to invalidate an interaction, eg invalid arguments to an action.

16 invalidate(TranslatableString)

API for subscribers to invalidate an interaction, specifying the reason as a TranslatableString .

17 invalidateIfReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());

18 invalidateIfTranslatableReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());

19 veto(String, Object)

Use instead of #hide() , #disable(String) and #invalidate(String) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .

20 veto(TranslatableString)

Use instead of #hide() , #disable(org.apache.isis.applib.services.i18n.TranslatableString) and #invalidate(org.apache.isis.applib.services.i18n.TranslatableString) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .

21 get(Object)

Obtain user-data, as set by a previous #getEventPhase() phase .

22 put(Object, Object)

Mechanism to allow subscribers to share arbitrary information between phases. One event instance is used for both the hide and disable phases, and a different event instance is shared between validate/pre-execute/post-execute. Set user-data, for the use of a subsequent #getEventPhase() phase .

Members

AbstractDomainEvent()

If used then the framework will set state via (non-API) setters.

Because the EventObjectBase superclass prohibits a null source, a dummy value is temporarily used.

AbstractDomainEvent(S)

If used then the framework will set the remaining state via (non-API) setters.

Provided to allow nested non-static implementations, for use in nested non-static mixins.

getSource()

The domain object raising this event.

For a "regular" action, property or collection then this will be the target domain object.

But for a "mixin" action, this will be an instance of the mixin itself.

setMixedIn(Object)

Not API - set by the framework.

getSubject()

The subject of the event, which will be either the #getSource() source for a regular action, or the #getMixedIn() mixed-in domain object for a mixin.

setEventPhase(Phase)

Not API, set by the framework.

setIdentifier(Identifier)

Not API, set by the framework if the no-arg constructor is used.

hide()

API for subscribers to hide the member.

hideIf(boolean)

Same as …​ if(condition) hide();

hideIf(BooleanSupplier)

Same as …​ if(shouldHide.getAsBoolean()) hide();

disable(String)

API for subscribers to disable the member, specifying the reason why.

disable(TranslatableString)

API for subscribers to disable the member, specifying the reason why as a TranslatableString .

disableIfReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) disable(reasonSupplier.get());

disableIfTranslatableReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) disable(reasonSupplier.get());

invalidate(String)

API for subscribers to invalidate an interaction, eg invalid arguments to an action.

invalidate(TranslatableString)

API for subscribers to invalidate an interaction, specifying the reason as a TranslatableString .

invalidateIfReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());

invalidateIfTranslatableReason(Supplier)

Same as …​ if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());

veto(String, Object)

Use instead of #hide() , #disable(String) and #invalidate(String) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .

If hiding, just pass null for the parameter.

veto(TranslatableString)

Use instead of #hide() , #disable(org.apache.isis.applib.services.i18n.TranslatableString) and #invalidate(org.apache.isis.applib.services.i18n.TranslatableString) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .

If hiding, just pass null for the parameter.

get(Object)

Obtain user-data, as set by a previous #getEventPhase() phase .

put(Object, Object)

Mechanism to allow subscribers to share arbitrary information between phases. One event instance is used for both the hide and disable phases, and a different event instance is shared between validate/pre-execute/post-execute. Set user-data, for the use of a subsequent #getEventPhase() phase .