use of com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel 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.component.form.multivalue.GenericMultiValueLabelEditPanel in project midpoint by Evolveum.
the class AdminGuiConfigPanel method initLayout.
private void initLayout() {
GenericMultiValueLabelEditPanel<RichHyperlinkType> dashboardLinkEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_DASHBOARD_LINK_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "userDashboardLink"), createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE, true) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
return new PropertyModel<String>(model, "label");
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), false) {
private static final long serialVersionUID = 1L;
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getDashboardLinkEditorContainer());
}
@Override
public StringResourceModel getTitle() {
return createStringResource("AdminGuiConfigPanel.dashboardLinkDialogTitle.title");
}
};
showDialog(contentPanel, target);
}
@Override
protected RichHyperlinkType createNewEmptyItem() {
RichHyperlinkType link = new RichHyperlinkType();
link.getAuthorization().add("");
return link;
}
};
dashboardLinkEditor.setOutputMarkupId(true);
add(dashboardLinkEditor);
GenericMultiValueLabelEditPanel<RichHyperlinkType> additionalMenuItemEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_ADDITIONAL_MENU_ITEM_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "additionalMenuLink"), createStringResource("AdminGuiConfigPanel.additionalMenuItemConfig"), LABEL_SIZE, INPUT_SIZE, true) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
return new PropertyModel<String>(model, "label");
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), true) {
private static final long serialVersionUID = 1L;
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getAdditionalMenuItemContainer());
}
@Override
public StringResourceModel getTitle() {
return createStringResource("AdminGuiConfigPanel.additionalMenuItemDialog.title");
}
};
showDialog(contentPanel, target);
}
@Override
protected RichHyperlinkType createNewEmptyItem() {
RichHyperlinkType link = new RichHyperlinkType();
link.getAuthorization().add("");
return link;
}
};
additionalMenuItemEditor.setOutputMarkupId(true);
add(additionalMenuItemEditor);
}
use of com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel in project midpoint by Evolveum.
the class MultipleAssignmentSelectorPanel method createTenantContainer.
private GenericMultiValueLabelEditPanel createTenantContainer() {
final GenericMultiValueLabelEditPanel tenantEditor = new GenericMultiValueLabelEditPanel<OrgType>(ID_TENANT_EDITOR, createTenantModel(), createStringResource("MultipleAssignmentSelector.tenant"), LABEL_SIZE, INPUT_SIZE, false) {
@Override
protected boolean getLabelVisibility() {
return false;
}
@Override
protected IModel<String> createTextModel(final IModel<OrgType> model) {
return new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getName(model.getObject().asPrismObject());
}
@Override
public void setObject(String s) {
}
@Override
public void detach() {
}
};
}
@Override
protected void removeValuePerformed(AjaxRequestTarget target, ListItem<OrgType> item) {
tenantEditorObject.clear();
tenantEditorObject.add(new OrgType());
target.add(getTenantEditorContainer());
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<OrgType> rowModel) {
List<QName> supportedTypes = new ArrayList<>();
supportedTypes.add(getPageBase().getPrismContext().getSchemaRegistry().findObjectDefinitionByCompileTimeClass(OrgType.class).getTypeName());
ObjectFilter filter = QueryBuilder.queryFor(OrgType.class, getPageBase().getPrismContext()).item(OrgType.F_TENANT).eq(true).buildFilter();
ObjectBrowserPanel<OrgType> tenantPanel = new ObjectBrowserPanel<OrgType>(getPageBase().getMainPopupBodyId(), OrgType.class, supportedTypes, false, getPageBase(), filter) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, OrgType org) {
super.onSelectPerformed(target, org);
tenantEditorObject.clear();
tenantEditorObject.add(org);
target.add(getTenantEditorContainer());
}
};
// OrgTreeAssignablePanel tenantPanel = new OrgTreeAssignablePanel(
// getPageBase().getMainPopupBodyId(), false, getPageBase()) {
//
// @Override
// protected void onItemSelect(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
// closeModalWindow(target);
// tenantEditorObject.clear();
// tenantEditorObject.add(selected.getValue());
// target.add(getTenantEditorContainer()); }
// };
getPageBase().showMainPopup(tenantPanel, target);
}
};
tenantEditor.setOutputMarkupId(true);
return tenantEditor;
}
use of com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel in project midpoint by Evolveum.
the class MultipleAssignmentSelectorPanel method createOrgContainer.
private GenericMultiValueLabelEditPanel createOrgContainer() {
final GenericMultiValueLabelEditPanel orgUnitEditor = new GenericMultiValueLabelEditPanel<OrgType>(ID_ORG_EDITOR, createOrgUnitModel(), createStringResource("MultipleAssignmentSelector.orgUnit"), LABEL_SIZE, INPUT_SIZE, false) {
@Override
protected boolean getLabelVisibility() {
return false;
}
@Override
protected IModel<String> createTextModel(final IModel<OrgType> model) {
return new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getName(model.getObject().asPrismObject());
}
@Override
public void setObject(String s) {
}
@Override
public void detach() {
}
};
}
@Override
protected void removeValuePerformed(AjaxRequestTarget target, ListItem<OrgType> item) {
orgEditorObject.clear();
orgEditorObject.add(new OrgType());
target.add(getOrgUnitEditorContainer());
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<OrgType> rowModel) {
List<QName> supportedTypes = new ArrayList<>();
supportedTypes.add(getPageBase().getPrismContext().getSchemaRegistry().findObjectDefinitionByCompileTimeClass(OrgType.class).getTypeName());
ObjectBrowserPanel<OrgType> orgPanel = new ObjectBrowserPanel<OrgType>(getPageBase().getMainPopupBodyId(), OrgType.class, supportedTypes, false, getPageBase()) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, OrgType org) {
super.onSelectPerformed(target, org);
orgEditorObject.clear();
orgEditorObject.add(org);
target.add(getOrgUnitEditorContainer());
}
};
getPageBase().showMainPopup(orgPanel, target);
}
};
orgUnitEditor.setOutputMarkupId(true);
return orgUnitEditor;
}
use of com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel 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