use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project midpoint by Evolveum.
the class MultipleAssignmentSelectorPanel method initLayout.
private void initLayout(Class<H> targetFocusClass, PageBase page) {
IModel<List<AssignmentEditorDto>> availableAssignmentModel = createAvailableAssignmentModel();
final MultipleAssignmentSelector availableAssignmentsPanel = new MultipleAssignmentSelector<F, H>(ID_AVAILABLE_ASSIGNMENTS, availableAssignmentModel, targetFocusClass, type, focus, getFilterModel(true), page);
final MultipleAssignmentSelector currentAssignmentsPanel = new MultipleAssignmentSelector<F, H>(ID_CURRENT_ASSIGNMENTS, assignmentsModel, targetFocusClass, type, null, getFilterModel(true), page) {
@Override
protected List<AssignmentEditorDto> getListProviderDataList() {
return assignmentsModel.getObject();
}
};
currentAssignmentsPanel.setFilterButtonVisibility(false);
AjaxButton add = new AjaxButton(ID_BUTTON_ADD) {
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
addToAssignmentsModel(target, availableAssignmentsPanel, currentAssignmentsPanel);
}
};
AjaxButton remove = new AjaxButton(ID_BUTTON_REMOVE) {
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
deleteFromAssignmentsModel(target, currentAssignmentsPanel, availableAssignmentsPanel);
}
};
remove.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_UNASSIGN_ACTION_URL);
}
});
AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
@Override
public void onClick(AjaxRequestTarget target) {
reset(currentAssignmentsPanel);
target.add(currentAssignmentsPanel);
}
};
buttonReset.setBody(createStringResource("MultipleAssignmentSelector.reset"));
Form<?> form = new Form<Void>(ID_FORM);
form.add(createTenantContainer());
form.add(createOrgContainer());
form.add(availableAssignmentsPanel);
form.add(currentAssignmentsPanel);
form.add(buttonReset);
form.add(add);
form.add(remove);
add(form);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project wicket by apache.
the class PanelEdit method createSubmitButton.
private AjaxButton createSubmitButton() {
AjaxButton submit = new AjaxButton("submit") {
protected void onSubmit(AjaxRequestTarget target) {
Component currentcomponent = PanelEdit.this;
Component newComponent = new Label(currentcomponent.getId()).setOutputMarkupId(true);
currentcomponent.replaceWith(newComponent);
target.add(newComponent);
}
};
return submit;
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project openmeetings by apache.
the class FormSaveRefreshPanel method onInitialize.
@Override
protected void onInitialize() {
add(feedback.setOutputMarkupId(true));
// add a save button that can be used to submit the form via ajax
add(new AjaxButton("ajax-save-button", form) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
// repaint the feedback panel so that it is hidden
target.add(feedback);
onSaveSubmit(target, form);
}
@Override
protected void onError(AjaxRequestTarget target) {
// repaint the feedback panel so errors are shown
target.add(feedback);
onSaveError(target, form);
}
});
// add a refresh button that can be used to submit the form via ajax
add(new AjaxButton("ajax-refresh-button", form) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
// repaint the feedback panel so that it is hidden
target.add(feedback);
hideNewRecord();
onRefreshSubmit(target, form);
}
@Override
protected void onError(AjaxRequestTarget target) {
// repaint the feedback panel so errors are shown
target.add(feedback);
hideNewRecord();
onRefreshError(target, form);
}
});
super.onInitialize();
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project openmeetings by apache.
the class AdminSavePanel method onInitialize.
@Override
protected void onInitialize() {
newRecord.setDefaultModelObject(getString("155"));
add(newRecord.setVisible(false).setOutputMarkupId(true));
final AjaxButton newBtn = new AjaxButton("ajax-new-button", form) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
// repaint the feedback panel so that it is hidden
target.add(feedback);
newRecord.setVisible(true);
target.add(newRecord);
onNewSubmit(target, form);
}
@Override
protected void onError(AjaxRequestTarget target) {
// repaint the feedback panel so errors are shown
target.add(feedback);
onNewError(target, form);
}
};
// add a cancel button that can be used to submit the form via ajax
final Form<?> cForm = new Form<>("form");
cForm.setMultiPart(form.isMultiPart());
add(cForm);
final ConfirmableAjaxBorder delBtn = new ConfirmableAjaxBorder("ajax-cancel-button", getString("80"), getString("833"), cForm) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target) {
// repaint the feedback panel so errors are shown
target.add(feedback);
hideNewRecord();
onDeleteError(target, form);
}
@Override
protected void onSubmit(AjaxRequestTarget target) {
// repaint the feedback panel so that it is hidden
target.add(feedback);
hideNewRecord();
onDeleteSubmit(target, form);
}
};
add(newBtn.setVisible(isNewBtnVisible()), delBtn.setVisible(isDelBtnVisible()));
super.onInitialize();
}
use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project sandbox by irof.
the class StatefulPage method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(new Label("code", code));
add(new Label("instance", this.toString()));
Form<Void> form = new Form<>("form");
form.add(new Label("count", count));
form.add(new AjaxButton("ajaxButton") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
Integer prev = count.getObject();
count.setObject(prev + 1);
target.add(form);
}
});
form.add(new Button("button") {
@Override
public void onSubmit() {
setResponsePage(StatefulPage.class);
}
});
form.setOutputMarkupId(true);
add(form);
}
Aggregations