use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project syncope by apache.
the class ActionDataTablePanel method addCancelButton.
public void addCancelButton(final BaseModal<?> modal) {
final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
private static final long serialVersionUID = -4804368561204623354L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
modal.close(target);
}
};
cancel.setDefaultFormProcessing(false);
bulkActionForm.addOrReplace(cancel);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project gitblit by gitblit.
the class CommentPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
Form<String> form = new Form<String>("editorForm");
add(form);
form.add(new AjaxButton("submit", new Model<String>(getString("gb.comment")), form) {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
String txt = markdownEditor.getText();
if (change == null) {
// new comment
Change newComment = new Change(user.username);
newComment.comment(txt);
if (!ticket.isWatching(user.username)) {
newComment.watch(user.username);
}
RepositoryModel repository = app().repositories().getRepositoryModel(ticket.repository);
TicketModel updatedTicket = app().tickets().updateTicket(repository, ticket.number, newComment);
if (updatedTicket != null) {
app().tickets().createNotifier().sendMailing(updatedTicket);
redirectTo(pageClass, WicketUtils.newObjectParameter(updatedTicket.repository, "" + ticket.number));
} else {
error("Failed to add comment!");
}
} else {
// TODO update comment
}
}
/**
* Steal from BasePage to realize redirection.
*
* @see BasePage
* @author krulls@GitHub; ECG Leipzig GmbH, Germany, 2015
*
* @param pageClass
* @param parameters
* @return
*/
private void redirectTo(Class<? extends BasePage> pageClass, PageParameters parameters) {
String relativeUrl = urlFor(pageClass, parameters).toString();
String canonicalUrl = RequestUtils.toAbsolutePath(relativeUrl);
getRequestCycle().setRequestTarget(new RedirectRequestTarget(canonicalUrl));
}
}.setVisible(ticket != null && ticket.number > 0));
final IModel<String> markdownPreviewModel = Model.of();
markdownPreview = new Label("markdownPreview", markdownPreviewModel);
markdownPreview.setEscapeModelStrings(false);
markdownPreview.setOutputMarkupId(true);
add(markdownPreview);
markdownEditor = new MarkdownTextArea("markdownEditor", markdownPreviewModel, markdownPreview);
markdownEditor.setRepository(repositoryName);
WicketUtils.setInputPlaceholder(markdownEditor, getString("gb.leaveComment"));
add(markdownEditor);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project hippo by NHS-digital-website.
the class EarlyAccessKeyPlugin method getDisabledForm.
private Form getDisabledForm() {
Form htmlForm = new Form("form");
htmlForm.setEnabled(false);
htmlForm.setVisible(false);
htmlForm.add(new AjaxButton("generate") {
});
htmlForm.add(new AjaxButton("delete") {
});
return htmlForm;
}
Aggregations