Search in sources :

Example 1 with CheckBoxPanel

use of com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel in project midpoint by Evolveum.

the class ApplicablePolicyGroupPanel method initLayout.

private void initLayout() {
    Label policyGroupName = new Label(ID_POLICY_GROUP_NAME, Model.of(WebComponentUtil.getDisplayNameOrName(getModelObject(), getPageBase(), OPERATION_LOAD_POLICY_GROUP_NAME)));
    policyGroupName.setOutputMarkupId(true);
    add(policyGroupName);
    ListView<PrismObject<AbstractRoleType>> policiesPanel = new ListView<PrismObject<AbstractRoleType>>(ID_POLICIES_CONTAINER, policiesListModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<PrismObject<AbstractRoleType>> listItem) {
            PrismObject<AbstractRoleType> abstractRole = listItem.getModelObject();
            CheckBoxPanel policyCheckBox = new CheckBoxPanel(ID_POLICY_CHECK_BOX, getCheckboxModel(abstractRole), // label
            Model.of(WebComponentUtil.getDisplayNameOrName(abstractRole)), // tooltip
            null) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onUpdate(AjaxRequestTarget target) {
                    onPolicyAddedOrRemoved(listItem.getModelObject(), getValue());
                }
            };
            policyCheckBox.setOutputMarkupId(true);
            listItem.add(policyCheckBox);
        }
    };
    policiesPanel.setOutputMarkupId(true);
    add(policiesPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismObject(com.evolveum.midpoint.prism.PrismObject) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) AbstractRoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType) ListItem(org.apache.wicket.markup.html.list.ListItem) CheckBoxPanel(com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)

Example 2 with CheckBoxPanel

use of com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel 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 3 with CheckBoxPanel

use of com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel in project midpoint by Evolveum.

the class OrgTreeFolderContent method initLayout.

private void initLayout() {
    SelectableFolderContent folder = new SelectableFolderContent(ID_FOLDER, tree, getModel(), selected) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onClick(Optional<AjaxRequestTarget> target) {
            super.onClick(target);
            OrgTreeFolderContent.this.setSelectedItem(selected.getObject(), orgTreeStorage);
            selectTreeItemPerformed(selected.getObject(), target.get());
            Component component = get("table");
            if (component != null) {
                target.get().add(component);
            }
        }
    };
    folder.setOutputMarkupId(true);
    addOrReplace(folder);
    if (selected.getObject().equals(getModelObject())) {
        getParent().add(AttributeAppender.append("class", "success"));
    } else {
        getParent().add(new AttributeAppender("class", "success", " ") {

            @Override
            protected Serializable newValue(String currentValue, String removeValue) {
                currentValue = getSeparator() + currentValue + getSeparator();
                removeValue = getSeparator() + removeValue + getSeparator();
                return currentValue.replace(removeValue, getSeparator());
            }
        });
    }
    MenuMultiButtonPanel<OrgType> menuButtons = new MenuMultiButtonPanel<>(ID_MENU, new PropertyModel<>(getModel(), TreeSelectableBean.F_VALUE), 2, createInlineMenuItemsModel());
    menuButtons.setOutputMarkupId(true);
    addOrReplace(menuButtons);
    CheckBoxPanel checkBoxPanel = new CheckBoxPanel(ID_CHECK, getCheckboxModel(getModel())) {

        @Override
        public void onUpdate(AjaxRequestTarget target) {
            getModelObject().setSelected(!getModelObject().isSelected());
            OrgTreeFolderContent.this.onUpdateCheckbox(target);
        }
    };
    checkBoxPanel.add(new VisibleBehaviour(() -> selectable));
    addOrReplace(checkBoxPanel);
}
Also used : SelectableFolderContent(com.evolveum.midpoint.web.page.admin.users.component.SelectableFolderContent) Serializable(java.io.Serializable) MenuMultiButtonPanel(com.evolveum.midpoint.web.component.data.MenuMultiButtonPanel) Optional(java.util.Optional) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CheckBoxPanel(com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) Component(org.apache.wicket.Component) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 4 with CheckBoxPanel

use of com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method createContainer.

private void createContainer(String containerId, IModel<Boolean> checkboxModel, String labelKey, String helpKey, boolean show, final boolean reloadPanelOnUpdate) {
    CheckBoxPanel panel = new CheckBoxPanel(containerId, checkboxModel, createStringResource(labelKey), createStringResource(helpKey, WebComponentUtil.getMidpointCustomSystemName(getPageBase(), "midPoint"))) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onUpdate(AjaxRequestTarget target) {
            if (reloadPanelOnUpdate) {
                target.add(ExecuteChangeOptionsPanel.this);
                reloadPanelOnOptionsUpdate(target);
            }
        }

        @Override
        protected boolean isCheckboxEnabled() {
            return isCheckBoxEnabled(containerId);
        }
    };
    panel.setOutputMarkupId(true);
    panel.setVisible(show);
    add(panel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBoxPanel(com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)

Aggregations

CheckBoxPanel (com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 ListItem (org.apache.wicket.markup.html.list.ListItem)2 DropdownButtonDto (com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto)1 DropdownButtonPanel (com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 MenuMultiButtonPanel (com.evolveum.midpoint.web.component.data.MenuMultiButtonPanel)1 CheckboxMenuItem (com.evolveum.midpoint.web.component.menu.cog.CheckboxMenuItem)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 SelectableFolderContent (com.evolveum.midpoint.web.page.admin.users.component.SelectableFolderContent)1 AbstractRoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType)1 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)1 Serializable (java.io.Serializable)1 Optional (java.util.Optional)1 Component (org.apache.wicket.Component)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 Label (org.apache.wicket.markup.html.basic.Label)1 ListView (org.apache.wicket.markup.html.list.ListView)1