Search in sources :

Example 56 with VisibleEnableBehaviour

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

the class NavigatorPanel method initNavigation.

private void initNavigation() {
    IModel<Integer> model = new AbstractReadOnlyModel<Integer>() {

        @Override
        public Integer getObject() {
            int count = (int) pageable.getPageCount();
            if (count < PAGING_SIZE) {
                return count;
            }
            return PAGING_SIZE;
        }
    };
    Loop navigation = new Loop(ID_NAVIGATION, model) {

        @Override
        protected void populateItem(final LoopItem item) {
            final NavigatorPageLink pageLink = new NavigatorPageLink(ID_PAGE_LINK, computePageNumber(item.getIndex())) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    pageLinkPerformed(target, getPageNumber());
                }
            };
            item.add(pageLink);
            item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return pageable.getCurrentPage() == pageLink.getPageNumber() ? "active" : "";
                }
            }));
        }
    };
    navigation.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return BooleanUtils.isTrue(showPageListingModel.getObject());
        }
    });
    add(navigation);
}
Also used : Loop(org.apache.wicket.markup.html.list.Loop) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) LoopItem(org.apache.wicket.markup.html.list.LoopItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeModifier(org.apache.wicket.AttributeModifier)

Example 57 with VisibleEnableBehaviour

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

the class NavigatorPanel method initPrevious.

private void initPrevious() {
    WebMarkupContainer previous = new WebMarkupContainer(ID_PREVIOUS);
    previous.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isPreviousEnabled() ? "" : "disabled";
        }
    }));
    add(previous);
    AjaxLink previousLink = new AjaxLink(ID_PREVIOUS_LINK) {

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            previousPerformed(target);
        }
    };
    previousLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return isPreviousEnabled();
        }
    });
    previous.add(previousLink);
}
Also used : AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) AjaxChannel(org.apache.wicket.ajax.AjaxChannel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeModifier(org.apache.wicket.AttributeModifier) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 58 with VisibleEnableBehaviour

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

the class NavigatorPanel method initNext.

private void initNext() {
    WebMarkupContainer next = new WebMarkupContainer(ID_NEXT);
    next.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isNextEnabled() ? "" : "disabled";
        }
    }));
    add(next);
    AjaxLink nextLink = new AjaxLink(ID_NEXT_LINK) {

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            nextPerformed(target);
        }
    };
    nextLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return isNextEnabled();
        }
    });
    next.add(nextLink);
}
Also used : AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) AjaxChannel(org.apache.wicket.ajax.AjaxChannel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeModifier(org.apache.wicket.AttributeModifier) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 59 with VisibleEnableBehaviour

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

the class TargetUserSelectorComponent method initLayout.

private void initLayout() {
    AjaxLink<String> targetUserButton = new AjaxLink<String>(ID_TARGET_USER_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (showUserSelectionPopup) {
                initUserSelectionPopup(createStringResource("AssignmentCatalogPanel.selectTargetUser"), true, target);
            }
            showUserSelectionPopup = true;
        }
    };
    targetUserButton.add(new AttributeAppender("class", "btn btn-default" + (StringUtils.isEmpty(additionalButtonStyle) ? "" : " " + additionalButtonStyle)));
    targetUserButton.setOutputMarkupId(true);
    targetUserButton.add(new AttributeAppender("title", getTargetUsersButtonTitle()));
    add(targetUserButton);
    Label label = new Label(ID_TARGET_USER_LABEL, createStringResource("AssignmentCatalogPanel.selectTargetUser"));
    label.setRenderBodyOnly(true);
    targetUserButton.add(label);
    AjaxLink deleteButton = new AjaxLink(ID_DELETE_TARGET_USER_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            showUserSelectionPopup = false;
            getRoleCatalogStorage().setTargetUserList(null);
            target.add(pageBase);
        }
    };
    deleteButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return getRoleCatalogStorage().getTargetUserList() != null && getRoleCatalogStorage().getTargetUserList().size() > 0;
        }
    });
    targetUserButton.add(deleteButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 60 with VisibleEnableBehaviour

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

the class RunReportPopupPanel method createInputMarkup.

private WebMarkupContainer createInputMarkup(final IModel<JasperReportValueDto> valueModel, JasperReportParameterDto param) {
    param.setEditing(true);
    WebMarkupContainer paramValueMarkup = new WebMarkupContainer("valueMarkup");
    paramValueMarkup.setOutputMarkupId(true);
    InputPanel input = createTypedInputPanel("inputValue", valueModel, "value", param);
    paramValueMarkup.add(input);
    //buttons
    AjaxLink<String> addButton = new AjaxLink<String>(ID_ADD_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValue(paramValueMarkup, param, target);
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isAddButtonVisible(param);
        }
    });
    paramValueMarkup.add(addButton);
    AjaxLink<String> removeButton = new AjaxLink<String>(ID_REMOVE_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            removeValue(paramValueMarkup, param, valueModel.getObject(), target);
        }
    };
    removeButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isRemoveButtonVisible();
        }
    });
    paramValueMarkup.add(removeButton);
    return paramValueMarkup;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

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