Class NotificationEdit
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<ViewLayout>
io.jmix.flowui.view.View<ViewLayout>
io.jmix.flowui.view.StandardView
io.jmix.flowui.view.StandardDetailView<NotificationModel>
io.jmix.bpmflowui.view.modeler.properties.notification.NotificationEdit
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,com.vaadin.flow.router.AfterNavigationObserver,com.vaadin.flow.router.BeforeEnterObserver,com.vaadin.flow.router.BeforeLeaveObserver,com.vaadin.flow.router.HasDynamicTitle,com.vaadin.flow.router.internal.AfterNavigationHandler,com.vaadin.flow.router.internal.BeforeEnterHandler,com.vaadin.flow.router.internal.BeforeLeaveHandler,FacetOwner,FragmentOwner,ChangeTracker,DetailView<NotificationModel>,HasEditedEntity<NotificationModel>,ReadOnlyAwareView,ReadOnlyTracker,SupportEntityLock<NotificationModel>,Serializable
@ViewController("bpm_NotificationModel.edit")
@ViewDescriptor("notification-edit.xml")
@DialogMode(width="40em",
resizable=true)
public class NotificationEdit
extends StandardDetailView<NotificationModel>
Editor dialog for a single process notification declared on a user task or a service task.
The available events/recipient types depend on the owning element's kind, set once by the
caller via
setUserTaskScope(boolean) right after the dialog is built.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.view.StandardDetailView
StandardDetailView.AfterSaveEvent, StandardDetailView.BeforeSaveEvent, StandardDetailView.InitEntityEvent<E>, StandardDetailView.ValidationEventNested classes/interfaces inherited from class io.jmix.flowui.view.View
View.AfterCloseEvent, View.BeforeCloseEvent, View.BeforeShowEvent, View.InitEvent, View.PostReadyEvent, View.QueryParametersChangeEvent, View.ReadyEvent, View.RestoreComponentsStateEventNested classes/interfaces inherited from interface io.jmix.flowui.view.ReadOnlyTracker
ReadOnlyTracker.ReadOnlyChangeEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JmixTextAreaprotected com.vaadin.flow.component.orderedlayout.HorizontalLayoutprotected BpmIntegrationAddonSupportprotected static final Stringprotected static final Stringprotected JmixCheckboxGroup<String> protected static final Stringprotected JmixRadioButtonGroup<String> protected static final Stringprotected static final Stringprotected Dialogsprotected JmixComboBox<String> protected Fragmentsprotected RichTextEditorprotected Iconsprotected MessageBundleprotected com.vaadin.flow.component.orderedlayout.VerticalLayoutprotected @Nullable MessageTemplateFragmentprotected NotificationTypeProviderprotected TypedTextField<String> protected JmixComboBox<NotificationRecipientType> protected static final List<NotificationRecipientType> protected booleanprotected TypedTextField<String> protected JmixComboBox<String> protected final Map<String, NotificationTypeInfo> protected UiComponentsprotected booleanFields inherited from class io.jmix.flowui.view.StandardDetailView
DEFAULT_ROUTE_PARAM, LOCKED_BEFORE_REFRESH_ATTR_NAME, MODE_PARAM, MODE_READONLY, NEW_ENTITY_ID, READ_ONLY_BEFORE_REFRESH_ATTR_NAME, reloadSaved -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidShows the body editor matching the selected content type — a rich-text editor for HTML, a plain text area otherwise — and hides both when a message template is chosen (the body then comes from the template).protected voidprotected Stringprotected voidConfirms clearing the body when the user switches content type from HTML to plain text, since the formatted content cannot be carried over.protected Stringprotected JmixButtonprotected voidOffers only the channels that are actually available: in-app is always present, email only when the email add-on (which provides the email notification channel) is on the classpath.protected voidPopulates the channels field from the edited notification (comma-separated names), defaulting to in-app when nothing is stored.protected voidprotected voidEmbeds the message-template picker only when the Message Templates add-on is present; otherwise the box stays empty and hidden.protected voidPopulates the type lookup from the registered notification types and renders each with its icon.protected voidAttaches a question-mark help button that opens a dialog describing the variables available for substitution.voidonBeforeShow(View.BeforeShowEvent event) voidonChannelsGroupComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCheckboxGroup<String>, Set<String>> event) voidonContentTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixRadioButtonGroup<String>, String> event) voidonInit(View.InitEvent event) voidvoidonRecipientTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixComboBox<NotificationRecipientType>, NotificationRecipientType> event) protected voidonTemplateCodeChanged(@Nullable String templateCode) voidonTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.combobox.ComboBox<String>, String> event) voidonTypeFieldCustomValueSet(com.vaadin.flow.component.combobox.ComboBoxBase.CustomValueSetEvent<com.vaadin.flow.component.combobox.ComboBox<String>> event) protected com.vaadin.flow.component.ComponentrenderTypeOption(String typeName) voidsetUserTaskScope(boolean userTaskScope) Switches the editor between user-task scope (event field shown and required, the full set of recipient types available) and service-task scope (no event, only initiator/expression recipients).protected voidprotected Stringprotected voidupdateRecipientTypeHint(@Nullable NotificationRecipientType type) Explains, under the recipient-type field, where the recipients come from for the selected type, since most types resolve them from the process/task and offer no input of their own.Methods inherited from class io.jmix.flowui.view.StandardDetailView
addAfterSaveListener, addBeforeSaveListener, addInitEntityListener, addReadOnlyStateChangeListener, addValidationEventListener, beforeEnter, clearChanges, close, closeWithDiscard, closeWithSave, doNotReloadEditedEntity, findEntityId, getEditedEntity, getEditedEntityContainer, getEditedEntityLoader, getEditedEntityOrNull, getLockStatus, getRouteParamName, getSaveNotificationText, hasUnsavedChanges, initExistingEntity, initNewEntity, isCrossFieldValidationEnabled, isReadOnly, isReloadEdited, isReloadSaved, isSaveActionPerformed, isShowSaveNotification, isShowValidationErrors, onDetachInternal, preventUnsavedChanges, processBeforeEnterInternal, resolveEntityClass, save, setCrossFieldValidationEnabled, setEntityToEdit, setReadOnly, setReloadEdited, setReloadSaved, setShowSaveNotification, setShowValidationErrors, setupEntityToEdit, setupEntityToEdit, setupEntityToEdit, validateViewMethods inherited from class io.jmix.flowui.view.View
addAfterCloseListener, addApplicationListeners, addBeforeCloseListener, addBeforeShowListener, addInitListener, addQueryParametersChangeListener, addReadyListener, addRestoreComponentsStateEventListener, afterNavigation, beforeLeave, close, closeWithDefaultAction, configureDialogWindowFooter, configureDialogWindowHeader, getApplicationContext, getEventBus, getId, getPageTitle, getReturnParameters, getViewActions, getViewAttributes, getViewData, getViewFacets, getViewSupport, isPreventBrowserTabClosing, onAttach, onAttachInternal, onDetach, removeApplicationListeners, removeViewAttributes, setAfterNavigationHandler, setApplicationContext, setId, setPageTitle, setPreventBrowserTabClosing, setViewActions, setViewData, setViewFacets, unregisterBackNavigationMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, 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 com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
CHANNEL_IN_APP
- See Also:
-
CHANNEL_EMAIL
- See Also:
-
EVENTS
-
CONTENT_TYPES
-
SERVICE_TASK_RECIPIENT_TYPES
-
CONTENT_TYPE_HTML
- See Also:
-
DEFAULT_CHANNEL
- See Also:
-
DEFAULT_CONTENT_TYPE
- See Also:
-
eventField
-
subjectField
-
recipientTypeField
-
recipientExpressionField
-
channelsGroup
-
contentTypeField
-
messageTemplateBox
-
typeField
-
bodyField
-
htmlBodyField
-
bodyHeaderBox
-
messageBundle
-
notificationTypeProvider
-
icons
-
bpmIntegrationAddonSupport
-
dialogs
-
uiComponents
-
fragments
-
messageTemplateFragment
-
typeInfoByName
-
userTaskScope
protected boolean userTaskScope -
singleChannel
protected boolean singleChannel
-
-
Constructor Details
-
NotificationEdit
public NotificationEdit()
-
-
Method Details
-
setUserTaskScope
public void setUserTaskScope(boolean userTaskScope) Switches the editor between user-task scope (event field shown and required, the full set of recipient types available) and service-task scope (no event, only initiator/expression recipients). Must be called before the dialog is opened; the effect is applied when the view is shown.- Parameters:
userTaskScope-truewhen editing a notification declared on a user task
-
onInit
-
onInitEntity
-
onBeforeShow
-
initVariablesHelp
protected void initVariablesHelp()Attaches a question-mark help button that opens a dialog describing the variables available for substitution. -
createVariablesHelpButton
-
showVariablesHelp
protected void showVariablesHelp() -
initChannelsGroup
protected void initChannelsGroup()Offers only the channels that are actually available: in-app is always present, email only when the email add-on (which provides the email notification channel) is on the classpath. When a single channel is available there is nothing to choose; that is recorded insingleChanneland applied when the value is set (seeinitChannelsGroupValue()). -
initTypeField
protected void initTypeField()Populates the type lookup from the registered notification types and renders each with its icon. Hidden entirely when the Notifications add-on (hence the type provider) is absent. -
initMessageTemplate
protected void initMessageTemplate()Embeds the message-template picker only when the Message Templates add-on is present; otherwise the box stays empty and hidden. The fragment is created programmatically (not declared in XML) so that this view never references the add-on's types when the add-on is absent. -
onTemplateCodeChanged
-
initChannelsGroupValue
protected void initChannelsGroupValue()Populates the channels field from the edited notification (comma-separated names), defaulting to in-app when nothing is stored. When a single channel is available it is forced and the field is made read-only. Done here, not in onInit, because the field is unbound and its value must be derived from the already-loaded entity. -
applyScope
protected void applyScope() -
initFieldsVisibility
protected void initFieldsVisibility() -
applyBodyFieldsVisibility
protected void applyBodyFieldsVisibility()Shows the body editor matching the selected content type — a rich-text editor for HTML, a plain text area otherwise — and hides both when a message template is chosen (the body then comes from the template). -
onRecipientTypeFieldComponentValueChange
@Subscribe("recipientTypeField") public void onRecipientTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixComboBox<NotificationRecipientType>, NotificationRecipientType> event) -
updateRecipientTypeHint
Explains, under the recipient-type field, where the recipients come from for the selected type, since most types resolve them from the process/task and offer no input of their own.- Parameters:
type- selected recipient type, ornullwhen nothing is selected
-
onChannelsGroupComponentValueChange
@Subscribe("channelsGroup") public void onChannelsGroupComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixCheckboxGroup<String>, Set<String>> event) -
onContentTypeFieldComponentValueChange
@Subscribe("contentTypeField") public void onContentTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixRadioButtonGroup<String>, String> event) -
confirmBodyReset
protected void confirmBodyReset()Confirms clearing the body when the user switches content type from HTML to plain text, since the formatted content cannot be carried over. On confirmation the body is cleared and the plain editor is shown; otherwise the content type is reverted back to HTML. -
onTypeFieldCustomValueSet
@Subscribe("typeField") public void onTypeFieldCustomValueSet(com.vaadin.flow.component.combobox.ComboBoxBase.CustomValueSetEvent<com.vaadin.flow.component.combobox.ComboBox<String>> event) -
onTypeFieldComponentValueChange
@Subscribe("typeField") public void onTypeFieldComponentValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.combobox.ComboBox<String>, String> event) -
renderTypeOption
-
channelsGroupItemLabelGenerator
-
contentTypeFieldItemLabelGenerator
-
typeFieldItemLabelGenerator
-