Class NewBrowserWindowCommand

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

public class NewBrowserWindowCommand extends Command
Command to open a new browser window or tab.

This command instructs the client to open a new browser window with a URL. It supports window naming and parameter configuration for controlling window features and behavior.

Features:

  • Opens new browser windows or tabs
  • Configurable window parameters (size, position, features)
  • Named windows for management and reuse
  • URL encoding for safe transmission

Usage:


 // Open a URL in a new window
 NewBrowserWindowCommand win1 = new NewBrowserWindowCommand("http://example.com");

 // Open with window name
 NewBrowserWindowCommand win2 = new NewBrowserWindowCommand("http://example.com", "myWindow");

 // Open with name and parameters
 NewBrowserWindowCommand win3 = new NewBrowserWindowCommand(
     "http://example.com", "myWindow", "width=600,height=400");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • NewBrowserWindowCommand

      public NewBrowserWindowCommand(String url)
      Constructs a new NewBrowserWindowCommand to open a URL.
      Parameters:
      url - the URL to open in the new window
    • NewBrowserWindowCommand

      public NewBrowserWindowCommand(String url, String name)
      Constructs a new NewBrowserWindowCommand to open a URL with a window name.
      Parameters:
      url - the URL to open in the new window
      name - the name of the window
    • NewBrowserWindowCommand

      public NewBrowserWindowCommand(String url, String name, String params)
      Constructs a new NewBrowserWindowCommand to open a URL with a name and parameters.
      Parameters:
      url - the URL to open in the new window
      name - the name of the window
      params - the window parameters (e.g., "width=600,height=400")
  • Method Details

    • toJson

      public JsonObject toJson()
      Generates the JSON representation of this new browser window command.

      The JSON includes the command ID, URL (if URL-based), window title/name, and parameters. URLs are encoded for safe transmission.

      Specified by:
      toJson in class Command
      Returns:
      a JsonObject containing the new browser window command data