Class SelectTextCommand

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

public class SelectTextCommand extends Command
Command to select all text within a text input or textarea element.

This command programmatically selects all the text content within the specified input element, similar to when a user triple-clicks or uses Ctrl+A. This is useful for improving user experience by pre-selecting text for copying or replacement.

Features:

  • Selects all text in input elements
  • Targets text inputs and textareas by ID
  • Improves user experience for form interactions
  • Enables programmatic text selection workflows

Usage:


 // Select all text in an input field
 SelectTextCommand select = new SelectTextCommand("usernameInput");
 JsonObject json = select.toJson();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • SelectTextCommand

      public SelectTextCommand(String elementId)
      Constructs a new SelectTextCommand to select all text in the specified element.
      Parameters:
      elementId - the ID of the text input or textarea element
  • Method Details

    • toJson

      public JsonObject toJson()
      Generates the JSON representation of this select text command.

      The JSON includes the command ID and target element ID.

      Specified by:
      toJson in class Command
      Returns:
      a JsonObject containing the select text command attributes