Package limn.backend
Interface CloseRequest
public sealed interface CloseRequest
One question to a window's
CloseRequestHandler: may this window close? Answered exactly
once, with allow() or refuse(), now or later: a handler that shows a dialog keeps
the request and answers from the dialog's result.
While a request is unanswered, the window is not asked again: a second click on its close button asks nothing new, and an application ending waits for this answer instead of asking its own question.
Only Limn implements this interface. A test asks a handler the way the user and the system
do, through the headless backend of limn-test: HeadlessWindow.userClose() for a
user's close, Backend.requestQuit() for an application ending.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidallow()Lets the window close: underCloseRequest.Reason.USER_CLOSEit does what itsClosePolicysays; underCloseRequest.Reason.APPLICATION_ENDthe next window is asked.booleanreason()voidrefuse()Keeps the window open; underCloseRequest.Reason.APPLICATION_ENDthe whole request ends and every window stays open.window()
-
Method Details
-
window
NativeWindow window()- Returns:
- the window asked
-
reason
CloseRequest.Reason reason()- Returns:
- why the window is asked
-
allow
void allow()Lets the window close: underCloseRequest.Reason.USER_CLOSEit does what itsClosePolicysays; underCloseRequest.Reason.APPLICATION_ENDthe next window is asked. UI thread only.- Throws:
IllegalStateException- if the request was already answered
-
refuse
void refuse()Keeps the window open; underCloseRequest.Reason.APPLICATION_ENDthe whole request ends and every window stays open. UI thread only.- Throws:
IllegalStateException- if the request was already answered
-
isAnswered
boolean isAnswered()
-