Search in sources :

Example 1 with IconCssStyle

use of com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle 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)

Example 2 with IconCssStyle

use of com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle 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

LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)2 IconCssStyle (com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle)2 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)2 CompositedIconButtonDto (com.evolveum.midpoint.web.component.CompositedIconButtonDto)2 MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)2