Class PlaceholderBean
- java.lang.Object
-
- de.xima.fc.gui.common.bean.placeholder.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
IPlaceholderLibrarythat 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:
PlaceholderModifyLibraryEventmay be triggered to register or unregister placeholders from theIPlaceholderLibraryPlaceholderModifyActiveGroupsEventmay 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 classPlaceholderBean.PlaceholderActionsA 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 Modifier and Type Method Description static PlaceholderBean.PlaceholderActionsactions()Methods that can be used from the outside to modify the available placeholders.PlaceholderBean.PlaceholderActionsgetActions()Methods that can be used from the outside to modify the available placeholders.IPlaceholderLibrarygetLibrary()PlaceholderContextModelgetModel()List<PlaceHolder>getPlaceholders()All available placeholders, depending on the current context (i.e.List<Projekt>getProjects()ProjektgetSelectedProject()StringgetTooltip(IPlaceholder placeholder)voidload()No-op, but calling this ensures thatPostConstructgets called when this bean is created via CDI.voidregisterProvideContext(ISerializableSupplier<IPlaceholderProvideContext> provideContext)voidregisterProvider(IPlaceholderProvider listener)voidsetSelectedProject(Projekt selectedProject)voidunregisterProvideContext(ISerializableSupplier<IPlaceholderProvideContext> provideContext)voidunregisterProvider(IPlaceholderProvider listener)voidupdatePlaceholders(boolean withLoadingDialog)Action listener to update the available placeholders.voidupdatePlaceholderUiComponent()
-
-
-
Method Detail
-
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.
-
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.
-
getLibrary
public IPlaceholderLibrary getLibrary()
- Returns:
- The library with the registered placeholders.
-
getModel
public PlaceholderContextModel getModel()
- Returns:
- The placeholder model with the placeholders that are shown in the UI.
-
getPlaceholders
public List<PlaceHolder> getPlaceholders()
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
- Returns:
- All placeholders applicable for the current context
-
getProjects
public List<Projekt> getProjects()
- Returns:
- A list of projects that the user may select to change which form placeholders are displayed.
-
getSelectedProject
public Projekt getSelectedProject()
-
setSelectedProject
public void setSelectedProject(Projekt selectedProject)
-
getTooltip
public String getTooltip(IPlaceholder placeholder)
-
load
public void load()
No-op, but calling this ensures thatPostConstructgets called when this bean is created via CDI.
-
registerProvideContext
public void registerProvideContext(ISerializableSupplier<IPlaceholderProvideContext> provideContext)
-
registerProvider
public void registerProvider(IPlaceholderProvider listener)
-
unregisterProvideContext
public void unregisterProvideContext(ISerializableSupplier<IPlaceholderProvideContext> provideContext)
-
unregisterProvider
public void unregisterProvider(IPlaceholderProvider listener)
-
updatePlaceholderUiComponent
public void updatePlaceholderUiComponent()
-
updatePlaceholders
public void updatePlaceholders(boolean withLoadingDialog)
Action listener to update the available placeholders.- Parameters:
withLoadingDialog-trueto show a loading dialog,falseto perform the action in the background.
-
-