Class LoadImageCommand

java.lang.Object
com.oorian.messaging.commands.Command
com.oorian.messaging.commands.LoadImageCommand

public class LoadImageCommand extends Command
Command to preload an image on the client side with callback notification.

This command instructs the client to load an image into the browser cache before it's needed for display. It supports a callback mechanism to notify when the image has completed loading, enabling synchronization and progress tracking.

Features:

  • Preloads images into browser cache
  • URL encoding for safe transmission
  • Callback notification on load completion
  • Supports image optimization strategies

Usage:


 // Preload an image with callback
 LoadImageCommand loadImg = new LoadImageCommand("images/photo.jpg", "imageLoadedCallback");
 JsonObject json = loadImg.toJson();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • LoadImageCommand

      public LoadImageCommand(String imageUrl, String callbackId)
      Constructs a new LoadImageCommand to preload an image with callback notification.
      Parameters:
      imageUrl - the URL of the image to preload
      callbackId - the ID of the callback to invoke when the image is loaded
  • Method Details

    • toJson

      public JsonObject toJson()
      Generates the JSON representation of this load image command.

      The JSON includes the command ID, optional callback element, and URL-encoded image source.

      Specified by:
      toJson in class Command
      Returns:
      a JsonObject containing the load image command data