Class AddConletRequest

All Implemented Interfaces:
Future<String>, Associator, Eligible

Sent to the console (server) if a new web console component instance of a given type should be added to the web console page.

The console server usually responds with a RenderConlet event that has as payload the HTML that displays the web console component on the console page.

Properties may be passed with the event. The interpretation of the properties is completely dependent on the web console component that handles the request. It is recommended to use Strings as keys and JDK types as values. This avoids classpath dependencies on the web console component that is to be added.

AddConletRequest can also be generated on the server side to automatically add a conlet in response to some event. Usually, the origin of the event is not important when handling the event. Nevertheless, the origin can be determined by calling isFrontendRequest() as it may be important e.g. for security related checks.

The event’s result is the web console component id of the new web console component instance.

Event Sequence

  • Constructor Details

    • AddConletRequest

      public AddConletRequest(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes)
      Creates a new event.
      Parameters:
      renderSupport - the render support
      conletType - the type of the web console component
      renderModes - the render modes
    • AddConletRequest

      public AddConletRequest(RenderSupport renderSupport, String conletType, Set<Conlet.RenderMode> renderModes, Map<?,?> properties)
      Creates a new event.
      Parameters:
      renderSupport - the render support
      conletType - the type of the web console component
      renderModes - the render modes
      properties - optional values for properties of the web console component instance
  • Method Details

    • setFrontendRequest

      Marks this event as originating from the browser.
      Returns:
      the adds the conlet request
    • isFrontendRequest

      public boolean isFrontendRequest()
      Checks if this request originated from the browser.
      Returns:
      true, if is frontend request
    • conletType

      public String conletType()
      Returns the web console component type
      Returns:
      the web console component type
    • properties

      Returns the properties.

      Every event returns a mutable map, thus allowing event handlers to modify the map even if none was passed to the constructor.

    • addProperty

      public AddConletRequest addProperty(Object key, Object value)
      Convenience method for adding properties one-by-one.
      Parameters:
      key - the property key
      value - the property value
      Returns:
      the event for easy chaining
    • ifPresent

      Convenience method that performs the given action if a property with the given key exists.
      Parameters:
      key - the property key
      action - the action to perform