use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class PageWorkItem method initButtons.
private void initButtons(Form mainForm) {
VisibleBehaviour isAllowedToSubmit = new VisibleBehaviour(() -> getWorkflowManager().isCurrentUserAuthorizedToSubmit(workItemDtoModel.getObject().getWorkItem()));
VisibleBehaviour isAllowedToDelegate = new VisibleBehaviour(() -> getWorkflowManager().isCurrentUserAuthorizedToDelegate(workItemDtoModel.getObject().getWorkItem()));
VisibleBehaviour isAllowedToClaim = new VisibleBehaviour(() -> workItemDtoModel.getObject().getWorkItem().getAssigneeRef() == null && getWorkflowManager().isCurrentUserAuthorizedToClaim(workItemDtoModel.getObject().getWorkItem()));
VisibleBehaviour isAllowedToRelease = new VisibleBehaviour(() -> {
WorkItemType workItem = workItemDtoModel.getObject().getWorkItem();
MidPointPrincipal principal;
try {
principal = (MidPointPrincipal) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
} catch (ClassCastException e) {
return false;
}
String principalOid = principal.getOid();
return workItem.getAssigneeRef() != null && workItem.getAssigneeRef().stream().anyMatch(ref -> ref.getOid().equals(principalOid)) && (!workItem.getCandidateRef().isEmpty());
});
AjaxSubmitButton claim = new DefaultAjaxSubmitButton(ID_CLAIM, createStringResource("pageWorkItem.button.claim"), this, (target, form) -> claimPerformed(target));
claim.add(isAllowedToClaim);
mainForm.add(claim);
AjaxSubmitButton release = new DefaultAjaxSubmitButton(ID_RELEASE, createStringResource("pageWorkItem.button.release"), this, (target, form) -> releasePerformed(target));
release.add(isAllowedToRelease);
mainForm.add(release);
AjaxSubmitButton approve = new DefaultAjaxSubmitButton(ID_APPROVE, createStringResource("pageWorkItem.button.approve"), this, (target, form) -> savePerformed(target, true));
approve.add(isAllowedToSubmit);
mainForm.add(approve);
AjaxSubmitButton reject = new DefaultAjaxSubmitButton(ID_REJECT, createStringResource("pageWorkItem.button.reject"), this, (target, form) -> savePerformed(target, false));
reject.add(isAllowedToSubmit);
mainForm.add(reject);
AjaxSubmitButton delegate = new DefaultAjaxSubmitButton(ID_DELEGATE, createStringResource("pageWorkItem.button.delegate"), this, (target, form) -> delegatePerformed(target));
delegate.add(isAllowedToDelegate);
mainForm.add(delegate);
AjaxButton cancel = new DefaultAjaxButton(ID_CANCEL, createStringResource("pageWorkItem.button.cancel"), this::cancelPerformed);
mainForm.add(cancel);
}
use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class PageSelfRegistration method initLayout.
private void initLayout() {
final Form<?> mainForm = new Form<>(ID_MAIN_FORM);
initAccessBehaviour(mainForm);
add(mainForm);
addMultilineLable(ID_WELCOME, "PageSelfRegistration.welcome.message", mainForm);
addMultilineLable(ID_ADDITIONAL_TEXT, "PageSelfRegistration.additional.message", mainForm);
initStaticFormLayout(mainForm);
initDynamicFormLayout(mainForm);
CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA);
captcha.setOutputMarkupId(true);
mainForm.add(captcha);
AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
showErrors(target);
}
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
submitRegistration(target);
}
};
mainForm.add(register);
MultiLineLabel label = new MultiLineLabel(ID_REGISTRATION_SUBMITED, createStringResource("PageSelfRegistration.registration.confirm.message"));
add(label);
label.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return submited;
}
@Override
public boolean isEnabled() {
return submited;
}
});
AjaxButton back = new AjaxButton(ID_BACK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(PageLogin.class);
}
};
mainForm.add(back);
}
use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class UploadDownloadPanel method initLayout.
private void initLayout(final boolean isReadOnly) {
final FileUploadField fileUpload = new FileUploadField(ID_INPUT_FILE);
Form form = this.findParent(Form.class);
fileUpload.add(new AjaxFormSubmitBehavior(form, "change") {
@Override
protected void onSubmit(AjaxRequestTarget target) {
super.onSubmit(target);
UploadDownloadPanel.this.uploadFilePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
super.onError(target);
UploadDownloadPanel.this.uploadFilePerformed(target);
}
});
fileUpload.setOutputMarkupId(true);
add(fileUpload);
final AjaxDownloadBehaviorFromStream downloadBehavior = new AjaxDownloadBehaviorFromStream() {
@Override
protected InputStream initStream() {
return getStream();
}
};
add(downloadBehavior);
add(new AjaxSubmitButton(ID_BUTTON_DOWNLOAD) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
downloadPerformed(downloadBehavior, target);
}
});
add(new AjaxSubmitButton(ID_BUTTON_DELETE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
removeFilePerformed(target);
}
});
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !isReadOnly;
}
});
}
use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class PageTaskAdd method initButtons.
private void initButtons(final Form mainForm) {
AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_BUTTON_SAVE, createStringResource("PageBase.button.save")) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
savePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getFeedbackPanel());
}
};
mainForm.setDefaultButton(saveButton);
mainForm.add(saveButton);
AjaxButton backButton = new AjaxButton(ID_BUTTON_BACK, createStringResource("PageBase.button.back")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
mainForm.add(backButton);
}
use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class PageSystemConfiguration method initButtons.
private void initButtons(Form mainForm) {
AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("PageBase.button.save")) {
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
savePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
target.add(getFeedbackPanel());
}
};
mainForm.add(save);
AjaxButton cancel = new AjaxButton(ID_CANCEL, createStringResource("PageBase.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed(target);
}
};
mainForm.add(cancel);
}
Aggregations