Search in sources :

Example 1 with AssignmentViewType

use of com.evolveum.midpoint.web.page.self.dto.AssignmentViewType in project midpoint by Evolveum.

the class AssignmentCatalogPanel method initViewSelector.

private void initViewSelector(WebMarkupContainer headerPanel) {
    DropDownChoice<AssignmentViewType> viewSelect = new DropDownChoice(ID_VIEW_TYPE, viewModel, Model.ofList(viewTypeList != null && viewTypeList.size() > 0 ? viewTypeList : createAssignableTypesList()), new EnumChoiceRenderer<AssignmentViewType>(this));
    viewSelect.add(new OnChangeAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (AssignmentViewType.USER_TYPE.equals(viewSelect.getModelObject())) {
                initUserViewSelectionPopup(createStringResource("AssignmentCatalogPanel.selectAssignmentsUserOwner"), target);
            } else {
                AssignmentCatalogPanel.this.addOrReplaceLayout(target, getCatalogItemsPanelContainer());
                target.add(getCatalogItemsPanelContainer());
                target.add(getHeaderPanel());
            }
        }
    });
    viewSelect.setOutputMarkupId(true);
    headerPanel.add(viewSelect);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) AssignmentViewType(com.evolveum.midpoint.web.page.self.dto.AssignmentViewType) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior)

Example 2 with AssignmentViewType

use of com.evolveum.midpoint.web.page.self.dto.AssignmentViewType in project midpoint by Evolveum.

the class PageAssignmentShoppingKart method initMainPanel.

private Component initMainPanel() {
    List<AssignmentViewType> viewTypeList = getAssignmentViewList();
    AssignmentViewType defaultViewType = getDefaultAssignmentViewType();
    if (viewTypeList == null || viewTypeList.size() == 0) {
        viewTypeList = new ArrayList<>(Arrays.asList(AssignmentViewType.values()));
    }
    if (defaultViewType != null && !viewTypeList.contains(defaultViewType)) {
        viewTypeList.add(defaultViewType);
    } else if (defaultViewType == null) {
        if (viewTypeList.size() == 1) {
            defaultViewType = viewTypeList.get(0);
        } else {
            if (StringUtils.isEmpty(catalogOid) && AssignmentViewType.ROLE_CATALOG_VIEW.getUri().equals(viewTypeList.get(0).getUri())) {
                defaultViewType = viewTypeList.get(1);
            } else {
                defaultViewType = viewTypeList.get(0);
            }
        }
    }
    AssignmentCatalogPanel panel = new AssignmentCatalogPanel(ID_MAIN_PANEL, catalogOid, defaultViewType, viewTypeList, PageAssignmentShoppingKart.this);
    panel.setOutputMarkupId(true);
    return panel;
}
Also used : AssignmentCatalogPanel(com.evolveum.midpoint.web.component.assignment.AssignmentCatalogPanel) AssignmentViewType(com.evolveum.midpoint.web.page.self.dto.AssignmentViewType)

Example 3 with AssignmentViewType

use of com.evolveum.midpoint.web.page.self.dto.AssignmentViewType in project midpoint by Evolveum.

the class PageAssignmentShoppingCart method getDefaultViewTypeIndex.

private int getDefaultViewTypeIndex() {
    RoleManagementConfigurationType roleConfig = roleManagementConfigModel.getObject();
    if (roleConfig == null || roleConfig.getDefaultCollection() == null || roleConfig.getDefaultCollection().getCollectionUri() == null) {
        return 0;
    }
    List<AssignmentViewType> viewTypes = Arrays.asList(AssignmentViewType.values());
    for (AssignmentViewType viewType : viewTypes) {
        if (viewType.getUri().equals(roleConfig.getDefaultCollection().getCollectionUri())) {
            return viewTypes.indexOf(viewType);
        }
    }
    return 0;
}
Also used : AssignmentViewType(com.evolveum.midpoint.web.page.self.dto.AssignmentViewType)

Aggregations

AssignmentViewType (com.evolveum.midpoint.web.page.self.dto.AssignmentViewType)3 AssignmentCatalogPanel (com.evolveum.midpoint.web.component.assignment.AssignmentCatalogPanel)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 OnChangeAjaxBehavior (org.apache.wicket.ajax.form.OnChangeAjaxBehavior)1 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)1