Package de.xima.fc.gui.bean.application
Class PlaceholderBean
- java.lang.Object
-
- de.xima.fc.gui.bean.application.PlaceholderBean
-
- All Implemented Interfaces:
Serializable
@Named @ViewScoped public class PlaceholderBean extends Object implements Serializable
This bean provides a list of available placeholders for an input field. Different placeholders may be available, depending on the current context. For example, when the user is editing a project, placeholders for form elements of that project are available.Each placeholder belongs to a
IPlaceholderType
. In the dialog, placeholders are grouped according to this type.To control which placeholders are available, there exists:
- a
IPlaceholderLibrary
that contains the registered placeholders. It contains several groups and a set of placeholders for that group. A group is just anyObject
, eg. SYSTEM placeholders, FORM placeholders or custom placeholders. This lets you change the placeholders for a certain group without affecting other groups. - a set of groups which are currently active. Only the placeholders for those groups are shown in the dialog. This makes it possible to deactivate a group of placeholders and activate it again later without having to recreate the placeholders.
There are also a few events available that can be triggered from another bean to update the placeholders:
PlaceholderModifyLibraryEvent
may be triggered to register or unregister placeholders from theIPlaceholderLibrary
PlaceholderModifyActiveGroupsEvent
may be triggered to add or remove currently active groups
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PlaceholderBean.PlaceholderActions
A set of methods for modifying the available placeholders, such as changing which placeholders groups are shown or adding new placeholder groups.
-
Constructor Summary
Constructors Constructor Description PlaceholderBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static PlaceholderBean.PlaceholderActions
actions()
Methods that can be used from the outside to modify the available placeholders.int
comparePlaceholderType(IPlaceholderType lhs, IPlaceholderType rhs)
Compares two given placeholder types.List<PlaceHolder>
createPlaceholdersForCurrentContext()
All available placeholders, depending on the current context (i.e.PlaceholderBean.PlaceholderActions
getActions()
Methods that can be used from the outside to modify the available placeholders.Mandant
getClient()
Deprecated.UseViewContextBean.getClient()
directly.PlaceholderLibrary
getLibrary()
Locale
getLocale()
Deprecated.UseLocaleBean.getLocale()
directly.PlaceholderContextModel
getModel()
Collection<Projekt>
getProjects()
void
load()
No-op, but calling this ensures thatPostConstruct
gets called when this bean is created via CDI.void
updatePlaceholders(boolean withLoadingDialog)
Action listener to update the available placeholders.
-
-
-
Method Detail
-
comparePlaceholderType
public int comparePlaceholderType(IPlaceholderType lhs, IPlaceholderType rhs)
Compares two given placeholder types.- Parameters:
lhs
- First placeholder typerhs
- Second placeholder type- Returns:
- -1 if lhs < rhs, 1 if lhs > rhs, 0 if lhs == rhs.
-
createPlaceholdersForCurrentContext
public List<PlaceHolder> createPlaceholdersForCurrentContext()
All available placeholders, depending on the current context (i.e. whether the user is editing a project etc.). This includes, but is not limited to:- System placeholders
- Template placeholders (HTML, TEXT, URL, MAIL)
- Form element placeholders for a certain project
- Placeholders from the currently active designer tab (e.g. workflow action results)
- Returns:
- All placeholders applicable for the current context
-
getActions
public PlaceholderBean.PlaceholderActions getActions()
Methods that can be used from the outside to modify the available placeholders. All other methods of this bean should not be called directly and are for internal use by the placeholder view only.- Returns:
- A set of methods for modifying the available placeholders, such as changing which placeholders groups are shown or adding new placeholder groups.
-
getClient
@Deprecated public Mandant getClient()
Deprecated.UseViewContextBean.getClient()
directly.- Returns:
- The current client.
-
getLibrary
public PlaceholderLibrary getLibrary()
- Returns:
- The library with the registered placeholders.
-
getLocale
@Deprecated public Locale getLocale()
Deprecated.UseLocaleBean.getLocale()
directly.- Returns:
- The current locale.
-
getModel
public PlaceholderContextModel getModel()
- Returns:
- The placeholder model with the placeholders that are shown in the UI.
-
getProjects
public Collection<Projekt> getProjects()
- Returns:
- A list of projects that the user may select to change which form placeholders are displayed.
-
load
public void load()
No-op, but calling this ensures thatPostConstruct
gets called when this bean is created via CDI.
-
updatePlaceholders
public void updatePlaceholders(boolean withLoadingDialog)
Action listener to update the available placeholders.- Parameters:
withLoadingDialog
-true
to show a loading dialog,false
to perform the action in the background.
-
actions
public static PlaceholderBean.PlaceholderActions actions()
Methods that can be used from the outside to modify the available placeholders. All other methods of this bean should not be called directly and are for internal use by the placeholder view only.- Returns:
- A set of methods for modifying the available placeholders, such as changing which placeholders groups are shown or adding new placeholder groups.
-
-