Feature #16205: News Feed avoid refresh page when user is commenting
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@178412 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
213947b7f0
commit
dad9ae7b6b
|
@ -66,6 +66,16 @@ public class AddCommentTemplate extends Composite {
|
|||
cancelButton.setVisible(false);
|
||||
commentTextArea.setHeight("30px");
|
||||
commentTextArea.setContext(owner.getVREContext());
|
||||
|
||||
// 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 = commentTextArea.getText();
|
||||
if(!currentText.isEmpty()){
|
||||
closingEvent.setMessage("Do you really want to leave the page?");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* called on edit comment
|
||||
|
@ -93,12 +103,23 @@ public class AddCommentTemplate extends Composite {
|
|||
mainPanel.setStyleName("single-comment");
|
||||
commentTextArea.addStyleName("comment-dark-color");
|
||||
submitButton.setText("Edit");
|
||||
|
||||
// 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 = commentTextArea.getText();
|
||||
if(!currentText.isEmpty()){
|
||||
closingEvent.setMessage("Do you really want to leave the page?");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Used by AddCommentTemplate to instantiate SuperPosedTextArea */
|
||||
@UiFactory SuperPosedTextArea build() {
|
||||
return new SuperPosedTextArea(highlighterDIV);
|
||||
}
|
||||
|
||||
public void setFocus() {
|
||||
commentTextArea.setFocus(true);
|
||||
submitButton.setVisible(true);
|
||||
|
|
Loading…
Reference in New Issue