Search in sources :

Example 81 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class SingleButtonPanel method initLayout.

private void initLayout() {
    AjaxButton button = new AjaxButton(ID_BUTTON, createButtonStringResource(getCaption())) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            clickPerformed(target, SingleButtonPanel.this.getModel());
        }

        @Override
        public boolean isEnabled() {
            return SingleButtonPanel.this.isEnabled(SingleButtonPanel.this.getModel());
        }

        @Override
        public boolean isVisible() {
            return SingleButtonPanel.this.isVisible(SingleButtonPanel.this.getModel());
        }
    };
    button.add(new AttributeAppender("class", getButtonCssClass()));
    add(button);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 82 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class TableConfigurationPanel method initPopoverLayout.

private void initPopoverLayout() {
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    Form form = new Form(ID_FORM);
    popover.add(form);
    AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(TableConfigurationPanel.this.get(createComponentPath(ID_POPOVER, ID_FORM, "inputFeedback")));
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            pageSizeChanged(target);
        }
    };
    form.add(button);
    TextField input = new TextField(ID_INPUT, createInputModel());
    input.add(new RangeValidator(5, 100));
    input.setLabel(createStringResource("PageSizePopover.title"));
    input.add(new SearchFormEnterBehavior(button));
    input.setType(Integer.class);
    input.setOutputMarkupId(true);
    FeedbackPanel feedback = new FeedbackPanel("inputFeedback", new ComponentFeedbackMessageFilter(input));
    feedback.setOutputMarkupId(true);
    form.add(feedback);
    form.add(input);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SearchFormEnterBehavior(com.evolveum.midpoint.web.util.SearchFormEnterBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) Form(org.apache.wicket.markup.html.form.Form) TextField(org.apache.wicket.markup.html.form.TextField) RangeValidator(org.apache.wicket.validation.validator.RangeValidator) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 83 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class InfoBoxPanel method initLayout.

private void initLayout(final IModel<InfoBoxType> model, final Class<? extends IRequestablePage> linkPage) {
    WebMarkupContainer infoBox = new WebMarkupContainer(ID_INFO_BOX);
    add(infoBox);
    infoBox.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.BOX_BACKGROUND_COLOR)));
    WebMarkupContainer infoBoxIcon = new WebMarkupContainer(ID_INFO_BOX_ICON);
    infoBox.add(infoBoxIcon);
    infoBoxIcon.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.ICON_BACKGROUND_COLOR)));
    WebMarkupContainer image = new WebMarkupContainer(ID_IMAGE_ID);
    image.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.IMAGE_ID)));
    infoBoxIcon.add(image);
    Label message = new Label(ID_MESSAGE, new PropertyModel<String>(model, InfoBoxType.MESSAGE));
    infoBox.add(message);
    Label number = new Label(ID_NUMBER, new PropertyModel<String>(model, InfoBoxType.NUMBER));
    infoBox.add(number);
    WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
    infoBox.add(progress);
    progress.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return model.getObject().getProgress() != null;
        }
    });
    ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<Integer>(model, InfoBoxType.PROGRESS));
    progress.add(progressBar);
    Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
    infoBox.add(description);
    if (linkPage != null) {
        add(new AjaxEventBehavior("click") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                setResponsePage(linkPage);
            }
        });
    }
}
Also used : AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) PropertyModel(org.apache.wicket.model.PropertyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ProgressbarPanel(com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 84 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class MultiButtonPanel method initLayout.

protected void initLayout() {
    RepeatingView buttons = new RepeatingView(ID_BUTTONS);
    add(buttons);
    for (int id = 0; id < numberOfButtons; id++) {
        final int finalId = getButtonId(id);
        AjaxButton button = new AjaxButton(String.valueOf(finalId), createStringResource(getCaption(finalId))) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                clickPerformed(finalId, target, MultiButtonPanel.this.getModel());
            }

            @Override
            protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
                super.updateAjaxAttributes(attributes);
                attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
            }

            @Override
            public boolean isEnabled() {
                return MultiButtonPanel.this.isButtonEnabled(finalId, MultiButtonPanel.this.getModel());
            }

            @Override
            public boolean isVisible() {
                return MultiButtonPanel.this.isButtonVisible(finalId, MultiButtonPanel.this.getModel());
            }
        };
        button.add(new AttributeAppender("class", getButtonCssClass(finalId)));
        button.add(new AttributeAppender("title", getButtonTitle(finalId)));
        buttons.add(button);
        buttons.add(new Label("label" + finalId, " "));
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) Label(org.apache.wicket.markup.html.basic.Label) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 85 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class TablePanel method initLayout.

private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, long pageSize) {
    DataTable<T, String> table = new SelectableDataTable<>(ID_TABLE, columns, provider, (int) pageSize);
    table.setOutputMarkupId(true);
    TableHeadersToolbar headers = new TableHeadersToolbar(table, provider);
    headers.setOutputMarkupId(true);
    table.addTopToolbar(headers);
    CountToolbar count = new CountToolbar(table) {

        @Override
        protected void pageSizeChanged(AjaxRequestTarget target) {
            PageBase page = (PageBase) getPage();
            Integer pageSize = page.getSessionStorage().getUserProfile().getPagingSize(tableId);
            setItemsPerPage(pageSize);
            target.add(getNavigatorPanel());
            target.add(getDataTable());
        }

        @Override
        protected boolean isPageSizePopupVisible() {
            return tableId != null;
        }
    };
    addVisibleBehaviour(count, showCount);
    table.addBottomToolbar(count);
    add(table);
    NavigatorPanel nb2 = new NavigatorPanel(ID_PAGING, table, showPagedPagingModel(provider));
    addVisibleBehaviour(nb2, showPaging);
    add(nb2);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Aggregations

AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)393 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)116 Label (org.apache.wicket.markup.html.basic.Label)108 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)105 ArrayList (java.util.ArrayList)91 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)82 Form (org.apache.wicket.markup.html.form.Form)78 IModel (org.apache.wicket.model.IModel)73 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)71 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)65 List (java.util.List)56 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)48 ListItem (org.apache.wicket.markup.html.list.ListItem)43 Model (org.apache.wicket.model.Model)43 PropertyModel (org.apache.wicket.model.PropertyModel)42 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)37 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)34 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)34 ListView (org.apache.wicket.markup.html.list.ListView)32 TextField (org.apache.wicket.markup.html.form.TextField)30