Search in sources :

Example 6 with MultiFunctinalButtonDto

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

the class AbstractRoleMemberPanel method loadMultiFunctionalButtonModel.

protected LoadableModel<MultiFunctinalButtonDto> loadMultiFunctionalButtonModel(boolean useDefaultObjectRelations) {
    return new LoadableModel<>(false) {

        @Override
        protected MultiFunctinalButtonDto load() {
            MultiFunctinalButtonDto multiFunctinalButtonDto = new MultiFunctinalButtonDto();
            DisplayType mainButtonDisplayType = getCreateMemberButtonDisplayType();
            CompositedIconBuilder builder = new CompositedIconBuilder();
            Map<IconCssStyle, IconType> layerIcons = WebComponentUtil.createMainButtonLayerIcon(mainButtonDisplayType);
            for (Map.Entry<IconCssStyle, IconType> icon : layerIcons.entrySet()) {
                builder.appendLayerIcon(icon.getValue(), icon.getKey());
            }
            CompositedIconButtonDto mainButton = createCompositedIconButtonDto(mainButtonDisplayType, null, builder.build());
            multiFunctinalButtonDto.setMainButton(mainButton);
            List<AssignmentObjectRelation> loadedRelations = loadMemberRelationsList();
            if (CollectionUtils.isEmpty(loadedRelations) && useDefaultObjectRelations) {
                loadedRelations.addAll(getDefaultNewMemberRelations());
            }
            List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(loadedRelations)) {
                List<AssignmentObjectRelation> relations = WebComponentUtil.divideAssignmentRelationsByAllValues(loadedRelations);
                relations.forEach(relation -> {
                    DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(getPageBase(), relation, "abstractRoleMemberPanel.menu.createMember");
                    CompositedIconButtonDto buttonDto = createCompositedIconButtonDto(additionalButtonDisplayType, relation, createCompositedIcon(relation, additionalButtonDisplayType));
                    additionalButtons.add(buttonDto);
                });
            }
            multiFunctinalButtonDto.setAdditionalButtons(additionalButtons);
            return multiFunctinalButtonDto;
        }
    };
}
Also used : CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) MultiFunctinalButtonDto(com.evolveum.midpoint.web.component.MultiFunctinalButtonDto) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) IconCssStyle(com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle)

Aggregations

MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)4 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)4 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)4 CompositedIconButtonDto (com.evolveum.midpoint.web.component.CompositedIconButtonDto)4 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)3 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)2 IconCssStyle (com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle)2 AjaxIconButton (com.evolveum.midpoint.web.component.AjaxIconButton)2 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)2 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)2 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)2 ArrayList (java.util.ArrayList)2 Component (org.apache.wicket.Component)2 RestartResponseException (org.apache.wicket.RestartResponseException)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 IModel (org.apache.wicket.model.IModel)2