Package de.xima.fc.gui.bean.portal
Class UserPortalConfigBean
- java.lang.Object
-
- de.xima.fc.gui.bean.portal.UserPortalConfigBean
-
- All Implemented Interfaces:
IStateHolder
,Serializable
@Named @ViewScoped public class UserPortalConfigBean extends Object implements Serializable, IStateHolder
Configuration of a single selected user portal via different tabs.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserPortalConfigBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
completeLanguageTag(String query)
When the user triggers an autocomplete for a language tag input.void
discardChanges()
Discards the changes.List<String>
getCustomPortalFileKeys()
A list of custom file keys that can be configured on the advanced tab of a user portal.List<String>
getCustomPortalMessageKeys()
A list of custom message keys that can be configured on the advanced tab of a user portal.Map<String,String>
getDefaultPortalFileTextContent()
Map<String,String>
getDefaultProjectFileTextContent()
List<FrontendServer>
getFsToReconnect()
UserPortalViewModel
getModel()
Gets the view model for editing the selected user portal.Map<String,String>
getPortalFileTextContent()
Map<String,String>
getProjectFileTextContent()
Locale
getRequestedDefaultLocale()
Gets the requested default locale for the user portal configuration.Locale
getRequestedLocale()
Gets the requested locale for the user portal configuration.void
newUserPortal()
Creates a new user portal and prepares it for editing.void
onAddCustomPortalFileKeyClicked()
void
onAddCustomPortalMessageKeyClicked()
void
onAddNewTagClicked()
When the user clicks the "Add" button to create a new tag, this method will be called.void
onAfterPortalDeleted()
Called when a portal deleted.void
onDefaultLocaleChanged()
When the default locale of the portal was changed, usually when the user selected a different locale in the backend UI.void
onDeleteTagClicked(UserPortalProjectTagViewModel tag)
Called when the user clicks the "Delete" button for a tag.void
onEditAuthClicked(UserPortalAuthenticatorViewModel config)
Called when the user clicks the "Edit" button for a login server configuration.void
onEditTagClicked(UserPortalProjectTagViewModel tag)
Called when the user clicks the "Edit" button for a tag.void
onFileDeleted(String type, String fileKey)
Called when the user click on the button to delete an existing file.void
onFileUploaded(org.primefaces.event.FileUploadEvent event)
Called when the user uploads a file in the backend UI.void
onLocaleAdded()
When the user added a new locale, such as by clicking on the add button in the language selector.void
onLocaleChanged(String languageTag)
Called when the user changes the locale in the UI.void
onLocaleDeleted(String languageTag)
When the user deleted an available locale, such as by clicking on the delete button in the language selector.void
onProjectSelected()
Called when the user selects a project from the project list.void
onRemoveCustomPortalFileKeyClicked(String key)
void
onRemoveCustomPortalMessageKeyClicked(String key)
void
onReorderInputAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered input login services via the UI.void
onReorderRedirectAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered redirect login services via the UI.void
reconnectFrontendServers()
String
resolveTagBackgroundColor(UserPortalProjectTagViewModel tag)
Resolves the color for the background of a given tag, used to display the tag on the UI.String
resolveTagDisplayName(UserPortalProjectTagViewModel tag)
Resolves the display name for the given tag, used to display the tag on the UI.String
resolveTagTextColor(UserPortalProjectTagViewModel tag)
Resolves the text color for the background of a given tag, used to display the tag on the UI.void
saveChanges()
Saves the changes.void
setFirstPortalFromList(List<UserPortal> portals)
Selects the first portal from the given list of portals.void
setFsToReconnect(List<FrontendServer> fsToReconnect)
void
setRequestedDefaultLocale(Locale requestedDefaultLocale)
Gets the requested default locale for the user portal configuration.void
setRequestedLocale(Locale requestedLocale)
Sets the requested locale for the user portal configuration.
-
-
-
Method Detail
-
getCustomPortalFileKeys
public List<String> getCustomPortalFileKeys()
A list of custom file keys that can be configured on the advanced tab of a user portal.- Returns:
- List of custom file keys.
-
getCustomPortalMessageKeys
public List<String> getCustomPortalMessageKeys()
A list of custom message keys that can be configured on the advanced tab of a user portal.- Returns:
- List of custom message keys.
-
getModel
public UserPortalViewModel getModel()
Gets the view model for editing the selected user portal.- Returns:
- View model for the selected user portal.
-
getRequestedDefaultLocale
public Locale getRequestedDefaultLocale()
Gets the requested default locale for the user portal configuration. The view should just useUserPortalViewModel.getDefaultLocale()
()}, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Returns:
- Requested default locale for the user portal configuration.
-
setRequestedDefaultLocale
public void setRequestedDefaultLocale(Locale requestedDefaultLocale)
Gets the requested default locale for the user portal configuration. The view should just useUserPortalViewModel.getDefaultLocale()
()}, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Parameters:
requestedDefaultLocale
- Requested default locale for the user portal configuration.
-
getRequestedLocale
public Locale getRequestedLocale()
Gets the requested locale for the user portal configuration. The view should just useUserPortalViewModel.getSelectedLocale()
, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Returns:
- Requested locale for the user portal configuration.
-
setRequestedLocale
public void setRequestedLocale(Locale requestedLocale)
Sets the requested locale for the user portal configuration. The view should just useUserPortalViewModel.getSelectedLocale()
, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Parameters:
requestedLocale
- Requested locale for the user portal configuration.
-
getFsToReconnect
public List<FrontendServer> getFsToReconnect()
-
setFsToReconnect
public void setFsToReconnect(List<FrontendServer> fsToReconnect)
-
setFirstPortalFromList
public void setFirstPortalFromList(List<UserPortal> portals)
Selects the first portal from the given list of portals.- Parameters:
portals
- List of portals to select from.
-
completeLanguageTag
public List<String> completeLanguageTag(String query)
When the user triggers an autocomplete for a language tag input. Searches the well-known locales for a match, either by language tag or by display name.- Parameters:
query
- The query to complete.- Returns:
- List of language tags that match the query.
-
discardChanges
public void discardChanges()
Description copied from interface:IStateHolder
Discards the changes.- Specified by:
discardChanges
in interfaceIStateHolder
-
newUserPortal
public void newUserPortal()
Creates a new user portal and prepares it for editing.
-
onAddCustomPortalFileKeyClicked
public void onAddCustomPortalFileKeyClicked()
-
onAddCustomPortalMessageKeyClicked
public void onAddCustomPortalMessageKeyClicked()
-
onAddNewTagClicked
public void onAddNewTagClicked()
When the user clicks the "Add" button to create a new tag, this method will be called. It will create a new tag with the given name and add it to the list of tags.
-
onAfterPortalDeleted
public void onAfterPortalDeleted()
Called when a portal deleted. Checks if the currently edited portal still exists. If not, finds a new portal to edit and loads its configuration.
-
onDefaultLocaleChanged
public void onDefaultLocaleChanged()
When the default locale of the portal was changed, usually when the user selected a different locale in the backend UI.
-
onDeleteTagClicked
public void onDeleteTagClicked(UserPortalProjectTagViewModel tag)
Called when the user clicks the "Delete" button for a tag. Removes the tag from the list of tags.- Parameters:
tag
- Tag to delete.
-
onEditAuthClicked
public void onEditAuthClicked(UserPortalAuthenticatorViewModel config)
Called when the user clicks the "Edit" button for a login server configuration. Prepares the model so that it can be edited.- Parameters:
config
- Login service configuration to edit.
-
onEditTagClicked
public void onEditTagClicked(UserPortalProjectTagViewModel tag)
Called when the user clicks the "Edit" button for a tag. Prepares the model so that the tag can be edited.- Parameters:
tag
- Tag to edit.
-
onFileDeleted
public void onFileDeleted(String type, String fileKey)
Called when the user click on the button to delete an existing file.- Parameters:
type
- The type of the file (project or portal)fileKey
- The key of the file to delete.
-
onFileUploaded
public void onFileUploaded(org.primefaces.event.FileUploadEvent event)
Called when the user uploads a file in the backend UI.- Parameters:
event
- File upload event with the file.
-
onLocaleAdded
public void onLocaleAdded()
When the user added a new locale, such as by clicking on the add button in the language selector. Adds the locale to the list of available locales, selects the new locale, and updates the model so that the new locale can be edited.
-
onLocaleChanged
public void onLocaleChanged(String languageTag)
Called when the user changes the locale in the UI. This will prepare the view model so that the data for that locale can be edited.
-
onLocaleDeleted
public void onLocaleDeleted(String languageTag)
When the user deleted an available locale, such as by clicking on the delete button in the language selector. Removes the locale from the list of available locales, and, if the deleted locale was the currently selected locale, changes the locale to the default locale and updates the model.- Parameters:
languageTag
- The language tag of the deleted locale.
-
onProjectSelected
public void onProjectSelected()
Called when the user selects a project from the project list. This will prepare the project for editing.
-
onRemoveCustomPortalFileKeyClicked
public void onRemoveCustomPortalFileKeyClicked(String key)
-
onRemoveCustomPortalMessageKeyClicked
public void onRemoveCustomPortalMessageKeyClicked(String key)
-
onReorderInputAuthenticators
public void onReorderInputAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered input login services via the UI. Updates the model with the new order.- Parameters:
event
- Reorder event with the new order.
-
onReorderRedirectAuthenticators
public void onReorderRedirectAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered redirect login services via the UI. Updates the model with the new order.- Parameters:
event
- Reorder event with the new order.
-
resolveTagBackgroundColor
public String resolveTagBackgroundColor(UserPortalProjectTagViewModel tag)
Resolves the color for the background of a given tag, used to display the tag on the UI. Uses the configured color first, falling back to the default color.- Parameters:
tag
- Tag to resolve the background color for.- Returns:
- Background color for the tag.
-
resolveTagDisplayName
public String resolveTagDisplayName(UserPortalProjectTagViewModel tag)
Resolves the display name for the given tag, used to display the tag on the UI. Uses the current language first, falling back to the default language. When no display name is found, the tag's ID is used.- Parameters:
tag
- Tag to resolve the display name for.- Returns:
- Display name for the tag.
-
resolveTagTextColor
public String resolveTagTextColor(UserPortalProjectTagViewModel tag)
Resolves the text color for the background of a given tag, used to display the tag on the UI. Uses the configured color, falling back to the default color.- Parameters:
tag
- Tag to resolve the background color for.- Returns:
- Background color for the tag.
-
saveChanges
public void saveChanges()
Description copied from interface:IStateHolder
Saves the changes.- Specified by:
saveChanges
in interfaceIStateHolder
-
reconnectFrontendServers
public void reconnectFrontendServers()
-
-