Search in sources :

Example 76 with VisibleEnableBehaviour

use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.

the class RoleMemberPanel method initSearch.

@Override
protected void initSearch(Form form) {
    List<QName> allowedTypes = WebComponentUtil.createFocusTypeList();
    allowedTypes.add(FocusType.COMPLEX_TYPE);
    DropDownChoice<QName> typeSelect = createDropDown(ID_OBJECT_TYPE, Model.of(FocusType.COMPLEX_TYPE), allowedTypes, new QNameChoiceRenderer());
    add(typeSelect);
    DropDownChoice<OrgType> tenant = createDropDown(ID_TENANT, new Model(), createTenantList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(tenant);
    tenant.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    DropDownChoice<OrgType> project = createDropDown(ID_PROJECT, new Model(), createProjectList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(project);
    project.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    CheckBoxPanel includeIndirectMembers = new CheckBoxPanel(ID_INDIRECT_MEMBERS, new Model<Boolean>(false)) {

        private static final long serialVersionUID = 1L;

        public void onUpdate(AjaxRequestTarget target) {
            refreshTable(target);
        }
    };
    add(includeIndirectMembers);
    // TODO shouldn't we hide also the label?
    includeIndirectMembers.add(new VisibleBehaviour(this::isRole));
}
Also used : QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) CheckBoxPanel(com.evolveum.midpoint.web.component.data.column.CheckBoxPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 77 with VisibleEnableBehaviour

use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.

the class SynchronizationInformationPanel method initLayout.

protected void initLayout(final boolean useAfter) {
    WebMarkupContainer titleBefore = new WebMarkupContainer(ID_TITLE_BEFORE);
    titleBefore.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !useAfter;
        }
    });
    add(titleBefore);
    WebMarkupContainer titleAfter = new WebMarkupContainer(ID_TITLE_AFTER);
    titleAfter.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return useAfter;
        }
    });
    add(titleAfter);
    Label aProtected = new Label(ID_PROTECTED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_PROTECTED));
    add(aProtected);
    Label noSync = new Label(ID_NO_SYNCHRONIZATION_POLICY, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_NO_SYNCHRONIZATION_POLICY));
    add(noSync);
    Label syncDisabled = new Label(ID_SYNCHRONIZATION_DISABLED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_SYNCHRONIZATION_DISABLED));
    add(syncDisabled);
    Label notAppl = new Label(ID_NOT_APPLICABLE_FOR_TASK, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_NOT_APPLICABLE_FOR_TASK));
    add(notAppl);
    Label deleted = new Label(ID_DELETED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_DELETED));
    add(deleted);
    Label disputed = new Label(ID_DISPUTED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_DISPUTED));
    add(disputed);
    Label linked = new Label(ID_LINKED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_LINKED));
    add(linked);
    Label unlinked = new Label(ID_UNLINKED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_UNLINKED));
    add(unlinked);
    Label unmatched = new Label(ID_UNMATCHED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_UNMATCHED));
    add(unmatched);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 78 with VisibleEnableBehaviour

use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.

the class AssignmentEditorPanel method addRelationDropDown.

private void addRelationDropDown(WebMarkupContainer relationContainer) {
    List<RelationTypes> availableRelations = getModelObject().getNotAssignedRelationsList();
    DropDownChoicePanel relation = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION, getModelObject().isMultyAssignable() ? WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class) : Model.ofList(availableRelations), getRelationModel(availableRelations), this, false);
    relation.setEnabled(getModel().getObject().isEditable());
    relation.setOutputMarkupId(true);
    relation.setOutputMarkupPlaceholderTag(true);
    relation.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isCreatingNewAssignment();
        }
    });
    relationContainer.add(relation);
}
Also used : DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 79 with VisibleEnableBehaviour

use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.

the class LockoutStatusPanel method initLayout.

private void initLayout(final IModel<LockoutStatusType> model) {
    WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
    add(container);
    Label label = new Label(ID_LABEL, new IModel<String>() {

        @Override
        public String getObject() {
            LockoutStatusType object = model != null ? model.getObject() : null;
            String labelValue = object == null ? ((PageBase) getPage()).createStringResource("LockoutStatusType.UNDEFINED").getString() : WebComponentUtil.createLocalizedModelForEnum(object, getLabel()).getObject();
            if (!isInitialState) {
                labelValue += " " + ((PageBase) getPage()).createStringResource("LockoutStatusPanel.changesSaving").getString();
            }
            return labelValue;
        }

        @Override
        public void setObject(String s) {
        }

        @Override
        public void detach() {
        }
    });
    label.setOutputMarkupId(true);
    container.add(label);
    AjaxButton button = new AjaxButton(ID_BUTTON, getButtonModel()) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            PrismPropertyValue oldValue = (PrismPropertyValue) valueWrapper.getOldValue();
            if (!isInitialState) {
                model.setObject(initialValue);
                oldValue.setValue(initialValue);
                valueWrapper.setStatus(ValueStatus.NOT_CHANGED);
            } else {
                model.setObject(LockoutStatusType.NORMAL);
                if (oldValue.getValue() != null) {
                    oldValue.setValue(null);
                }
            }
            isInitialState = !isInitialState;
            ajaxRequestTarget.add(getButton());
            ajaxRequestTarget.add(getLabel());
        }
    };
    button.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return true;
        }
    });
    button.setOutputMarkupId(true);
    container.add(button);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Label(org.apache.wicket.markup.html.basic.Label) LockoutStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue)

Example 80 with VisibleEnableBehaviour

use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.

the class AssignmentCatalogPanel method initSearchPanel.

private void initSearchPanel(WebMarkupContainer headerPanel) {
    final Form searchForm = new Form(ID_SEARCH_FORM);
    headerPanel.add(searchForm);
    searchForm.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return !isCatalogOidEmpty() && !AssignmentViewType.USER_TYPE.equals(getRoleCatalogStorage().getViewType());
        }
    });
    searchForm.setOutputMarkupId(true);
    SearchPanel search = new SearchPanel(ID_SEARCH, (IModel) searchModel, false) {

        private static final long serialVersionUID = 1L;

        @Override
        public void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
            AssignmentCatalogPanel.this.searchPerformed(query, target);
        }
    };
    searchForm.add(search);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Form(org.apache.wicket.markup.html.form.Form) SearchPanel(com.evolveum.midpoint.web.component.search.SearchPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)183 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)116 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)101 Label (org.apache.wicket.markup.html.basic.Label)89 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)51 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)44 List (java.util.List)32 ListItem (org.apache.wicket.markup.html.list.ListItem)29 PropertyModel (org.apache.wicket.model.PropertyModel)29 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)26 ArrayList (java.util.ArrayList)25 Form (org.apache.wicket.markup.html.form.Form)25 ListView (org.apache.wicket.markup.html.list.ListView)25 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)23 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)19 AttributeModifier (org.apache.wicket.AttributeModifier)18 IModel (org.apache.wicket.model.IModel)17 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)16 TextField (org.apache.wicket.markup.html.form.TextField)16 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)15