use of com.evolveum.midpoint.schema.constants.RelationTypes in project midpoint by Evolveum.
the class TypedAssignablePanel method getSelectedRelation.
private QName getSelectedRelation() {
// noinspection unchecked
DropDownChoicePanel<RelationTypes> relationPanel = (DropDownChoicePanel<RelationTypes>) get(ID_RELATION_CONTAINER).get(ID_RELATION);
RelationTypes relation = relationPanel.getModel().getObject();
if (relation == null) {
return WebComponentUtil.getDefaultRelationOrFail();
}
return relation.getRelation();
}
use of com.evolveum.midpoint.schema.constants.RelationTypes in project midpoint by Evolveum.
the class TypedAssignablePanel method initAssignmentParametersPanel.
protected void initAssignmentParametersPanel() {
DropDownChoicePanel<ObjectTypes> typeSelect = new DropDownChoicePanel<>(ID_TYPE, typeModel, Model.ofList(getObjectTypesList()), new EnumChoiceRenderer<>());
typeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(get(ID_TABLES_CONTAINER));
target.add(addOrReplace(createCountContainer()));
}
});
typeSelect.setOutputMarkupId(true);
add(typeSelect);
WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
relationContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return TypedAssignablePanel.this.isRelationPanelVisible() && !ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
relationContainer.setOutputMarkupId(true);
add(relationContainer);
DropDownChoicePanel<RelationTypes> relationSelector = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION, WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), Model.of(RelationTypes.MEMBER), TypedAssignablePanel.this, false);
relationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relationSelector.setOutputMarkupId(true);
relationSelector.setOutputMarkupPlaceholderTag(true);
relationContainer.add(relationSelector);
WebMarkupContainer kindContainer = new WebMarkupContainer(ID_KIND_CONTAINER);
kindContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
kindContainer.setOutputMarkupId(true);
add(kindContainer);
DropDownChoicePanel kindSelector = WebComponentUtil.createEnumPanel(ShadowKindType.class, ID_KIND, WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), Model.of(ShadowKindType.ACCOUNT), TypedAssignablePanel.this, false);
kindSelector.setOutputMarkupId(true);
kindSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
}
});
kindSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(TypedAssignablePanel.this);
}
});
kindSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
kindSelector.setOutputMarkupPlaceholderTag(true);
kindContainer.add(kindSelector);
WebMarkupContainer intentContainer = new WebMarkupContainer(ID_INTENT_CONTAINER);
intentContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
intentContainer.setOutputMarkupId(true);
add(intentContainer);
DropDownChoicePanel<?> intentSelector = new DropDownChoicePanel<>(ID_INTENT, intentValueModel, intentValues);
intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
intentSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(TypedAssignablePanel.this);
}
});
intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
intentSelector.setOutputMarkupId(true);
intentSelector.setOutputMarkupPlaceholderTag(true);
intentSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
}
});
intentContainer.add(intentSelector);
WebMarkupContainer orgTreeViewContainer = new WebMarkupContainer(ID_ORG_TREE_VIEW_CONTAINER);
orgTreeViewContainer.setOutputMarkupId(true);
orgTreeViewContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
boolean res = OrgType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
return res;
}
});
add(orgTreeViewContainer);
CheckBox orgTreeViewCheckbox = new CheckBox(ID_ORG_TREE_VIEW, orgTreeViewModel);
orgTreeViewCheckbox.add(new AjaxEventBehavior("change") {
@Override
protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
orgTreeViewModel.setObject(!orgTreeViewModel.getObject());
ajaxRequestTarget.add(TypedAssignablePanel.this);
}
});
orgTreeViewCheckbox.setOutputMarkupId(true);
orgTreeViewContainer.add(orgTreeViewCheckbox);
}
Aggregations