Interface PushController

All Known Implementing Classes:
AbstractPushController, CommentPushController, WorkflowPushController

public interface PushController
A push controller is one of the fundamental building blocks of Cockpit's server push mechanism. It is typically executed in its own Thread and allows actions to be performed and components to be updated asynchronously using reverse Ajax.

The push controller itself contains the logic for testing if an update is required (see isUpdateNeeded() ) and if so notifying the appropriate Cockpit components by the use of CockpitEvents (see update()).

When used with a PushComponent, it provides the means necessary to update ZK view components asynchronously.

Normally there is no need to implement a push controller from scratch and extending the abstract class AbstractPushController is usually the right way to go.

  • Method Details

    • update

      void update()
      Called whenever an update is needed i.e. when isUpdateNeeded() has returned true.

      Typically creates CockpitEvents and adds them to a special event queue by calling the PushComponent.addEvent(CockpitEvent) method on the PushComponent returned by getComponent().

      See Also:
    • isUpdateNeeded

      boolean isUpdateNeeded()
      Returns whether an update is required or not.
      Returns:
      true if an update is needed, false otherwise
      See Also:
    • setDone

      void setDone()
      Tells this push controller to stop processing server push events. Typically stops the thread gently within one polling cycle (see getUpdateInterval()).
      See Also:
    • setComponent

      void setComponent(PushComponent component)
      Sets the PushComponent to be used by this push controller to component.
      Parameters:
      component - the push component used by this push controller
      See Also:
    • getComponent

      PushComponent getComponent()
      Returns this push controller's PushComponent.
      Returns:
      the push component used by this push controller
    • setUpdateInterval

      void setUpdateInterval(int milliseconds)
      Sets the update interval in milliseconds for this push controller.
      Parameters:
      milliseconds - the delay between updates (or update requests) in milliseconds
    • getUpdateInterval

      int getUpdateInterval()
      Returns the update interval in milliseconds for this push controller.
      Returns:
      the delay between updates (or update requests) in milliseconds
    • startController

      void startController()
      Starts this push controller. Typically starts the push controller thread.
      See Also:
    • setParameters

      void setParameters(Map<String,Object> params)
    • getParameters

      Map<String,Object> getParameters()