Module io.github.mmm.ui.api.window
Interface UiPopupNotifier
- All Superinterfaces:
UiNotifier
- All Known Implementing Classes:
AbstractUiNotifier
Interface to notify via popup or growl.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptioncreatePopup
(UiNotification notification, UiAction... actions) This method creates apopup window
with the givenmessage
.default UiPopup
createPopupOk
(UiNotification notification) This method creates apopup window
with the givenmessage
.default UiPopup
createPopupOk
(UiNotification notification, UiActionOk action) This method creates apopup window
with the givenmessage
.default UiPopup
createPopupYesNo
(UiNotification notification, Consumer<Boolean> callback) This method creates apopup window
with the givenUiNotification
and two buttons for the optionsyes
andno
.static UiPopupNotifier
get()
default void
showPopup
(UiNotification notification, UiAction... actions) default void
showPopupOk
(UiNotification notification) default void
showPopupOk
(UiNotification notification, UiActionOk action) default void
showPopupYesNo
(UiNotification notification, Consumer<Boolean> callback) Methods inherited from interface io.github.mmm.ui.api.notify.UiNotifier
event, show, show, showInfo
-
Method Details
-
createPopup
This method creates apopup window
with the givenmessage
. It is the most generic and flexible but also the most inconvenientshowPopup
method variant.- Parameters:
notification
- theUiNotification
to show.actions
- are theUiAction
s for the buttons to close (answer, confirm, or cancel) the popup. Has to be at least oneUiAction
.- Returns:
- the
UiPopup
.
-
createPopupOk
This method creates apopup window
with the givenmessage
. It is the most generic and flexible but also the most inconvenientshowPopup
method variant.- Parameters:
notification
- theUiNotification
to show.- Returns:
- the
UiPopup
.
-
createPopupOk
This method creates apopup window
with the givenmessage
. It is the most generic and flexible but also the most inconvenientshowPopup
method variant.- Parameters:
notification
- theUiNotification
to show.action
- the optionalUiActionOk
to invoke when OK is pressed and the popup is closed.- Returns:
- the
UiPopup
.
-
createPopupYesNo
This method creates apopup window
with the givenUiNotification
and two buttons for the optionsyes
andno
.
ATTENTION:
This is a very convenient but also very often misused feature of UI toolkits or frameworks. A suitable example is e.g. to use this with the message "Do you really want to delete this object?". However, it would still be more explicit to have the buttons labeled with "Delete" and "Cancel" usingcreatePopup(UiNotification, UiAction...)
. A famous example for a misuse of this method would be the question "Do you want to delete this occurrence or the series of the appointment? Press 'Yes' to delete the series and 'No' for this occurrence.". From this bad example that confuses the user, you should learn that it is always better to use more explicit button labels.- Parameters:
notification
- theUiNotification
to show. Should haveUiSeverity.QUESTION
.callback
- is theConsumer
invoked after the popup has been confirmed.Consumer.accept(Object)
will receiveBoolean.TRUE
if the user clicked "Yes" andBoolean.FALSE
for "No".- Returns:
- the
UiPopup
.
-
showPopup
- Specified by:
showPopup
in interfaceUiNotifier
-
showPopupOk
- Specified by:
showPopupOk
in interfaceUiNotifier
-
showPopupOk
- Specified by:
showPopupOk
in interfaceUiNotifier
-
showPopupYesNo
- Specified by:
showPopupYesNo
in interfaceUiNotifier
-
getHistory
Iterable<UiNotification> getHistory()- Specified by:
getHistory
in interfaceUiNotifier
- Returns:
- the history of the notifications collected by this
UiNotifier
. It may be only a queue with the last N number ofUiNotification
s to avoid memory leaks.
-
get
- Returns:
- the singleton instance of this
UiNotifier
.
-