Package de.xima.fc.common.bean_models
Class SourceableLocalizationViewModel<E extends ILocalizationViewModelEntry>
- java.lang.Object
-
- de.xima.fc.common.bean_models.SourceableLocalizationViewModel<E>
-
- All Implemented Interfaces:
ILocalizationViewModel<E>
,Serializable
- Direct Known Subclasses:
PojoLocalizationViewModel
public abstract class SourceableLocalizationViewModel<E extends ILocalizationViewModelEntry> extends Object implements ILocalizationViewModel<E>
Base implementation ofILocalizationViewModel
that allows for a custom source of localization entries, but POJO implementation for the remaining view related data.- Since:
- 8.2.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SourceableLocalizationViewModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addNewLocale()
Adds a new locale to the list of localizations, using the current #getNewLanguageTag(); and clears the new language tag.int
getActiveTabIndex()
Gets the index of the tab of the selected locale, i.e.E
getLocalizationsByLocale(Locale locale)
Gets the list of localizations, one entry for each locale.String
getNewLanguageTag()
Gets the tag of the new language that is to be added.Locale
getSelectedLocale()
String
getTabTitle(E entry)
Gets the title of the tab corresponding to the given localization entry.Locale
getViewLocale()
Sets the UI view locale for this view model.protected abstract E
newEntry()
void
removeLocale(Locale locale)
Removes a locale from the list of localizations.void
setActiveTabIndex(int activeTabIndex)
Sets the index of the tab of the selected locale, i.e.void
setNewLanguageTag(String newLanguageTag)
Sets the tag of the new language that is to be added.void
setSelectedLocale(Locale selectedLocale)
void
setViewLocale(Locale viewLocale)
Sets the UI view locale for this view model.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.common.bean_models.ILocalizationViewModel
getLocalizations, setLocalizations
-
-
-
-
Method Detail
-
addNewLocale
public void addNewLocale()
Description copied from interface:ILocalizationViewModel
Adds a new locale to the list of localizations, using the current #getNewLanguageTag(); and clears the new language tag.- Specified by:
addNewLocale
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
-
getActiveTabIndex
public int getActiveTabIndex()
Description copied from interface:ILocalizationViewModel
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 oflist of localizations
.- Specified by:
getActiveTabIndex
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Returns:
- The index of the active tab.
-
setActiveTabIndex
public void setActiveTabIndex(int activeTabIndex)
Description copied from interface:ILocalizationViewModel
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 oflist of localizations
.- Specified by:
setActiveTabIndex
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
activeTabIndex
- The index of the active tab.
-
getLocalizationsByLocale
public E getLocalizationsByLocale(Locale locale)
Description copied from interface:ILocalizationViewModel
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.- Specified by:
getLocalizationsByLocale
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
locale
- The locale to get the entry for.- Returns:
- The entry for the given locale.
-
getNewLanguageTag
public String getNewLanguageTag()
Description copied from interface:ILocalizationViewModel
Gets the tag of the new language that is to be added. This is not persisted, but only used in the UI.- Specified by:
getNewLanguageTag
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Returns:
- The tag of the new language.
-
setNewLanguageTag
public void setNewLanguageTag(String newLanguageTag)
Description copied from interface:ILocalizationViewModel
Sets the tag of the new language that is to be added. This is not persisted, but only used in the UI.- Specified by:
setNewLanguageTag
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
newLanguageTag
- The tag of the new language.
-
getSelectedLocale
public Locale getSelectedLocale()
-
setSelectedLocale
public void setSelectedLocale(Locale selectedLocale)
-
getTabTitle
public String getTabTitle(E entry)
Description copied from interface:ILocalizationViewModel
Gets the title of the tab corresponding to the given localization entry.- Specified by:
getTabTitle
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
entry
- The entry for which to get the tab title.- Returns:
- The tab title.
-
getViewLocale
public Locale getViewLocale()
Description copied from interface:ILocalizationViewModel
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.- Specified by:
getViewLocale
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Returns:
- The view locale.
-
setViewLocale
public void setViewLocale(Locale viewLocale)
Description copied from interface:ILocalizationViewModel
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.- Specified by:
setViewLocale
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
viewLocale
- The view locale.
-
removeLocale
public void removeLocale(Locale locale)
Description copied from interface:ILocalizationViewModel
Removes a locale from the list of localizations.- Specified by:
removeLocale
in interfaceILocalizationViewModel<E extends ILocalizationViewModelEntry>
- Parameters:
locale
- The locale to remove.
-
newEntry
protected abstract E newEntry()
-
-