Hi,
I want to do a check before a frame is closed, so that for unsaved content,
I can veto the closing.
and here is my code:
......
private Vote vote = Vote.APPROVE;
@Override
public void initialize(Map<String, Object> namespace, URL location,
Resources resources) {
this.getWindowStateListeners().add(new
WindowStateListener.Adapter() {
@Override
public Vote previewWindowClose(Window window) {
if (Compose.this.isEdited()) {
closeConfirmPrompt.open(window, new
SheetCloseListener() {
@Override
public void sheetClosed(Sheet
sheet) {
if
(closeConfirmPrompt.getResult()
&&
closeConfirmPrompt
.getSelectedOptionIndex() == 1) {
vote =
Vote.APPROVE;
} else
vote =
Vote.DENY;
}
});
return vote;
} else
return Vote.APPROVE;
}
});
However, the result is the window is closed before the prompt show up.
why prompt is bypassed ?
Brendan
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/How-to-use-windowStateListener-tp3853550p3853550.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.