Search in sources :

Example 11 with CompositedIconBuilder

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

the class ReportOperationalButtonsPanel method initOperationalButtons.

private void initOperationalButtons(RepeatingView repeatingView) {
    String refreshId = repeatingView.newChildId();
    String showPreviewId = repeatingView.newChildId();
    String showPreviewInPopupId = repeatingView.newChildId();
    IconType iconType = new IconType();
    iconType.setCssClass("fa fa-address-card-o");
    CompositedIconBuilder iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-refresh", IconCssStyle.IN_ROW_STYLE).appendLayerIcon(iconType, IconCssStyle.BOTTOM_RIGHT_STYLE);
    AjaxCompositedIconButton refresh = new AjaxCompositedIconButton(refreshId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.refresh")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            ReportObjectsListPanel<?> table = getReportTable();
            table.getPageStorage().setSearch(null);
            table.resetSearchModel();
            table.resetTable(target);
            table.refreshTable(target);
            table.checkView();
            target.add(table);
            target.add(getTableBox());
            target.add(getTableContainer());
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    refresh.add(new VisibleBehaviour(isShowingPreview::getObject));
    refresh.add(AttributeAppender.append("class", "btn-default btn-sm"));
    refresh.setOutputMarkupId(true);
    repeatingView.add(refresh);
    iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-address-card-o", IconCssStyle.IN_ROW_STYLE);
    AjaxCompositedIconButton showPreview = new AjaxCompositedIconButton(showPreviewId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.showPreview.${}", isShowingPreview)) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            isShowingPreview.setObject(!isShowingPreview.getObject());
            ReportObjectsListPanel<?> table = getReportTable();
            if (isShowingPreview.getObject()) {
                table.getPageStorage().setSearch(null);
                table.resetSearchModel();
                table.resetTable(target);
                table.refreshTable(target);
                table.checkView();
            }
            target.add(getTableBox());
            if (isShowingPreview.getObject() && table.hasView()) {
                info(createStringResource("PageReport.message.shownedReportPreview").getString());
            }
            target.add(getTableContainer());
            target.add(this);
            target.add(repeatingView.get(showPreviewInPopupId));
            target.add(repeatingView.get(refreshId));
            target.add(ReportOperationalButtonsPanel.this);
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    showPreview.titleAsLabel(true);
    showPreview.add(new VisibleBehaviour(this::isCollectionReport));
    showPreview.add(AttributeAppender.append("class", "btn-default btn-sm"));
    showPreview.setOutputMarkupId(true);
    repeatingView.add(showPreview);
    iconType = new IconType();
    iconType.setCssClass("fa fa-window-maximize");
    iconBuilder = new CompositedIconBuilder().setBasicIcon("fa fa-address-card-o", IconCssStyle.IN_ROW_STYLE);
    // .appendLayerIcon(iconType, IconCssStyle.BOTTOM_RIGHT_STYLE);
    AjaxCompositedIconButton showPreviewInPopup = new AjaxCompositedIconButton(showPreviewInPopupId, iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.showPreviewInPopup")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            RunReportPopupPanel reportPopup = new RunReportPopupPanel(getPageBase().getMainPopupBodyId(), getReport(), false) {

                @Override
                public StringResourceModel getTitle() {
                    return createStringResource("PageReport.reportPreview");
                }
            };
            getPageBase().showMainPopup(reportPopup, target);
            target.add(ReportOperationalButtonsPanel.this);
        }
    };
    showPreviewInPopup.titleAsLabel(true);
    showPreviewInPopup.add(new VisibleBehaviour(() -> isCollectionReport() && !isShowingPreview.getObject()));
    showPreviewInPopup.add(AttributeAppender.append("class", "btn-default btn-sm"));
    showPreviewInPopup.setOutputMarkupId(true);
    repeatingView.add(showPreviewInPopup);
    iconBuilder = new CompositedIconBuilder().setBasicIcon(GuiStyleConstants.CLASS_START_MENU_ITEM, IconCssStyle.IN_ROW_STYLE);
    AjaxCompositedIconButton runReport = new AjaxCompositedIconButton(repeatingView.newChildId(), iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.runOriginalReport")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            runReportPerformed(target, getOriginalReport(), getPageBase());
        }
    };
    runReport.titleAsLabel(true);
    runReport.add(new VisibleBehaviour(() -> isEditObject() && !WebComponentUtil.isImportReport(getOriginalReport().asObjectable())));
    runReport.add(AttributeAppender.append("class", "btn-default btn-sm"));
    runReport.setOutputMarkupId(true);
    repeatingView.add(runReport);
    iconBuilder = new CompositedIconBuilder().setBasicIcon(GuiStyleConstants.CLASS_UPLOAD, IconCssStyle.IN_ROW_STYLE);
    AjaxCompositedIconButton importReport = new AjaxCompositedIconButton(repeatingView.newChildId(), iconBuilder.build(), createStringResource("pageCreateCollectionReport.button.importOriginalReport")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            importReportPerformed(target, getOriginalReport(), getPageBase());
        }
    };
    importReport.add(new VisibleBehaviour(() -> isEditObject() && WebComponentUtil.isImportReport(getOriginalReport().asObjectable())));
    importReport.add(AttributeAppender.append("class", "btn-default btn-sm"));
    importReport.setOutputMarkupId(true);
    repeatingView.add(importReport);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxCompositedIconButton(com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) RunReportPopupPanel(com.evolveum.midpoint.web.page.admin.reports.component.RunReportPopupPanel)

