Class InputCompleteEvent


public class InputCompleteEvent extends InputEvent
Event fired when input to an element is completed.

This event is triggered when a user finishes editing an input control, typically when the element loses focus (blur event) or when the user presses Enter in a text field. Unlike InputChangeEvent which fires continuously during input, InputCompleteEvent fires once when the input operation is complete, making it ideal for final validation, data persistence, and processing submitted values.

Features:

  • Indicates when input editing is complete
  • Provides the final value after all changes
  • Triggers on blur or explicit completion actions (e.g., Enter key)
  • Ideal for final validation and data persistence

Usage: Handle this event through an InputListener to respond when users complete their input. Common use cases include validating final values, saving data to the server, updating aggregated calculations, and triggering workflow actions.


 public class FormFieldValidator implements InputListener {
     @Override
     public void onEvent(InputChangeEvent event) {
         // Handle ongoing input changes
     }

     @Override
     public void onEvent(InputCompleteEvent event) {
         String finalValue = event.getValue();
         // Perform final validation
         if (!isValidEmail(finalValue)) {
             showError("Please enter a valid email address");
         } else {
             // Save to database
             saveUserEmail(finalValue);
         }
     }
 }
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • InputCompleteEvent

      public InputCompleteEvent()
      Constructs a new InputCompleteEvent with no initial value.

      This default constructor creates an empty event. The value can be set later if needed.

    • InputCompleteEvent

      public InputCompleteEvent(String value)
      Constructs a new InputCompleteEvent with the specified final value.

      This constructor creates an event with the final value of the input element after the user completed their input operation.

      Parameters:
      value - the final value of the input element
  • Method Details

    • getValue

      public String getValue()
      Returns the final value of the input element.

      This is the value after the user completed their input operation, typically when the field loses focus or the user presses Enter.

      Returns:
      the final input value, or null if not set
    • dispatchTo

      public void dispatchTo(InputListener listener)
      Dispatches this event to the specified listener.

      This method implements the visitor pattern to deliver the event to the appropriate handler method on the InputListener. It calls the listener's onEvent(InputCompleteEvent) method.

      Specified by:
      dispatchTo in class Event<InputListener>
      Parameters:
      listener - the InputListener that will handle this event