Class FocusInEvent
java.lang.Object
com.oorian.messaging.events.Event<FocusListener>
com.oorian.messaging.events.client.ClientEvent<FocusListener>
com.oorian.messaging.events.client.FocusEvent
com.oorian.messaging.events.client.FocusInEvent
Event fired when an HTML element receives keyboard focus.
This event is triggered when a user focuses on an interactive element such as a text input field, button, or link, either by clicking on it or navigating to it via keyboard (typically using the Tab key). Focus-in events are essential for implementing field validation, highlighting active controls, and managing user interaction flow.
Features:
- Indicates when an element gains keyboard focus
- Provides access to the focused element through getSource()
- Dispatches to FocusListener implementations
- Supports focus-based UI feedback and validation
Usage: Handle this event through a FocusListener to respond when elements receive focus. Common use cases include highlighting the active field, displaying help text, or preparing validation logic.
public class FormFieldHandler implements FocusListener {
@Override
public void onEvent(FocusInEvent event) {
Element field = event.getSource();
field.addStyleClass("focused");
// Show field-specific help text
showHelpText(field.getId());
}
@Override
public void onEvent(FocusOutEvent event) {
// Handle focus out
}
}
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatchTo(FocusListener listener) Dispatches this event to the specified listener.Methods inherited from class com.oorian.messaging.events.client.ClientEvent
getSource, getTarget, setSource, setTarget
-
Constructor Details
-
FocusInEvent
public FocusInEvent()
-
-
Method Details
-
dispatchTo
Dispatches this event to the specified listener.This method implements the visitor pattern to deliver the event to the appropriate handler method on the FocusListener. It calls the listener's onEvent(FocusInEvent) method.
- Specified by:
dispatchToin classEvent<FocusListener>- Parameters:
listener- the FocusListener that will handle this event
-