Search in sources :

Example 31 with CompositedIconBuilder

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

use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.

the class PageResources method createRowMenuItems.

private List<InlineMenuItem> createRowMenuItems() {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    menuItems.add(new ButtonInlineMenuItem(createStringResource("PageResources.inlineMenuItem.test")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    testResourcePerformed(target, rowDto.getValue());
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM);
        }
    });
    menuItems.add(new ButtonInlineMenuItem(createStringResource("pageResources.button.editAsXml")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    editAsXmlPerformed(rowDto.getValue());
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
        }
    });
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.editResource")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    editResourcePerformed(rowDto.getValue());
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    menuItems.add(new InlineMenuItem(createStringResource("pageResource.button.refreshSchema")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    refreshSchemaPerformed(rowDto.getValue(), target);
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    menuItems.add(new ButtonInlineMenuItem(createStringResource("PageBase.button.delete")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        deleteResourcePerformed(target, null);
                    } else {
                        SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                        deleteResourcePerformed(target, rowDto.getValue());
                    }
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
        }
    });
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.deleteSyncToken")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    deleteResourceSyncTokenPerformed(target, rowDto.getValue());
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.toggleMaintenance")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
                    WebComponentUtil.toggleResourceMaintenance(rowDto.getValue().asPrismContainer(), OPERATION_SET_MAINTENANCE, target, PageResources.this);
                    target.add(getResourceTable());
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    return menuItems;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 33 with CompositedIconBuilder

use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder in project midpoint by Evolveum.

the class ResourceContentPanel method createRowMenuItems.

private List<InlineMenuItem> createRowMenuItems() {
    List<InlineMenuItem> items = new ArrayList<>();
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.enableAccount"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        updateResourceObjectStatusPerformed(null, target, true);
                    } else {
                        SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                        updateResourceObjectStatusPerformed(shadow.getValue(), target, true);
                    }
                }
            };
        }
    });
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.disableAccount"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        updateResourceObjectStatusPerformed(null, target, false);
                    } else {
                        SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                        updateResourceObjectStatusPerformed(shadow.getValue(), target, false);
                    }
                }
            };
        }
    });
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.deleteAccount"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        deleteResourceObjectPerformed(null, target);
                    } else {
                        SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                        deleteResourceObjectPerformed(shadow.getValue(), target);
                    }
                }
            };
        }
    });
    items.add(new ButtonInlineMenuItem(createStringResource("pageContentAccounts.menu.importAccount"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        importResourceObject(null, target);
                    } else {
                        SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                        importResourceObject(shadow.getValue(), target);
                    }
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_IMPORT_MENU_ITEM);
        }
    });
    // items.add(new InlineMenuItem());
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.removeOwner"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        changeOwner(null, target, null, Operation.REMOVE);
                    } else {
                        SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                        changeOwner(shadow.getValue(), target, null, Operation.REMOVE);
                    }
                }
            };
        }
    });
    items.add(new ButtonInlineMenuItem(createStringResource("pageContentAccounts.menu.changeOwner"), true) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target) {
                    final SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
                    ObjectBrowserPanel<FocusType> browser = new ObjectBrowserPanel<>(getPageBase().getMainPopupBodyId(), UserType.class, WebComponentUtil.createFocusTypeList(), false, getPageBase()) {

                        @Override
                        protected void onSelectPerformed(AjaxRequestTarget target, FocusType focus) {
                            changeOwner(shadow.getValue(), target, focus, Operation.MODIFY);
                        }
                    };
                    getPageBase().showMainPopup(browser, target);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_RECONCILE_MENU_ITEM);
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    return items;
}
Also used : SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 34 with CompositedIconBuilder

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

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

CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)57 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)32 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)26 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)26 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)26 ArrayList (java.util.ArrayList)26 IModel (org.apache.wicket.model.IModel)17 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)11 CompositedIconButtonDto (com.evolveum.midpoint.web.component.CompositedIconButtonDto)9 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)9 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)6 CompositedIcon (com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)6 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)5 CompositedIconColumn (com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconColumn)4 InlineMenuButtonColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn)4 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)4