Search in sources :

Example 1 with AjaxFallbackLink

use of org.apache.wicket.ajax.markup.html.AjaxFallbackLink in project midpoint by Evolveum.

the class WorkItemPanel method initLayout.

protected void initLayout(Form mainForm, PageBase pageBase) {
    WebMarkupContainer additionalInfoColumn = new WebMarkupContainer(ID_ADDITIONAL_INFO_COLUMN);
    WebMarkupContainer historyContainer = new WebMarkupContainer(ID_HISTORY_CONTAINER);
    historyContainer.add(new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(getModel(), WorkItemDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL, (int) pageBase.getItemsPerPage(UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL)));
    final VisibleEnableBehaviour historyContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().hasHistory();
        }
    };
    historyContainer.add(historyContainerVisible);
    historyContainer.add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
    additionalInfoColumn.add(historyContainer);
    WebMarkupContainer relatedWorkItemsContainer = new WebMarkupContainer(ID_RELATED_WORK_ITEMS_CONTAINER);
    final IModel<List<WorkItemDto>> relatedWorkItemsModel = new PropertyModel<>(getModel(), WorkItemDto.F_OTHER_WORK_ITEMS);
    final ISortableDataProvider<WorkItemDto, String> relatedWorkItemsProvider = new ListDataProvider<>(this, relatedWorkItemsModel);
    relatedWorkItemsContainer.add(new WorkItemsPanel(ID_RELATED_WORK_ITEMS, relatedWorkItemsProvider, null, 10, WorkItemsPanel.View.ITEMS_FOR_PROCESS));
    final VisibleEnableBehaviour relatedWorkItemsContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !relatedWorkItemsModel.getObject().isEmpty();
        }
    };
    relatedWorkItemsContainer.add(relatedWorkItemsContainerVisible);
    relatedWorkItemsContainer.add(WebComponentUtil.createHelp(ID_RELATED_WORK_ITEMS_HELP));
    additionalInfoColumn.add(relatedWorkItemsContainer);
    final WebMarkupContainer relatedWorkflowRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
    final IModel<List<ProcessInstanceDto>> relatedWorkflowRequestsModel = new PropertyModel<>(getModel(), WorkItemDto.F_RELATED_WORKFLOW_REQUESTS);
    final ISortableDataProvider<ProcessInstanceDto, String> relatedWorkflowRequestsProvider = new ListDataProvider<>(this, relatedWorkflowRequestsModel);
    relatedWorkflowRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, relatedWorkflowRequestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, new PropertyModel<>(getModel(), WorkItemDto.F_PROCESS_INSTANCE_ID)));
    final VisibleEnableBehaviour relatedWorkflowRequestsContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !relatedWorkflowRequestsModel.getObject().isEmpty();
        }
    };
    relatedWorkflowRequestsContainer.add(relatedWorkflowRequestsContainerVisible);
    relatedWorkflowRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
    additionalInfoColumn.add(relatedWorkflowRequestsContainer);
    final VisibleEnableBehaviour additionalInfoColumnVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return historyContainerVisible.isVisible() || relatedWorkItemsContainerVisible.isVisible() || relatedWorkflowRequestsContainerVisible.isVisible();
        }
    };
    additionalInfoColumn.add(additionalInfoColumnVisible);
    add(additionalInfoColumn);
    WebMarkupContainer primaryInfoColumn = new WebMarkupContainer(ID_PRIMARY_INFO_COLUMN);
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_BY, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_NAME)));
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_BY_FULL_NAME, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_FULL_NAME)));
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_ON, new PropertyModel(getModel(), WorkItemDto.F_STARTED_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_WORK_ITEM_CREATED_ON, new PropertyModel(getModel(), WorkItemDto.F_CREATED_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_WORK_ITEM_DEADLINE, new PropertyModel(getModel(), WorkItemDto.F_DEADLINE_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_ORIGINALLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_ORIGINAL_ASSIGNEE_FULL)));
    primaryInfoColumn.add(new Label(ID_CURRENTLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_CURRENT_ASSIGNEES_FULL)));
    primaryInfoColumn.add(new Label(ID_CANDIDATES, new PropertyModel(getModel(), WorkItemDto.F_CANDIDATES)));
    WebMarkupContainer stageInfoContainer = new WebMarkupContainer(ID_STAGE_INFO_CONTAINER);
    primaryInfoColumn.add(stageInfoContainer);
    stageInfoContainer.add(new Label(ID_STAGE_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_STAGE_INFO)));
    stageInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getStageInfo() != null));
    WebMarkupContainer escalationLevelInfoContainer = new WebMarkupContainer(ID_ESCALATION_LEVEL_INFO_CONTAINER);
    primaryInfoColumn.add(escalationLevelInfoContainer);
    escalationLevelInfoContainer.add(new Label(ID_ESCALATION_LEVEL_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_ESCALATION_LEVEL_INFO)));
    escalationLevelInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getEscalationLevelInfo() != null));
    WebMarkupContainer requesterCommentContainer = new WebMarkupContainer(ID_REQUESTER_COMMENT_CONTAINER);
    requesterCommentContainer.setOutputMarkupId(true);
    primaryInfoColumn.add(requesterCommentContainer);
    requesterCommentContainer.add(new Label(ID_REQUESTER_COMMENT_MESSAGE, new PropertyModel<String>(getModel(), WorkItemDto.F_REQUESTER_COMMENT)));
    //primaryInfoColumn.add(new ScenePanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<SceneDto>(getModel(), WorkItemDto.F_DELTAS)));
    primaryInfoColumn.add(new TaskChangesPanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<>(getModel(), WorkItemDto.F_CHANGES)));
    primaryInfoColumn.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return additionalInfoColumnVisible.isVisible() ? "col-md-5" : "col-md-12";
        }
    }));
    add(primaryInfoColumn);
    add(new AjaxFallbackLink(ID_SHOW_REQUEST) {

        public void onClick(AjaxRequestTarget target) {
            String oid = WorkItemPanel.this.getModelObject().getTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                getPageBase().navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    });
    add(WebComponentUtil.createHelp(ID_SHOW_REQUEST_HELP));
    WebMarkupContainer additionalInformation = new InformationListPanel(ID_ADDITIONAL_INFORMATION, new PropertyModel<>(getModel(), WorkItemDto.F_ADDITIONAL_INFORMATION));
    add(additionalInformation);
    WorkItemDto dto = getModelObject();
    ApprovalStageDefinitionType level = WfContextUtil.getCurrentStageDefinition(dto.getWorkflowContext());
    WebMarkupContainer additionalAttribues = new WebMarkupContainer(ID_ADDITIONAL_ATTRIBUTES);
    add(additionalAttribues);
    additionalAttribues.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null);
        }

        ;
    });
    if (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null) {
        String formOid = level.getFormRef().getOid();
        ObjectType focus = dto.getFocus(pageBase);
        if (focus == null) {
            // TODO FIXME (this should not occur anyway)
            focus = new UserType(pageBase.getPrismContext());
        }
        Task task = pageBase.createSimpleTask(OPERATION_LOAD_CUSTOM_FORM);
        DynamicFormPanel<?> customForm = new DynamicFormPanel<>(ID_CUSTOM_FORM, focus.asPrismObject(), formOid, mainForm, task, pageBase);
        additionalAttribues.add(customForm);
    } else {
        additionalAttribues.add(new Label(ID_CUSTOM_FORM));
    }
    add(new TextArea<>(ID_APPROVER_COMMENT, new PropertyModel<String>(getModel(), WorkItemDto.F_APPROVER_COMMENT)));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Task(com.evolveum.midpoint.task.api.Task) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) TaskChangesPanel(com.evolveum.midpoint.web.page.admin.server.TaskChangesPanel) ItemApprovalHistoryPanel(com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ApprovalStageDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ApprovalStageDefinitionType) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PageTaskEdit(com.evolveum.midpoint.web.page.admin.server.PageTaskEdit) PropertyModel(org.apache.wicket.model.PropertyModel) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AttributeModifier(org.apache.wicket.AttributeModifier) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DynamicFormPanel(com.evolveum.midpoint.web.component.prism.DynamicFormPanel) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 2 with AjaxFallbackLink

