Class LocaleChangeEvent
java.lang.Object
com.oorian.messaging.events.Event<LocaleChangeListener>
com.oorian.messaging.events.server.SessionEvent<LocaleChangeListener>
com.oorian.messaging.events.server.LocaleChangeEvent
Session event fired when the user's locale is changed dynamically via
LanguageSwitcher.
This event carries both the previous and new Locale, allowing listeners to
update their content, re-render UI components, adjust text direction for RTL languages,
or perform any other locale-dependent updates.
The event is dispatched to all LocaleChangeListener instances registered on
the current session. Pages that need to react to language changes should implement
LocaleChangeListener and register for this event.
Usage:
// Register for locale changes (typically in createBody)
OorianSession.get().registerListener(this, LocaleChangeEvent.class);
// Handle the event
public void onEvent(LocaleChangeEvent event)
{
Locale newLocale = event.getNewLocale();
// Re-render content with new locale...
sendUpdate();
}
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLocaleChangeEvent(Locale previousLocale, Locale newLocale) Constructs a new LocaleChangeEvent with the previous and new locales. -
Method Summary
Modifier and TypeMethodDescriptionReturns the new locale that is now active.Returns the locale that was active before the change.booleanReturns whether the locale actually changed (previous and new are different).Methods inherited from class com.oorian.messaging.events.server.SessionEvent
dispatch, dispatchTo, getId
-
Constructor Details
-
LocaleChangeEvent
Constructs a new LocaleChangeEvent with the previous and new locales.- Parameters:
previousLocale- the locale before the changenewLocale- the locale after the change
-
-
Method Details
-
getPreviousLocale
Returns the locale that was active before the change.- Returns:
- the previous locale
-
getNewLocale
Returns the new locale that is now active.- Returns:
- the new locale
-
isChanged
public boolean isChanged()Returns whether the locale actually changed (previous and new are different).- Returns:
- true if the locale changed
-