Class UpdateConletModel

java.lang.Object
org.jgrapes.core.internal.EventBase<T>
org.jgrapes.core.Event<Void>
org.jgrapes.webconsole.base.events.UpdateConletModel
All Implemented Interfaces:
Future<Void>, Associator, Eligible

public class UpdateConletModel extends Event<Void>
Sent to a web console component to update some of its properties.

The interpretation of the properties is completely dependent on the handling web console component.

This event has a close relationship to the NotifyConletModel event. The latter is used by web console component’s functions to send information from the console page to the web console component model. It passes the information as a JsonArray. The interpretation of this information is only known by the web console component. The UpdateConletModel event should be used to to pass information within the application, i.e. on the server side.

Depending on the information passed, it may be good practice to write an event handler for the web console component that converts a NotifyConletModel to a UpdateConletModel that is fired on its channel instead of handling it immediately. This allows events sent from the console page and from other components in the application to be handled in a uniform way.

  • Constructor Details

    • UpdateConletModel

      public UpdateConletModel(String conletId, Map<?,?> properties)
      Creates a new event.
      Parameters:
      conletId - the id of the web console component
      properties - the properties to update
    • UpdateConletModel

      public UpdateConletModel(String conletId)
      Creates a new event.

      This constructor creates an empty map of properties and is therefore intended to be used together with addPreference(Object, Object).

      Parameters:
      conletId - the web console component id
  • Method Details

    • conletId

      public String conletId()
      Returns the web console component id.
      Returns:
      the web console component id
    • 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.

    • addPreference

      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