Search in sources :

Example 1 with DropdownButtonDto

use of com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto 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 2 with DropdownButtonDto

use of com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto in project midpoint by Evolveum.

the class InlineMenuHeaderColumn method getHeader.

@Override
public Component getHeader(String componentId) {
    DropdownButtonDto model = new DropdownButtonDto(null, null, null, menuItems);
    DropdownButtonPanel inlineMenu = new DropdownButtonPanel(componentId, model) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getSpecialButtonClass() {
            return "btn-xs btn-default";
        }
    };
    inlineMenu.setOutputMarkupPlaceholderTag(true);
    inlineMenu.setOutputMarkupId(true);
    return inlineMenu;
}
Also used : DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)

Example 3 with DropdownButtonDto

use of com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method createTracingOptionsPanel.

private void createTracingOptionsPanel() {
    List<InlineMenuItem> items = new ArrayList<>();
    items.add(new InlineMenuItem(createStringResource("Tracing")) {

        @Override
        public InlineMenuItemAction initAction() {
            return null;
        }
    });
    DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_TRACING_BUTTON_ICON, "Tracing", items);
    DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_TRACING, model) {

        @Override
        protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
            menuItem.add(createTracingRadioChoicesFragment(componentId));
        }

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

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

        @Override
        protected String getSpecialLabelClass() {
            return "execute-options-label";
        }
    };
    add(dropdownButtonPanel);
    dropdownButtonPanel.setOutputMarkupId(true);
    dropdownButtonPanel.add(new VisibleBehaviour(this::isTracingEnabled));
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) 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) ListItem(org.apache.wicket.markup.html.list.ListItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)

Example 4 with DropdownButtonDto

use of com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto in project midpoint by Evolveum.

the class MenuMultiButtonPanel method initLayout.

private void initLayout() {
    DropdownButtonPanel inlineMenu = new DropdownButtonPanel(ID_INLINE_MENU_PANEL, new DropdownButtonDto(null, null, null, menuItemsModel.getObject())) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getSpecialButtonClass() {
            return "btn-xs btn-default";
        }

        @Override
        protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
            MenuMultiButtonPanel.this.onBeforeClickMenuItem(target, action, item);
        }
    };
    add(inlineMenu);
    inlineMenu.add(new VisibleBehaviour(() -> {
        List<InlineMenuItem> menuItems = menuItemsModel.getObject();
        for (InlineMenuItem menuItem : menuItems) {
            if (!(menuItem instanceof ButtonInlineMenuItem)) {
                return true;
            }
        }
        return false;
    }));
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) List(java.util.List) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 5 with DropdownButtonDto

use of com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto in project midpoint by Evolveum.

the class DelegatedToMePanel method initLayout.

@Override
protected void initLayout() {
    final WebMarkupContainer assignments = new WebMarkupContainer(ID_ASSIGNMENTS);
    assignments.setOutputMarkupId(true);
    add(assignments);
    Label label = new Label(ID_HEADER, getLabel());
    assignments.add(label);
    DropdownButtonDto model = new DropdownButtonDto(null, null, null, createAssignmentMenu());
    DropdownButtonPanel assignmentMenu = new DropdownButtonPanel(ID_MENU, model) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getSpecialButtonClass() {
            return "btn-xs btn-default";
        }
    };
    assignmentMenu.setVisible(getAssignmentMenuVisibility());
    assignments.add(assignmentMenu);
    ListView<AssignmentEditorDto> list = new ListView<AssignmentEditorDto>(ID_LIST, getDelegatedToMeModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<AssignmentEditorDto> item) {
            DelegatedToMePanel.this.populateAssignmentDetailsPanel(item);
        }
    };
    list.setOutputMarkupId(true);
    assignments.add(list);
    AjaxCheckBox checkAll = new AjaxCheckBox(ID_CHECK_ALL, new Model()) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List<AssignmentEditorDto> assignmentsList = getDelegatedToMeModelObject();
            for (AssignmentEditorDto dto : assignmentsList) {
                dto.setSelected(this.getModelObject());
            }
            target.add(assignments);
        }
    };
    checkAll.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            int count = 0;
            for (AssignmentEditorDto dto : getDelegatedToMeModelObject()) {
                if (dto.isSimpleView()) {
                    count++;
                }
            }
            return count != getDelegatedToMeModelObject().size();
        }
    });
    assignments.add(checkAll);
}
Also used : AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) Label(org.apache.wicket.markup.html.basic.Label) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) UserDetailsModel(com.evolveum.midpoint.gui.impl.page.admin.user.UserDetailsModel) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ListItem(org.apache.wicket.markup.html.list.ListItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)

Aggregations

DropdownButtonDto (com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto)9 DropdownButtonPanel (com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)9 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)6 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)4 ListItem (org.apache.wicket.markup.html.list.ListItem)4 IModel (org.apache.wicket.model.IModel)4 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 Label (org.apache.wicket.markup.html.basic.Label)3 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)2 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)2 ArrayList (java.util.ArrayList)2 AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)2 ListView (org.apache.wicket.markup.html.list.ListView)2 Model (org.apache.wicket.model.Model)2 CheckBoxPanel (com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 UserDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.user.UserDetailsModel)1