Search in sources :

Example 91 with InlineMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.

the class GlobalPolicyRuleTabPanel method initBasicColumns.

private List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> initBasicColumns() {
    List<IColumn<PrismContainerValueWrapper<GlobalPolicyRuleType>, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxHeaderColumn<>());
    PrismPropertyWrapperColumn<GlobalPolicyRuleType, String> linkColumn = new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_NAME, ColumnType.LINK, getPageBase()) {

        @Override
        protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
            getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
        }

        protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<GlobalPolicyRuleType>> rowModel) {
            return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
        }
    };
    columns.add(linkColumn);
    columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_CONSTRAINTS, getPageBase()));
    columns.add(new PrismContainerWrapperColumn<>(getModel(), GlobalPolicyRuleType.F_POLICY_ACTIONS, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<GlobalPolicyRuleType, String>(getModel(), GlobalPolicyRuleType.F_POLICY_SITUATION, ColumnType.STRING, getPageBase()));
    List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
    columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return " col-md-1 ";
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) GlobalPolicyRuleType(com.evolveum.midpoint.xml.ns._public.common.common_3.GlobalPolicyRuleType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 92 with InlineMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method createOptionsDropdownButton.

private void createOptionsDropdownButton(List<InlineMenuItem> items) {
    DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_OPTIONS_BUTTON_ICON, getPageBase().createStringResource("ExecuteChangeOptionsPanel.options").getString(), items);
    DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_OPTIONS, model) {

        @Override
        protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
            InlineMenuItem item = menuItem.getModelObject();
            if (!(item instanceof CheckboxMenuItem)) {
                super.populateMenuItem(componentId, menuItem);
                return;
            }
            CheckboxMenuItem checkboxMenuItem = (CheckboxMenuItem) item;
            CheckBoxPanel panel = new CheckBoxPanel(componentId, checkboxMenuItem.getCheckBoxModel(), checkboxMenuItem.getLabel(), null) {

                @Override
                public void onUpdate(AjaxRequestTarget target) {
                // checkboxMenuItem.getCheckBoxModel().setObject(!checkboxMenuItem.getCheckBoxModel().getObject());
                }
            };
            panel.setOutputMarkupId(true);
            menuItem.add(panel);
        }

        @Override
        protected String getSpecialButtonClass() {
            return "btn-sm btn-default btn-margin-right";
        }

        @Override
        protected String getSpecialDropdownMenuClass() {
            return "execute-options";
        }

        @Override
        protected String getSpecialLabelClass() {
            return "execute-options-label";
        }
    };
    add(dropdownButtonPanel);
    dropdownButtonPanel.setOutputMarkupId(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) CheckboxMenuItem(com.evolveum.midpoint.web.component.menu.cog.CheckboxMenuItem) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ListItem(org.apache.wicket.markup.html.list.ListItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel) CheckBoxPanel(com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)

Example 93 with InlineMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.

the class PageCreatedReports method initInlineMenu.

private List<InlineMenuItem> initInlineMenu() {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    // menuItems.add(new InlineMenuItem(createStringResource("pageCreatedReports.inlineMenu.deleteAll")) {
    // private static final long serialVersionUID = 1L;
    // 
    // @Override
    // public InlineMenuItemAction initAction() {
    // return new HeaderMenuAction(PageCreatedReports.this) {
    // private static final long serialVersionUID = 1L;
    // 
    // @Override
    // public void onClick(AjaxRequestTarget target) {
    // deleteAllPerformed(target, ReportDeleteDialogDto.Operation.DELETE_ALL);
    // }
    // };
    // }
    // });
    menuItems.add(new ButtonInlineMenuItem(createStringResource("pageCreatedReports.button.delete")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportDataType report = null;
                    if (getRowModel() != null) {
                        SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
                        report = rowDto.getValue();
                    }
                    deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SELECTED, report);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder("fa fa-minus");
        }
    });
    boolean canViewTraces;
    boolean canReadTraces;
    try {
        canReadTraces = isAuthorized(ModelAuthorizationAction.READ_TRACE.getUrl());
    } catch (Throwable t) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't authorize reading traces", t);
        canReadTraces = false;
    }
    canViewTraces = canReadTraces && WebModelServiceUtils.isEnableExperimentalFeature(this);
    ButtonInlineMenuItem item = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.download")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
                    currentReport = rowDto.getValue();
                    downloadPerformed(target, ajaxDownloadBehavior);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder("fa fa-download");
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    if (!canReadTraces) {
        item.setVisibilityChecker((rowModel, isHeader) -> !isTrace(rowModel));
    }
    menuItems.add(item);
    ButtonInlineMenuItem viewTraceItem = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.viewTrace")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
                    currentReport = rowDto.getValue();
                    PageParameters parameters = new PageParameters();
                    parameters.add(PageTraceView.PARAM_OBJECT_ID, currentReport.getOid());
                    navigateToNext(PageTraceView.class, parameters);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder("fa fa-eye");
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    menuItems.add(viewTraceItem);
    viewTraceItem.setVisibilityChecker((rowModel, isHeader) -> canViewTraces && isTrace(rowModel));
    return menuItems;
}
Also used : SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) 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)

Example 94 with InlineMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.

the class PageReports method createInlineMenu.

private List<InlineMenuItem> createInlineMenu() {
    List<InlineMenuItem> menu = new ArrayList<>();
    ButtonInlineMenuItem runButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.run")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType report = getRowModel().getObject().getValue();
                    com.evolveum.midpoint.web.page.admin.reports.PageReport.runReportPerformed(target, report.asPrismObject(), PageReports.this);
                }
            };
        }

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

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    runButton.setVisibilityChecker((rowModel, isHeader) -> !isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
    menu.add(runButton);
    ButtonInlineMenuItem importButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.import")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType report = getRowModel().getObject().getValue();
                    com.evolveum.midpoint.web.page.admin.reports.PageReport.importReportPerformed(target, report.asPrismObject(), PageReports.this);
                }
            };
        }

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

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    importButton.setVisibilityChecker((rowModel, isHeader) -> isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
    menu.add(importButton);
    menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.configure")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType reportObject = getRowModel().getObject().getValue();
                    configurePerformed(target, reportObject);
                }
            };
        }

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

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.showOutput")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType reportObject = getRowModel().getObject().getValue();
                    PageParameters pageParameters = new PageParameters();
                    pageParameters.add(OnePageParameterEncoder.PARAMETER, reportObject.getOid());
                    navigateToNext(PageCreatedReports.class, pageParameters);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder("fa fa-files-o");
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) ArrayList(java.util.ArrayList) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) 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) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 95 with InlineMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.

the class PageReports method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<ReportType> table = new MainObjectListPanel<ReportType>(ID_TABLE, ReportType.class) {

        private static final long serialVersionUID = 1L;

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.PAGE_REPORTS;
        }

        @Override
        protected List<IColumn<SelectableBean<ReportType>, String>> createDefaultColumns() {
            return ColumnUtils.getDefaultObjectColumns();
        }

        @Override
        protected IColumn<SelectableBean<ReportType>, String> createCheckboxColumn() {
            return null;
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return PageReports.this.createInlineMenu();
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Aggregations

InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)114 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)82 ArrayList (java.util.ArrayList)68 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)47 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)43 IModel (org.apache.wicket.model.IModel)41 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)35 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)30 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)26 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)25 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)24 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)19 Label (org.apache.wicket.markup.html.basic.Label)18 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)17 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)15 Form (org.apache.wicket.markup.html.form.Form)15 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)13 HeaderMenuAction (com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction)13 ListItem (org.apache.wicket.markup.html.list.ListItem)12 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11