Module io.github.mmm.ui.api.window
Interface UiPopupNotifier
-
- All Superinterfaces:
UiNotifier
- All Known Implementing Classes:
AbstractUiNotifier
public interface UiPopupNotifier extends UiNotifier
Interface to notify via popup or growl.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description UiPopup
createPopup(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()
Iterable<UiNotification>
getHistory()
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 Detail
-
createPopup
UiPopup createPopup(UiNotification notification, UiAction... actions)
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
default UiPopup createPopupOk(UiNotification notification)
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
default UiPopup createPopupOk(UiNotification notification, UiActionOk action)
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
default UiPopup createPopupYesNo(UiNotification notification, Consumer<Boolean> callback)
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
default void showPopup(UiNotification notification, UiAction... actions)
- Specified by:
showPopup
in interfaceUiNotifier
-
showPopupOk
default void showPopupOk(UiNotification notification)
- Specified by:
showPopupOk
in interfaceUiNotifier
-
showPopupOk
default void showPopupOk(UiNotification notification, UiActionOk action)
- Specified by:
showPopupOk
in interfaceUiNotifier
-
showPopupYesNo
default void showPopupYesNo(UiNotification notification, Consumer<Boolean> callback)
- 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
static UiPopupNotifier get()
- Returns:
- the singleton instance of this
UiNotifier
.
-
-