Added onWindowClosingHandler to alert users who didn't commit changes

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@128566 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-05-12 10:31:56 +00:00
parent 209a86a4e6
commit 01a9f8277a
1 changed files with 14 additions and 4 deletions

View File

@ -277,6 +277,16 @@ public class ShareUpdateForm extends Composite {
}
}
});
// add onWindowClosing handler to alert the user who didn't share post if really wants to leave
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
String currentText = shareTextArea.getText();
if(!currentText.isEmpty()){
closingEvent.setMessage("Do you really want to leave the page?");
}
}
});
}
/**
@ -1057,23 +1067,23 @@ public class ShareUpdateForm extends Composite {
instance.@org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm::showAlert(Ljava/lang/String;)(msg);
}else{
var msg = numberIgnoredFiles + ignoredFilesAlert;
console.log(msg);
instance.@org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm::showAlert(Ljava/lang/String;)(msg);
}
}
// reset text area
instance.@org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm::resetDNDStyleEffects()();
// enable attach buttons
instance.@org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm::enableAttachButtons(Z)(true);
// enable submit buttons
instance.@org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm::enableSubmitButtons(Z)(true);
});
}-*/;