Class RemoteEvent

All Implemented Interfaces:
IPostEventProcessing

public class RemoteEvent extends BubbleEvent
A remote event is used to communicate between end-points property instances. The event can hold optional parameters in a property container that must be able to be sent over a transaction.

When this event is triggered, it will cause the event to bubble in a non-sinking way. The isRemoteInduced state can be checked by listeners. The property that is the destination of this event will not be event-notified the standard way using onEventSelf(), but rather with the onRemoteEvent(remoteEvent) method that should be overridden in the property class.

Author:
Christopher Mindus
  • Constructor Details

    • RemoteEvent

      public RemoteEvent(GProp<?> source, int localID, PropCnr params)
      Creates a new remote event (locally).
      Parameters:
      source - The source property.
      localID - The property-local event ID.
      params - Parameters for the event, null for none.
      Throws:
      IllegalArgumentException - If the localID is not between 0 and 0x3FFFFFFF.
    • RemoteEvent

      public RemoteEvent(GProp<?> source, int localID, PropCnr params, PropMgr originator)
      Creates a new remote event. This method should be used from the PropMgr instance only, if isRemote is true.
      Parameters:
      source - The source property.
      localID - The property-local event ID.
      params - The parameters or null for none.
      originator - The originator.
      Throws:
      IllegalArgumentException - If originator is not valid.
  • Method Details

    • getLocalID

      public int getLocalID()
      Gets the property-local event ID.
    • getParameters

      public PropCnr getParameters()
      Gets the property container that is used to add parameters.
      Returns:
      The parameters container, or null if not present.
    • getOriginator

      public PropMgr getOriginator()
      Gets the originator Property Manager.
      Returns:
      The instance of the Property Manager for the remote party, null when local.
    • paramString

      protected StringBuilder paramString(StringBuilder buf)
      Returns the parameter string representing the state of this event. This string is useful for debugging. Super classes adds extra information to the string by preceding it with a comma followed by the extra information.
      Overrides:
      paramString in class GEvent
      Parameters:
      buf - The StringBuilder to append the string to.
      Returns:
      The StringBuilder, i.e. the buf input parameter.
    • retarget

      public void retarget(GProp<?> newTarget)
      Re-targets this event to a new source property and sends it. This is used typically by the proxy property container to re-target an incoming remote event from the proxy container to the proxied container. The same originator is kept. The event is then notified in the target tree starting with the newTarget.
      Parameters:
      newTarget - The new target property.
    • retarget

      public void retarget(GProp<?> newTarget, PropMgr propMgr)
      Re-target this event to a Property Manager for queued sending. This is used when remote events are proxied. No originator is set, and the event is not notified in the tree.