Search in sources :

Example 16 with InlineMenuItem

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

the class ResourceContentPanel method initButton.

private void initButton(String id, String label, String icon, final String category, final List<TaskType> tasks) {
    List<InlineMenuItem> items = new ArrayList<>();
    InlineMenuItem item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.showExisting"), new InlineMenuItemAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            runTask(tasks, target);
        }
    });
    items.add(item);
    item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.newTask"), new InlineMenuItemAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            newTaskPerformed(category, target);
        }
    });
    items.add(item);
    DropdownButtonPanel button = new DropdownButtonPanel(id, new DropdownButtonDto(String.valueOf(tasks.size()), icon, label, items));
    add(button);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)

Example 17 with InlineMenuItem

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

the class PageConnectorHosts method initInlineHostsMenu.

private List<InlineMenuItem> initInlineHostsMenu() {
    List<InlineMenuItem> headerMenuItems = new ArrayList<>();
    headerMenuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            deleteHostPerformed(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageResources.button.discoveryRemote"), new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            discoveryRemotePerformed(target);
        }
    }));
    return headerMenuItems;
}
Also used : HeaderMenuAction(com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 18 with InlineMenuItem

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

the class PageResources method createRowMenuItems.

private List<InlineMenuItem> createRowMenuItems(boolean isHeader) {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    menuItems.add(new InlineMenuItem(createStringResource("PageResources.inlineMenuItem.test"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            testResourcePerformed(target, rowDto.getValue());
        }
    }, isHeader ? InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.HEADER_TEST_CONNECTION.getMenuItemId() : InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.TEST_CONNECTION.getMenuItemId(), GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO.toString()));
    menuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new Model<Boolean>(true), new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (getRowModel() == null) {
                deleteResourcePerformed(target, null);
            } else {
                SelectableBean<ResourceType> rowDto = getRowModel().getObject();
                deleteResourcePerformed(target, rowDto.getValue());
            }
        }
    }, isHeader ? InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.HEADER_DELETE.getMenuItemId() : InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.DELETE_RESOURCE.getMenuItemId(), GuiStyleConstants.CLASS_DELETE_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.DANGER.toString()));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.deleteSyncToken"), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            deleteResourceSyncTokenPerformed(target, rowDto.getValue());
        }
    }));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.editResource"), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            editResourcePerformed(rowDto.getValue());
        }
    }));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.button.editAsXml"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            editAsXmlPerformed(rowDto.getValue());
        }
    }, InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.EDIT_XML.getMenuItemId(), GuiStyleConstants.CLASS_EDIT_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO.toString()));
    return menuItems;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)

Example 19 with InlineMenuItem

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

