use of com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyPanel in project midpoint by Evolveum.
the class RolePolicyPanel method initLayout.
@Override
protected void initLayout() {
minAssignmentModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {
@Override
protected List<MultiplicityPolicyConstraintType> load() {
RoleType roleType = role.asObjectable();
if (roleType.getPolicyConstraints() == null) {
roleType.setPolicyConstraints(new PolicyConstraintsType());
}
return roleType.getPolicyConstraints().getMinAssignees();
}
};
maxAssignmentsModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {
@Override
protected List<MultiplicityPolicyConstraintType> load() {
RoleType roleType = role.asObjectable();
if (roleType.getPolicyConstraints() == null) {
roleType.setPolicyConstraints(new PolicyConstraintsType());
}
return roleType.getPolicyConstraints().getMaxAssignees();
}
};
GenericMultiValueLabelEditPanel minAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MIN_ASSIGNMENTS, minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {
@Override
protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
return createMultiplicityPolicyLabel(model);
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getMinAssignmentsContainer());
}
};
showDialog(window, target);
}
@Override
protected MultiplicityPolicyConstraintType createNewEmptyItem() {
return new MultiplicityPolicyConstraintType();
}
};
minAssignments.setOutputMarkupId(true);
add(minAssignments);
GenericMultiValueLabelEditPanel maxAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MAX_ASSIGNMENTS, maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {
@Override
protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
return createMultiplicityPolicyLabel(model);
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getMaxAssignmentsContainer());
}
};
showDialog(window, target);
}
@Override
protected MultiplicityPolicyConstraintType createNewEmptyItem() {
return new MultiplicityPolicyConstraintType();
}
};
maxAssignments.setOutputMarkupId(true);
add(maxAssignments);
}
use of com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyPanel in project midpoint by Evolveum.
the class BaseAbstractRolePanel method initLayout.
@Override
protected void initLayout() {
minAssignmentModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {
@Override
protected List<MultiplicityPolicyConstraintType> load() {
if (abstractRole.getPolicyConstraints() == null) {
abstractRole.setPolicyConstraints(new PolicyConstraintsType());
}
return abstractRole.getPolicyConstraints().getMinAssignees();
}
};
maxAssignmentsModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {
@Override
protected List<MultiplicityPolicyConstraintType> load() {
if (abstractRole.getPolicyConstraints() == null) {
abstractRole.setPolicyConstraints(new PolicyConstraintsType());
}
return abstractRole.getPolicyConstraints().getMaxAssignees();
}
};
GenericMultiValueLabelEditPanel minAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MIN_ASSIGNMENTS, minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {
@Override
protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
return createMultiplicityPolicyLabel(model);
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getMinAssignmentsContainer());
}
};
showDialog(window, target);
}
@Override
protected MultiplicityPolicyConstraintType createNewEmptyItem() {
return new MultiplicityPolicyConstraintType();
}
};
minAssignments.setOutputMarkupId(true);
add(minAssignments);
GenericMultiValueLabelEditPanel maxAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MAX_ASSIGNMENTS, maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {
@Override
protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
return createMultiplicityPolicyLabel(model);
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getMaxAssignmentsContainer());
}
};
showDialog(window, target);
}
@Override
protected MultiplicityPolicyConstraintType createNewEmptyItem() {
return new MultiplicityPolicyConstraintType();
}
};
maxAssignments.setOutputMarkupId(true);
add(maxAssignments);
}
Aggregations