Class MessageTemplateFragment
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<JmixFormLayout>
io.jmix.flowui.fragment.Fragment<JmixFormLayout>
io.jmix.bpmflowui.view.modeler.properties.notification.MessageTemplateFragment
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,FacetOwner,FragmentOwner,Serializable
Lets the notification editor pick a reusable message template, storing only the template's code.
Referencing the Message Templates add-on's MessageTemplate, it is instantiated by the host only when
that add-on is present, keeping the host itself free of add-on types.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.fragment.Fragment
Fragment.ReadyEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UnconstrainedDataManagerprotected EntityPicker<MessageTemplate> protected JmixCheckboxFields inherited from class io.jmix.flowui.fragment.Fragment
fragmentActions, fragmentData, fragmentFacets, parentController, uiComponents -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the code of the currently selected template.booleanReturns whether the "use message template" option is on, regardless of whether a template has been picked yet.protected @Nullable MessageTemplateloadByCode(String code) protected voidvoidonTemplatePickerValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EntityPicker<MessageTemplate>, MessageTemplate> event) voidonUseTemplateCheckboxValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCheckbox, Boolean> event) voidsetTemplateCode(@Nullable String templateCode) Selects the template with the given code (checking the box and revealing the picker), or clears the selection when no code is given.voidsetTemplateCodeChangeListener(@Nullable Consumer<String> listener) Registers a listener notified whenever the selected template code changes (a code, ornullwhen no template is used).Methods inherited from class io.jmix.flowui.fragment.Fragment
addReadyListener, findInnerComponent, getFragmentActions, getFragmentData, getFragmentFacets, getInnerComponent, getParentController, initContent, onAttach, onDetach, setFragmentActions, setFragmentData, setFragmentFacets, setParentController, setUiComponentsMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface io.jmix.flowui.facet.FacetOwner
getIdMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
useTemplateCheckbox
-
templatePicker
-
dataManager
-
templateCodeChangeListener
-
-
Constructor Details
-
MessageTemplateFragment
public MessageTemplateFragment()
-
-
Method Details
-
setTemplateCode
Selects the template with the given code (checking the box and revealing the picker), or clears the selection when no code is given. Used to initialize the fragment from the edited notification.- Parameters:
templateCode- stored template code, ornull/empty when no template is used
-
setTemplateCodeChangeListener
Registers a listener notified whenever the selected template code changes (a code, ornullwhen no template is used).- Parameters:
listener- consumer of the current template code
-
isTemplateUsed
public boolean isTemplateUsed()Returns whether the "use message template" option is on, regardless of whether a template has been picked yet.- Returns:
truewhen the use-template checkbox is checked
-
getTemplateCode
Returns the code of the currently selected template.- Returns:
- the selected template code, or
nullwhen the checkbox is off or nothing is picked
-
onUseTemplateCheckboxValueChange
@Subscribe("useTemplateCheckbox") public void onUseTemplateCheckboxValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCheckbox, Boolean> event) -
onTemplatePickerValueChange
@Subscribe("templatePicker") public void onTemplatePickerValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EntityPicker<MessageTemplate>, MessageTemplate> event) -
notifyTemplateCodeChanged
protected void notifyTemplateCodeChanged() -
loadByCode
-