Created
February 4, 2014 23:36
-
-
Save koalahamlet/8814660 to your computer and use it in GitHub Desktop.
button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SEND BUTTON */ | |
AjaxSubmitLink sendButton = new AjaxSubmitLink("sendButton", form) { | |
private static final long serialVersionUID = 1L; | |
@Override | |
public void onSubmit(AjaxRequestTarget target, Form form) { | |
target.appendJavascript("newInvitationPage.clearFeedbackIndicators();"); | |
setObservee(observation); | |
if (validateObservation(false, target)) { // false == clicked send | |
// Page is valid, save first: | |
saveObservation(); | |
// The user will leave the page by clicking a confirm button | |
String confirmMessage = generateConfirmationMessage(); | |
target.appendJavascript("confirmationDialog.showDialog('" | |
+ confirmMessage + "');"); | |
} else { | |
onError(target, form); | |
} | |
} | |
@Override | |
protected void onError(AjaxRequestTarget target, Form form) { | |
super.onError(target, form); | |
target.addComponent(feedbackPanel); | |
target.appendJavascript("initModalFeedback(); " + | |
"newInvitationPage.setExitConfirm(true);"); | |
target.appendJavascript(createOnErrorFeedbackIndicatorJavascript()); | |
} | |
}; | |
add(sendButton.setVisible(newInvitationService.isSendButtonVisible(observation, observerRequest))); | |
// Hide the send button for live observation since the teacher doesn't have to add/share anything | |
if (observation.isLive()) { | |
sendButton.setVisible(false); | |
} | |
String sendButtonText = newInvitationService.isAcknowledgeButtonNeeded(observation, observerRequest) | |
? "Acknowledge" : "Send"; | |
Label sendButtonLabel = new Label("sendButtonLabel", sendButtonText); | |
sendButton.add(sendButtonLabel); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment