Search in sources :

Example 36 with CompositedIconBuilder

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

the class AbstractAssignmentTypePanel method createAssignmentIconColumn.

private IColumn<PrismContainerValueWrapper<AssignmentType>, String> createAssignmentIconColumn() {
    return new CompositedIconColumn<>(Model.of("")) {

        @Override
        protected CompositedIcon getCompositedIcon(IModel<PrismContainerValueWrapper<AssignmentType>> rowModel) {
            AssignmentType assignment = rowModel.getObject().getRealValue();
            LOGGER.trace("Create icon for AssignmentType: " + assignment);
            PrismObject<? extends FocusType> object = loadTargetObject(assignment);
            if (object != null) {
                return WebComponentUtil.createCompositeIconForObject(object.asObjectable(), new OperationResult("create_assignment_composited_icon"), getPageBase());
            }
            String displayType = WebComponentUtil.createDefaultBlackIcon(AssignmentsUtil.getTargetType(assignment));
            CompositedIconBuilder iconBuilder = new CompositedIconBuilder();
            iconBuilder.setBasicIcon(displayType, IconCssStyle.IN_ROW_STYLE);
            return iconBuilder.build();
        }
    };
}
Also used : IModel(org.apache.wicket.model.IModel) CompositedIconColumn(com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconColumn) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 37 with CompositedIconBuilder

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

the class CreateTemplatePanel method createCompositedIcon.

// TODO copied from MainObjectListPanel
private CompositedIcon createCompositedIcon(CompiledObjectCollectionView collectionView) {
    DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getNewObjectDisplayTypeFromCollectionView(collectionView, getPageBase());
    CompositedIconBuilder builder = new CompositedIconBuilder();
    builder.setBasicIcon(WebComponentUtil.getIconCssClass(additionalButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(additionalButtonDisplayType));
    return builder.build();
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 38 with CompositedIconBuilder

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

the class InternalsLoggedInUsersPanel method initInlineMenu.

private List<InlineMenuItem> initInlineMenu() {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    menuItems.add(new ButtonInlineMenuItem(createStringResource("InternalsLoggedInUsers.refresh")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBean<F>>() {

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

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    return menuItems;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) 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 39 with CompositedIconBuilder

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

the class PageCases method createActions.

private List<InlineMenuItem> createActions() {
    List<InlineMenuItem> menu = new ArrayList<>();
    menu.add(new ButtonInlineMenuItem(createStringResource("pageCases.button.stopProcess")) {

        private static final long serialVersionUID = 1L;

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null && warnIfNoCaseSelected(target)) {
                        return;
                    }
                    if (getRowModel() == null) {
                        stopCaseProcessConfirmed(target);
                    } else {
                        stopCaseProcessConfirmed(target, Collections.singletonList(getRowModel().getObject().getValue()));
                    }
                }
            };
        }

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<SelectableBeanImpl<CaseType>> rowModel = ((ColumnMenuAction<SelectableBeanImpl<CaseType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getValue() != null) {
                return Model.of(!CaseTypeUtil.isClosed(rowModel.getObject().getValue()));
            } else {
                return super.getEnabled();
            }
        }

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

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return getTablePanel().getSelectedObjectsCount() > 0 ? createStringResource("pageCases.button.stopProcess.multiple.confirmationMessage", getTablePanel().getSelectedObjectsCount()) : createStringResource("pageCases.button.stopProcess.confirmationMessage");
        }
    });
    menu.add(new ButtonInlineMenuItem(createStringResource("pageCases.button.delete")) {

        private static final long serialVersionUID = 1L;

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null && warnIfNoCaseSelected(target)) {
                        return;
                    }
                    if (getRowModel() == null) {
                        deleteCaseObjectsConfirmed(target);
                    } else {
                        deleteCaseObjectsConfirmed(target, Collections.singletonList(getRowModel().getObject().getValue()));
                    }
                }
            };
        }

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

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<SelectableBeanImpl<CaseType>> rowModel = ((ColumnMenuAction<SelectableBeanImpl<CaseType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getValue() != null) {
                return Model.of(!CaseTypeUtil.isClosed(rowModel.getObject().getValue()));
            } else {
                return super.getEnabled();
            }
        }

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return getTablePanel().getSelectedObjectsCount() > 0 ? createStringResource("pageCases.button.delete.multiple.confirmationMessage", getTablePanel().getSelectedObjectsCount()) : createStringResource("pageCases.button.delete.confirmationMessage");
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) 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 40 with CompositedIconBuilder

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

the class FocusProjectionsPanel method createShadowMenu.

private List<InlineMenuItem> createShadowMenu() {
    List<InlineMenuItem> items = new ArrayList<>();
    PrismObjectDefinition<F> def = getObjectWrapperModel().getObject().getObject().getDefinition();
    PrismReferenceDefinition ref = def.findReferenceDefinition(UserType.F_LINK_REF);
    InlineMenuItem item;
    PrismPropertyDefinition<ActivationStatusType> administrativeStatus = def.findPropertyDefinition(SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS);
    if (administrativeStatus.canRead() && administrativeStatus.canModify()) {
        item = new ButtonInlineMenuItem(createStringResource("pageAdminFocus.button.enable")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new ColumnMenuAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        updateShadowActivation(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()), true);
                    }
                };
            }

            @Override
            public CompositedIconBuilder getIconCompositedBuilder() {
                return getDefaultCompositedIconBuilder("fa fa-check");
            }
        };
        items.add(item);
        item = new InlineMenuItem(createStringResource("pageAdminFocus.button.disable")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new ColumnMenuAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        updateShadowActivation(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()), false);
                    }
                };
            }
        };
        items.add(item);
    }
    if (ref.canRead() && ref.canAdd()) {
        item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlink")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new ColumnMenuAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        unlinkProjectionPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
                    }
                };
            }
        };
        items.add(item);
    }
    PrismPropertyDefinition<LockoutStatusType> locakoutStatus = def.findPropertyDefinition(SchemaConstants.PATH_ACTIVATION_LOCKOUT_STATUS);
    if (locakoutStatus.canRead() && locakoutStatus.canModify()) {
        item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlock")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new ColumnMenuAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        unlockShadowPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
                    }
                };
            }
        };
        items.add(item);
    }
    if (administrativeStatus.canRead() && administrativeStatus.canModify()) {
        // items.add(new InlineMenuItem());
        item = new InlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new ColumnMenuAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        deleteProjectionPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
                    }
                };
            }
        };
        items.add(item);
    }
    item = new ButtonInlineMenuItem(createStringResource("PageBase.button.edit")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    getMultivalueContainerListPanel().editItemPerformed(target, getRowModel(), getMultivalueContainerListPanel().getSelectedItems());
                    target.add(getPageBase().getFeedbackPanel());
                }
            };
        }
    };
    items.add(item);
    return items;
}
Also used : ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) 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) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

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