Search in sources :

Example 1 with RelationDropDownChoicePanel

use of com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel in project midpoint by Evolveum.

the class FocusTypeAssignmentPopupTabPanel method initParametersPanel.

@Override
protected void initParametersPanel(Fragment parametersPanel) {
    WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
    relationContainer.setOutputMarkupId(true);
    parametersPanel.add(relationContainer);
    List<QName> relationsList = getPredefinedRelation() != null ? Collections.singletonList(getPredefinedRelation()) : getSupportedRelations();
    relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, getDefaultRelationIfInList(relationsList), relationsList, false));
}
Also used : QName(javax.xml.namespace.QName) RelationDropDownChoicePanel(com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 2 with RelationDropDownChoicePanel

use of com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel in project midpoint by Evolveum.

the class AssignmentEditorPanel method addRelationDropDown.

private void addRelationDropDown(WebMarkupContainer relationContainer) {
    QName assignmentRelation = getModelObject().getTargetRef() != null ? getModelObject().getTargetRef().getRelation() : null;
    RelationDropDownChoicePanel relationDropDown = new RelationDropDownChoicePanel(ID_RELATION, assignmentRelation != null ? assignmentRelation : WebComponentUtil.getDefaultRelationOrFail(), getSupportedRelations(), false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onValueChanged(AjaxRequestTarget target) {
            ObjectReferenceType ref = AssignmentEditorPanel.this.getModelObject().getTargetRef();
            if (ref != null) {
                ref.setRelation(getRelationValue());
            }
        }

        @Override
        protected IModel<String> getRelationLabelModel() {
            return Model.of();
        }

        @Override
        protected boolean isRelationDropDownEnabled() {
            return isRelationEditable();
        }
    };
    relationDropDown.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isCreatingNewAssignment();
        }
    });
    relationContainer.add(relationDropDown);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) QName(javax.xml.namespace.QName) RelationDropDownChoicePanel(com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 3 with RelationDropDownChoicePanel

use of com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel in project midpoint by Evolveum.

the class MemberPopupTabPanel method initParametersPanel.

@Override
protected void initParametersPanel(Fragment parametersPanel) {
    WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
    relationContainer.setOutputMarkupId(true);
    relationContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(relationConfig.getSupportedRelations());
        }

        @Override
        public boolean isEnabled() {
            return CollectionUtils.isNotEmpty(relationConfig.getSupportedRelations()) && relationConfig.getSupportedRelations().size() > 1;
        }
    });
    parametersPanel.add(relationContainer);
    relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, getDefaultRelation(), relationConfig.getSupportedRelations(), false));
}
Also used : RelationDropDownChoicePanel(com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 4 with RelationDropDownChoicePanel

use of com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel in project midpoint by Evolveum.

the class AbstractShoppingCartTabPanel method initRelationPanel.

private void initRelationPanel(WebMarkupContainer parametersPanel) {
    WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
    relationContainer.setOutputMarkupId(true);
    parametersPanel.add(relationContainer);
    List<QName> assignableRelationsList = getAvailableRelationsList();
    if (CollectionUtils.isNotEmpty(assignableRelationsList)) {
        if (assignableRelationsList.contains(SchemaConstants.ORG_DEFAULT)) {
            getRoleCatalogStorage().setSelectedRelation(SchemaConstants.ORG_DEFAULT);
        } else {
            getRoleCatalogStorage().setSelectedRelation(assignableRelationsList.get(0));
        }
    }
    relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, getRoleCatalogStorage().getSelectedRelation(), assignableRelationsList, false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onValueChanged(AjaxRequestTarget target) {
            getRoleCatalogStorage().setSelectedRelation(getRelationValue());
            target.add(AbstractShoppingCartTabPanel.this);
        }

        @Override
        protected IModel<String> getRelationLabelModel() {
            return Model.of();
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) RelationDropDownChoicePanel(com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

RelationDropDownChoicePanel (com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel)4 QName (javax.xml.namespace.QName)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 IModel (org.apache.wicket.model.IModel)1