use of org.apache.wicket.ajax.markup.html.AjaxFallbackLink in project midpoint by Evolveum.

the class TaskResultTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
    SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this, new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
    TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setStyle("padding-top: 0px;");
    resultTablePanel.setShowPaging(false);
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    add(new AjaxFallbackLink(ID_SHOW_RESULT) {

        public void onClick(AjaxRequestTarget target) {
            OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
            OperationResultPanel body = new OperationResultPanel(pageBase.getMainPopupBodyId(), new Model<>(OpResult.getOpResult(pageBase, opResult)), pageBase);
            body.setOutputMarkupId(true);
            pageBase.showMainPopup(body, target);
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ArrayList(java.util.ArrayList) List(java.util.List) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 3 with AjaxFallbackLink

use of org.apache.wicket.ajax.markup.html.AjaxFallbackLink in project midpoint by Evolveum.

the class TaskWfChildPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    changesModel = new PropertyModel<>(taskDtoModel, TaskDto.F_CHANGE_BEING_APPROVED);
    TaskChangesPanel changesPanel = new TaskChangesPanel(ID_CHANGES, changesModel);
    changesPanel.setOutputMarkupId(true);
    add(changesPanel);
    final ItemApprovalHistoryPanel history = new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL));
    history.setOutputMarkupId(true);
    add(history);
    add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
    WebMarkupContainer workItemsContainer = new WebMarkupContainer(ID_CURRENT_WORK_ITEMS_CONTAINER);
    final ISortableDataProvider<WorkItemDto, String> provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(taskDtoModel, TaskDto.F_WORK_ITEMS));
    final WorkItemsPanel workItemsPanel = new WorkItemsPanel(ID_CURRENT_WORK_ITEMS, provider, UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL), WorkItemsPanel.View.ITEMS_FOR_PROCESS);
    workItemsPanel.setOutputMarkupId(true);
    workItemsContainer.add(workItemsPanel);
    workItemsContainer.setOutputMarkupId(true);
    workItemsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return provider.size() > 0;
        }
    });
    workItemsContainer.add(WebComponentUtil.createHelp(ID_CURRENT_WORK_ITEMS_HELP));
    add(workItemsContainer);
    final PropertyModel<List<ProcessInstanceDto>> relatedRequestsModel = new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_REQUESTS);
    WebMarkupContainer relatedRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
    relatedRequestsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(relatedRequestsModel.getObject());
        }
    });
    relatedRequestsContainer.setOutputMarkupId(true);
    add(relatedRequestsContainer);
    ISortableDataProvider<ProcessInstanceDto, String> requestsProvider = new ListDataProvider(this, relatedRequestsModel);
    relatedRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, requestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, null));
    relatedRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
    add(new AjaxFallbackLink(ID_SHOW_PARENT) {

        public void onClick(AjaxRequestTarget target) {
            String oid = taskDtoModel.getObject().getParentTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                ((PageBase) getPage()).navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    });
    add(WebComponentUtil.createHelp(ID_SHOW_PARENT_HELP));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemApprovalHistoryPanel(com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 4 with AjaxFallbackLink

use of org.apache.wicket.ajax.markup.html.AjaxFallbackLink in project wicket by apache.

the class EnhancedPageView method addTreeControls.

private void addTreeControls() {
    Form<Void> form = new Form<>("form");
    add(form);
    form.add(new CheckBox("showStateless", new PropertyModel<Boolean>(this, "showStatefulAndParentsOnly")));
    form.add(new CheckBox("showBehaviors", new PropertyModel<Boolean>(this, "showBehaviors")));
    form.add(new CheckBoxMultipleChoice<>("visibleColumns", new PropertyModel<List<IColumn<TreeNode, Void>>>(this, "visibleColumns"), allColumns).setSuffix(" "));
    form.add(new AjaxFallbackButton("submit", form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onAfterSubmit(Optional<AjaxRequestTarget> target) {
            target.ifPresent(t -> t.add(componentTree));
        }
    });
    add(new AjaxFallbackLink<Void>("expandAll") {

        private static final long serialVersionUID = 1L;

        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            expandState.expandAll();
            targetOptional.ifPresent(target -> target.add(componentTree));
        }
    });
    add(new AjaxFallbackLink<Void>("collapseAll") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            expandState.collapseAll();
            targetOptional.ifPresent(target -> target.add(componentTree));
        }
    });
}
Also used : Form(org.apache.wicket.markup.html.form.Form) Arrays(java.util.Arrays) Behavior(org.apache.wicket.behavior.Behavior) WicketObjects(org.apache.wicket.core.util.lang.WicketObjects) Page(org.apache.wicket.Page) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PageView(org.apache.wicket.markup.html.debug.PageView) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) OddEvenItem(org.apache.wicket.markup.repeater.OddEvenItem) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AjaxFallbackButton(org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBoxMultipleChoice(org.apache.wicket.markup.html.form.CheckBoxMultipleChoice) Strings(org.apache.wicket.util.string.Strings) IModel(org.apache.wicket.model.IModel) Label(org.apache.wicket.markup.html.basic.Label) AbstractTree(org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree) Iterator(java.util.Iterator) SortableTreeProvider(org.apache.wicket.extensions.markup.html.repeater.util.SortableTreeProvider) Collection(java.util.Collection) IClusterable(org.apache.wicket.util.io.IClusterable) GenericPanel(org.apache.wicket.markup.html.panel.GenericPanel) Model(org.apache.wicket.model.Model) Set(java.util.Set) Component(org.apache.wicket.Component) MarkupContainer(org.apache.wicket.MarkupContainer) LoadableDetachableModel(org.apache.wicket.model.LoadableDetachableModel) PageReference(org.apache.wicket.PageReference) DefaultTableTree(org.apache.wicket.extensions.markup.html.repeater.tree.DefaultTableTree) List(java.util.List) TreeColumn(org.apache.wicket.extensions.markup.html.repeater.tree.table.TreeColumn) PropertyModel(org.apache.wicket.model.PropertyModel) Bytes(org.apache.wicket.util.lang.Bytes) Item(org.apache.wicket.markup.repeater.Item) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Optional(java.util.Optional) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) Comparator(java.util.Comparator) Collections(java.util.Collections) Form(org.apache.wicket.markup.html.form.Form) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxFallbackButton(org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ArrayList(java.util.ArrayList) List(java.util.List) CheckBoxMultipleChoice(org.apache.wicket.markup.html.form.CheckBoxMultipleChoice)

Example 5 with AjaxFallbackLink

use of org.apache.wicket.ajax.markup.html.AjaxFallbackLink in project wicket by apache.

the class AjaxLinkClickTest method testFallbackLinkWithAjaxDisabled.

/**
 * Test that when AJAX is disabled, the AjaxFallbackLink is invoked with null as
 * AjaxRequestTarget.
 */
@Test
public void testFallbackLinkWithAjaxDisabled() {
    final Page page = new MockPageWithLink();
    // Create a link, which we test is actually invoked
    page.add(new AjaxFallbackLink<Void>("ajaxLink") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            linkClicked = true;
            targetOptional.ifPresent(target -> ajaxRequestTarget = target);
        }
    });
    tester.startPage(page);
    // Click the link with ajax disabled
    tester.clickLink("ajaxLink", false);
    assertTrue(linkClicked);
    assertNull(ajaxRequestTarget);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Page(org.apache.wicket.Page) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) Optional(java.util.Optional) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Test(org.junit.Test) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) WicketTestCase(org.apache.wicket.util.tester.WicketTestCase) Before(org.junit.Before) Page(org.apache.wicket.Page) Test(org.junit.Test)

Aggregations

AjaxFallbackLink (org.apache.wicket.ajax.markup.html.AjaxFallbackLink)9 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)8 List (java.util.List)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)3 ArrayList (java.util.ArrayList)3 Optional (java.util.Optional)3 Page (org.apache.wicket.Page)3 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)3 OperationResultPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPanel)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)2 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)2 SelectableListDataProvider (com.evolveum.midpoint.web.component.util.SelectableListDataProvider)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 WorkItemsPanel (com.evolveum.midpoint.web.component.wf.WorkItemsPanel)2 ItemApprovalHistoryPanel (com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel)2 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)2