use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class AssignmentConflictPanel method initLayout.
private void initLayout() {
setOutputMarkupId(true);
Form container = new MidpointForm<>(ID_PANEL_CONTAINER);
container.setOutputMarkupId(true);
add(container);
Label statusIconLabel = new Label(ID_STATUS_ICON);
statusIconLabel.add(new AttributeAppender("class", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getModelObject() != null ? (getModelObject().isResolved() ? STATUS_FIXED : (getModelObject().isWarning() ? STATUS_WARNING : STATUS_ERROR)) : STATUS_ERROR;
}
}));
container.add(statusIconLabel);
Label existingAssignment = new Label(ID_EXISTING_ASSIGNMENT, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (getModelObject() != null) {
String name = getModelObject().getAssignment1().getAssignmentTargetObject().asObjectable().getName() != null ? getModelObject().getAssignment1().getAssignmentTargetObject().asObjectable().getName().getOrig() : getModelObject().getAssignment1().getAssignmentTargetObject().getOid();
return name + " " + getMessageLabel(getModelObject().getAssignment1().isOldAssignment());
}
return "";
}
});
existingAssignment.add(new AttributeAppender("style", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getModelObject() != null && getModelObject().getAssignment1().isResolved() ? "text-decoration: line-through;" : "";
}
}));
container.add(existingAssignment);
Label addedAssignment = new Label(ID_ADDED_ASSIGNMENT, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (getModelObject() != null) {
String name = getModelObject().getAssignment2().getAssignmentTargetObject().asObjectable().getName() != null ? getModelObject().getAssignment2().getAssignmentTargetObject().asObjectable().getName().getOrig() : getModelObject().getAssignment2().getAssignmentTargetObject().getOid();
return name + " " + getMessageLabel(getModelObject().getAssignment2().isOldAssignment());
}
return "";
}
});
addedAssignment.add(new AttributeAppender("style", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getModelObject() != null && getModelObject().getAssignment2().isResolved() ? "text-decoration: line-through;" : "";
}
}));
container.add(addedAssignment);
IModel<String> removeButtonTitleModel = new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getModelObject().getAssignment1().isResolved() ? createStringResource("AssignmentConflictPanel.undoAction").getString() : createStringResource("AssignmentConflictPanel.removeButton").getString();
}
};
AjaxSubmitButton removeButton = new AjaxSubmitButton(ID_REMOVE_BUTTON, removeButtonTitleModel) {
@Override
public void onSubmit(AjaxRequestTarget target) {
AssignmentConflictPanel.this.removeAssignmentPerformed(getModelObject().getAssignment1(), target);
}
};
removeButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getModelObject() != null;
}
@Override
public boolean isEnabled() {
return !getModelObject().getAssignment2().isResolved();
}
});
container.add(removeButton);
IModel<String> unselectButtonTitleModel = new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getModelObject().getAssignment2().isResolved() ? createStringResource("AssignmentConflictPanel.undoAction").getString() : createStringResource("AssignmentConflictPanel.removeButton").getString();
}
};
AjaxSubmitButton unselectButton = new AjaxSubmitButton(ID_UNSELECT_BUTTON, unselectButtonTitleModel) {
@Override
public void onSubmit(AjaxRequestTarget target) {
AssignmentConflictPanel.this.removeAssignmentPerformed(getModelObject().getAssignment2(), target);
}
};
unselectButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getModelObject() != null;
}
@Override
public boolean isEnabled() {
return !getModelObject().getAssignment1().isResolved();
}
});
container.add(unselectButton);
}
use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.
the class ProgressPanel method initButtons.
private void initButtons(final MidpointForm progressForm) {
abortButton = new AjaxSubmitButton(ID_ABORT, createStringResource("pageAdminFocus.button.abort")) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
abortPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
configureButton(abortButton);
progressForm.add(abortButton);
backButton = new AjaxSubmitButton(ID_BACK, createStringResource("pageAdminFocus.button.back")) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
backPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
configureButton(backButton);
progressForm.add(backButton);
continueEditingButton = new AjaxSubmitButton(ID_CONTINUE_EDITING, createStringResource("pageAdminFocus.button.continueEditing")) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
ProgressReportingAwarePage page = (ProgressReportingAwarePage) getPage();
page.continueEditing(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
configureButton(continueEditingButton);
progressForm.add(continueEditingButton);
}
Aggregations