Search in sources :

Example 1 with CheckboxMenuItem

use of com.evolveum.midpoint.web.component.menu.cog.CheckboxMenuItem 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)

Aggregations

DropdownButtonDto (com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto)1 DropdownButtonPanel (com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)1 CheckBoxPanel (com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)1 CheckboxMenuItem (com.evolveum.midpoint.web.component.menu.cog.CheckboxMenuItem)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 ListItem (org.apache.wicket.markup.html.list.ListItem)1