Example 12 with CompositedIconBuilder

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

the class ButtonInlineMenuItem method getDefaultCompositedIconBuilder.

protected CompositedIconBuilder getDefaultCompositedIconBuilder(String basicIcon) {
    CompositedIconBuilder builder = new CompositedIconBuilder();
    builder.setBasicIcon(basicIcon, IconCssStyle.IN_ROW_STYLE);
    return builder;
}
Also used : CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 13 with CompositedIconBuilder

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

the class PageCreateFromTemplate method loadButtonDescriptions.

protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
    return new LoadableModel<>(false) {

        @Override
        protected MultiFunctinalButtonDto load() {
            List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
            Collection<CompiledObjectCollectionView> compiledObjectCollectionViews = getCompiledGuiProfile().findAllApplicableArchetypeViews(getType(), OperationTypeType.ADD);
            if (CollectionUtils.isNotEmpty(compiledObjectCollectionViews)) {
                compiledObjectCollectionViews.forEach(collection -> {
                    CompositedIconButtonDto buttonDesc = new CompositedIconButtonDto();
                    buttonDesc.setCompositedIcon(createCompositedIcon(collection));
                    buttonDesc.setOrCreateDefaultAdditionalButtonDisplayType(collection.getDisplay());
                    buttonDesc.setCollectionView(collection);
                    additionalButtons.add(buttonDesc);
                });
            }
            if (isGenericNewButtonVisible()) {
                CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
                DisplayType defaultButtonDisplayType = getDefaultButtonDisplayType();
                defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
                CompositedIconBuilder defaultButtonIconBuilder = new CompositedIconBuilder();
                defaultButtonIconBuilder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType));
                defaultButton.setCompositedIcon(defaultButtonIconBuilder.build());
                additionalButtons.add(defaultButton);
            }
            MultiFunctinalButtonDto multifunctionalButton = new MultiFunctinalButtonDto();
            multifunctionalButton.setAdditionalButtons(additionalButtons);
            return multifunctionalButton;
        }
    };
}
Also used : CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ArrayList(java.util.ArrayList) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) MultiFunctinalButtonDto(com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)

Example 14 with CompositedIconBuilder

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

the class PageCreateFromTemplate method createCompositedIcon.

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

Example 15 with CompositedIconBuilder

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

the class PageValuePolicies method createInlineMenu.

private List<InlineMenuItem> createInlineMenu() {
    List<InlineMenuItem> menu = new ArrayList<>();
    menu.add(new ButtonInlineMenuItem(createStringResource("pageValuePolicies.button.delete")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        public InlineMenuItemAction initAction() {
            return null;
        }
    });
    return menu;
}
Also used : 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)

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