Interface ILocalizationViewModel<E extends ILocalizationViewModelEntry>

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultLocalizationViewModel, EndUserStateLocalizationViewModel, PojoLocalizationViewModel, SourceableLocalizationViewModel

public interface ILocalizationViewModel<E extends ILocalizationViewModelEntry> extends Serializable
UI view model that lets the user edit localizable messages for potentially arbitrary languages and message keys.
Since:
8.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a new locale to the list of localizations, using the current #getNewLanguageTag(); and clears the new language tag.
    int
    Gets the index of the tab of the selected locale, i.e. the index of the tab to display.
    Gets the list of localizations, one entry for each locale.
    Gets the list of localizations, one entry for each locale.
    Gets the tag of the new language that is to be added.
    getTabTitle(E entry)
    Gets the title of the tab corresponding to the given localization entry.
    Sets the UI view locale for this view model.
    void
    Removes a locale from the list of localizations.
    void
    setActiveTabIndex(int activeTabIndex)
    Sets the index of the tab of the selected locale, i.e. the index of the tab to display.
    void
    setLocalizations(List<E> localizations)
    Sets the list of localizations, one entry for each locale.
    void
    setNewLanguageTag(String newLanguageTag)
    Sets the tag of the new language that is to be added.
    void
    setViewLocale(Locale viewLocale)
    Sets the UI view locale for this view model.
  • Method Details

    • addNewLocale

      void addNewLocale()
      Adds a new locale to the list of localizations, using the current #getNewLanguageTag(); and clears the new language tag.
    • getActiveTabIndex

      int getActiveTabIndex()
      Gets the index of the tab of the selected locale, i.e. the index of the tab to display. Must be in the range of valid indices for the list of list of localizations.
      Returns:
      The index of the active tab.
    • setActiveTabIndex

      void setActiveTabIndex(int activeTabIndex)
      Sets the index of the tab of the selected locale, i.e. the index of the tab to display. Must be in the range of valid indices for the list of list of localizations.
      Parameters:
      activeTabIndex - The index of the active tab.
    • getLocalizations

      List<E> getLocalizations()
      Gets the list of localizations, one entry for each locale.
      Returns:
      The map with the localized messages.
    • setLocalizations

      void setLocalizations(List<E> localizations)
      Sets the list of localizations, one entry for each locale.
      Parameters:
      localizations - The map with the localized messages.
    • getLocalizationsByLocale

      E getLocalizationsByLocale(Locale locale)
      Gets the list of localizations, one entry for each locale. Should create and return an empty entry if none exists for the given locale yet.
      Parameters:
      locale - The locale to get the entry for.
      Returns:
      The entry for the given locale.
    • getNewLanguageTag

      String getNewLanguageTag()
      Gets the tag of the new language that is to be added. This is not persisted, but only used in the UI.
      Returns:
      The tag of the new language.
    • setNewLanguageTag

      void setNewLanguageTag(String newLanguageTag)
      Sets the tag of the new language that is to be added. This is not persisted, but only used in the UI.
      Parameters:
      newLanguageTag - The tag of the new language.
    • getTabTitle

      String getTabTitle(E entry)
      Gets the title of the tab corresponding to the given localization entry.
      Parameters:
      entry - The entry for which to get the tab title.
      Returns:
      The tab title.
    • getViewLocale

      Locale getViewLocale()
      Sets the UI view locale for this view model. This locale is used for locale-sensitive operations, such as getting the display name of a locale.
      Returns:
      The view locale.
    • setViewLocale

      void setViewLocale(Locale viewLocale)
      Sets the UI view locale for this view model. This locale is used for locale-sensitive operations, such as getting the display name of a locale.
      Parameters:
      viewLocale - The view locale.
    • removeLocale

      void removeLocale(Locale locale)
      Removes a locale from the list of localizations.
      Parameters:
      locale - The locale to remove.