the class PageRoles method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<RoleType> roleListPanel = new MainObjectListPanel<RoleType>(ID_TABLE, RoleType.class, TableId.TABLE_ROLES, null, this) {

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return listInlineMenuHelper.createRowActions(false);
        }

        @Override
        protected List<IColumn<SelectableBean<RoleType>, String>> createColumns() {
            return PageRoles.this.initColumns();
        }

        @Override
        protected IColumn<SelectableBean<RoleType>, String> createActionsColumn() {
            return PageRoles.this.createActionsColumn();
        }

        @Override
        protected void objectDetailsPerformed(AjaxRequestTarget target, RoleType object) {
            PageRoles.this.roleDetailsPerformed(target, object.getOid());
            ;
        }

        @Override
        protected void newObjectPerformed(AjaxRequestTarget target) {
            navigateToNext(PageRole.class);
        }
    };
    roleListPanel.setOutputMarkupId(true);
    roleListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_ROLE_BOX_CSS_CLASSES);
    mainForm.add(roleListPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 20 with InlineMenuItem

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

the class AssignmentCatalogPanel method addOrReplaceLayout.

public void addOrReplaceLayout(AjaxRequestTarget target, WebMarkupContainer panelContainer) {
    WebMarkupContainer treePanelContainer = new WebMarkupContainer(ID_TREE_PANEL_CONTAINER);
    treePanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(treePanelContainer);
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase)) && StringUtils.isNotEmpty(rootOid)) {
        // not let tree panel initializing in case of empty role catalog oid
        OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, Model.of(rootOid), false, "AssignmentShoppingCartPanel.treeTitle") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
                AssignmentCatalogPanel.this.selectTreeItemPerformed(selected, target);
            }

            protected List<InlineMenuItem> createTreeMenu() {
                return new ArrayList<>();
            }

            @Override
            protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
                return new ArrayList<>();
            }

            @Override
            protected OrgTreeStateStorage getOrgTreeStateStorage() {
                return getRoleCatalogStorage();
            }
        };
        treePanel.setOutputMarkupId(true);
        treePanelContainer.add(new AttributeAppender("class", "col-md-3"));
        treePanelContainer.add(new VisibleEnableBehaviour() {

            private static final long serialVersionUID = 1L;

            @Override
            public boolean isVisible() {
                return !isCatalogOidEmpty();
            }
        });
        treePanelContainer.addOrReplace(treePanel);
    } else {
        WebMarkupContainer treePanel = new WebMarkupContainer(ID_TREE_PANEL);
        treePanel.setVisible(false);
        treePanel.setOutputMarkupId(true);
        treePanelContainer.addOrReplace(treePanel);
    }
    WebMarkupContainer catalogItemsPanelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
    catalogItemsPanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(catalogItemsPanelContainer);
    String assignmentsOwnerName = getRoleCatalogStorage().getAssignmentsUserOwner() != null ? getRoleCatalogStorage().getAssignmentsUserOwner().getName().getOrig() : "";
    Label assignmentsOwnerLabel = new Label(ID_ASSIGNMENTS_OWNER_NAME, createStringResource("AssignmentCatalogPanel.assignmentsOwner", assignmentsOwnerName));
    assignmentsOwnerLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return AssignmentViewType.USER_TYPE.equals(getRoleCatalogStorage().getViewType());
        }
    });
    catalogItemsPanelContainer.add(assignmentsOwnerLabel);
    CatalogItemsPanel catalogItemsPanel;
    if (AssignmentViewType.USER_TYPE.equals(viewModel.getObject())) {
        PrismObject<UserType> assignmentsOwner = getRoleCatalogStorage().getAssignmentsUserOwner();
        listProviderData = new ArrayList<>();
        if (assignmentsOwner != null) {
            List<AssignmentType> assignments = assignmentsOwner.asObjectable().getAssignment();
            for (AssignmentType assignment : assignments) {
                if (assignment.getTargetRef() == null || !UserType.COMPLEX_TYPE.equals(assignment.getTargetRef().getType())) {
                    assignment.setId(null);
                    listProviderData.add(new AssignmentEditorDto(UserDtoStatus.MODIFY, assignment, pageBase));
                }
            }
            Collections.sort(listProviderData);
        }
        ListDataProvider listDataProvider = new ListDataProvider(this, Model.ofList(listProviderData));
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, pageBase, itemsPerRow, listDataProvider);
    } else {
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, selectedTreeItemOidModel, pageBase, itemsPerRow, objectProvider);
    }
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase))) {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-9"));
    } else {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-12"));
    }
    catalogItemsPanel.setOutputMarkupId(true);
    catalogItemsPanelContainer.addOrReplace(catalogItemsPanel);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgTreePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Aggregations

InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)45 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)36 ArrayList (java.util.ArrayList)24 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)11 HeaderMenuAction (com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction)11 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)10 IModel (org.apache.wicket.model.IModel)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)9 Form (org.apache.wicket.markup.html.form.Form)9 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)8 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)7 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)7 Label (org.apache.wicket.markup.html.basic.Label)7 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)7 Model (org.apache.wicket.model.Model)7 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)5 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3