Class OpenModalEvent

java.lang.Object
no.ntnu.principes.event.PrincipesEvent<OpenModalEvent.ModalPayload>
no.ntnu.principes.event.navigation.OpenModalEvent

public class OpenModalEvent extends PrincipesEvent<OpenModalEvent.ModalPayload>
Represents an event for opening a modal within the application. This event encapsulates the callback identifier and payload information required to display a modal with specific parameters.

The payload contains details like the target route or identifier and optional parameters that provide additional context for the modal.

  • Constructor Details

    • OpenModalEvent

      public OpenModalEvent(String callbackId, OpenModalEvent.ModalPayload payload)
      Constructs a new OpenModalEvent with a unique callback identifier and payload containing modal configuration details.
      Parameters:
      callbackId - a unique string used to identify the modal's callback operation. This ID triggers specific post-modal actions upon modal closure.
      payload - encapsulates the modal target route and additional parameters required to configure the modal display and behavior.
  • Method Details

    • of

      public static OpenModalEvent of(String path, String callBackId)
      Creates a new instance of OpenModalEvent with the specified path and callback identifier.
      Parameters:
      path - the target route or identifier of the modal to be opened.
      callBackId - the callback identifier associated with the modal event.
      Returns:
      a new OpenModalEvent with the specified path and callback identifier.
    • of

      public static OpenModalEvent of(String path, String callBackId, Map<String,Object> params)
      Creates a new OpenModalEvent with the specified callback identifier and payload. The payload includes the target path for the modal and any additional parameters.
      Parameters:
      path - the target path or route identifier for the modal
      callBackId - the unique callback identifier associated with the modal event
      params - a map of key-value pairs representing additional parameters for the modal (can be empty)
      Returns:
      a new OpenModalEvent containing the specified callback identifier and payload