Search in sources :

Example 71 with SelectableBean

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

the class TaskResultTabPanel method initLayout.

private void initLayout() {
    IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(() -> createOperationResultList());
    SelectableListDataProvider<SelectableBean<OperationResult>, OperationResult> provider = new SelectableListDataProvider<>(this, resultModel);
    BoxedTablePanel<SelectableBean<OperationResult>> resultTablePanel = new BoxedTablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    AjaxFallbackLink<Void> showResult = new AjaxFallbackLink<Void>(ID_SHOW_RESULT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
            if (!optionalTarget.isPresent()) {
                LOGGER.warn("Cannot show result in interactive way, request target not present.");
                return;
            }
            AjaxRequestTarget target = optionalTarget.get();
            PrismObjectWrapper<TaskType> taskWrapper = TaskResultTabPanel.this.getModelObject();
            TaskType taskType = taskWrapper.getObject().asObjectable();
            OperationResult opResult = OperationResult.createOperationResult(taskType.getResult());
            OpResult result = opResult != null ? OpResult.getOpResult(getPageBase(), opResult) : null;
            OperationResultPanel body = new OperationResultPanel(getPageBase().getMainPopupBodyId(), new Model<>(result));
            body.add(new VisibleBehaviour(() -> opResult != null));
            body.setOutputMarkupId(true);
            getPageBase().showMainPopup(body, target);
        }
    };
    showResult.setOutputMarkupId(true);
    add(showResult);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Example 72 with SelectableBean

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

the class TaskTablePanel method createNodesColumn.

private AbstractColumn<SelectableBean<TaskType>, String> createNodesColumn() {
    return new AbstractColumn<>(createStringResource("pageTasks.task.executingAt")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<TaskType>>> cellItem, String componentId, IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            cellItem.add(new Label(componentId, taskInformation.getNodesDescription()));
        }
    };
}
Also used : ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) Label(org.apache.wicket.markup.html.basic.Label) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)

Example 73 with SelectableBean

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

the class TaskTablePanel method createErrorsColumn.

private AbstractColumn<SelectableBean<TaskType>, String> createErrorsColumn() {
    return new AbstractColumn<>(createStringResource("pageTasks.task.errors")) {

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<TaskType>>> cellItem, String componentId, IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            cellItem.add(new Label(componentId, taskInformation.getAllErrors()));
        }
    };
}
Also used : ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) Label(org.apache.wicket.markup.html.basic.Label) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn)

Aggregations

SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)39 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)37 IModel (org.apache.wicket.model.IModel)37 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)32 ArrayList (java.util.ArrayList)31 Label (org.apache.wicket.markup.html.basic.Label)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)16 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)15 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)14 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)12 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)12 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)12 Item (org.apache.wicket.markup.repeater.Item)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 List (java.util.List)8 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)7