Search in sources :

Example 6 with CompositedIconButtonDto

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

the class BasicMultivalueContainerListPanel method createNewButtonDescription.

@Override
protected List<CompositedIconButtonDto> createNewButtonDescription() {
    String title = getPageBase().createStringResource("PageAdminObjectDetails.title.new", getContainerNameForNewButton()).getString();
    DisplayType defaultButtonDisplayType = GuiDisplayTypeUtil.createDisplayType("fa fa-plus", "green", title);
    CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
    CompositedIconBuilder builder = new CompositedIconBuilder();
    builder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType));
    defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
    defaultButton.setCompositedIcon(builder.build());
    return Collections.singletonList(defaultButton);
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 7 with CompositedIconButtonDto

use of com.evolveum.midpoint.web.component.CompositedIconButtonDto 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 8 with CompositedIconButtonDto

use of com.evolveum.midpoint.web.component.CompositedIconButtonDto 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 9 with CompositedIconButtonDto

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

the class AssignmentPopup method createCompositedButtonForAssignmentRelation.

private CompositedIconButtonDto createCompositedButtonForAssignmentRelation(AssignmentObjectRelation relation) {
    CompositedIconButtonDto buttonDto = new CompositedIconButtonDto();
    buttonDto.setAssignmentObjectRelation(relation);
    DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(getPageBase(), relation, "AssignmentPanel.newAssignmentTitle");
    // isInducement() ? "AssignmentPanel.newInducementTitle" : "AssignmentPanel.newAssignmentTitle");
    buttonDto.setAdditionalButtonDisplayType(additionalButtonDisplayType);
    CompositedIconBuilder builder = WebComponentUtil.getAssignmentRelationIconBuilder(getPageBase(), relation, additionalButtonDisplayType.getIcon(), WebComponentUtil.createIconType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green"));
    CompositedIcon icon = null;
    if (builder != null) {
        icon = builder.build();
    }
    buttonDto.setCompositedIcon(icon);
    return buttonDto;
}
Also used : CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 10 with CompositedIconButtonDto

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

the class AssignmentPopup method newButtonDescription.

private List<CompositedIconButtonDto> newButtonDescription() {
    if (getModelObject() == null) {
        return null;
    }
    List<AssignmentObjectRelation> relations = getModelObject().getAssignmentObjectRelation();
    if (relations == null) {
        return null;
    }
    List<CompositedIconButtonDto> buttonDtoList = new ArrayList<>();
    relations.forEach(relation -> buttonDtoList.add(createCompositedButtonForAssignmentRelation(relation)));
    if (isGenericNewObjectButtonVisible()) {
        DisplayType defaultButtonDisplayType = GuiDisplayTypeUtil.createDisplayType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green", createStringResource("AssignmentPanel.defaultAssignment").getString(), createStringResource("AssignmentPanel.newAssignmentTitle", "", "").getString());
        // AssignmentPanel.this.createStringResource(isInducement() ?
        // "AssignmentPanel.newInducementTitle" : "AssignmentPanel.newAssignmentTitle", "", "").getString());
        CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
        CompositedIconBuilder builder = new CompositedIconBuilder();
        builder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType)).appendLayerIcon(WebComponentUtil.createIconType(GuiStyleConstants.CLASS_PLUS_CIRCLE, "green"), IconCssStyle.BOTTOM_RIGHT_STYLE);
        defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
        defaultButton.setCompositedIcon(builder.build());
        buttonDtoList.add(defaultButton);
    }
    return buttonDtoList;
}
Also used : CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Aggregations

CompositedIconButtonDto (com.evolveum.midpoint.web.component.CompositedIconButtonDto)10 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)9 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)4 MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)4 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)3 IconCssStyle (com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle)2 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)2 DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)2 ArrayList (java.util.ArrayList)2 CompositedIcon (com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1