Search in sources :

Example 1 with CertCaseOrWorkItemDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto in project midpoint by Evolveum.

the class CertDecisionHelper method createTypeColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createTypeColumn(final WhichObject which, final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected DisplayType getIconDisplayType(IModel<CertCaseOrWorkItemDto> rowModel) {
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return GuiDisplayTypeUtil.createDisplayType(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(WhichObject which, IModel<CertCaseOrWorkItemDto> rowModel) {
            QName targetType = rowModel.getObject().getObjectType(which);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(targetType));
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", page.createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) QName(javax.xml.namespace.QName) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Example 2 with CertCaseOrWorkItemDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto in project midpoint by Evolveum.

the class CertDecisionHelper method createDetailedInfoColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createDetailedInfoColumn(final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected DisplayType getIconDisplayType(final IModel<CertCaseOrWorkItemDto> rowModel) {
            return GuiDisplayTypeUtil.createDisplayType("fa fa-fw fa-info-circle text-info");
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            CertCaseOrWorkItemDto aCase = rowModel.getObject();
            String handlerUri;
            if (aCase instanceof CertWorkItemDto) {
                handlerUri = aCase.getHandlerUri();
            } else {
                handlerUri = ((PageCertCampaign) page).getCampaignHandlerUri();
            }
            CertGuiHandler handler = CertGuiHandlerRegistry.instance().getHandler(handlerUri);
            if (handler != null) {
                String title = handler.getCaseInfoButtonTitle(rowModel, page);
                item.add(AttributeModifier.replace("title", title));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) CertGuiHandler(com.evolveum.midpoint.web.page.admin.certification.handlers.CertGuiHandler) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CertWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto)

Example 3 with CertCaseOrWorkItemDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto in project midpoint by Evolveum.

the class CertDecisionHelper method createReviewerNameColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createReviewerNameColumn(final PageBase page, final String headerKey) {
    IColumn column;
    column = new AbstractColumn<T, String>(page.createStringResource(headerKey)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, final IModel<T> rowModel) {
            CertCaseOrWorkItemDto dto = rowModel.getObject();
            RepeatingView reviewersPanel = new RepeatingView(componentId);
            if (dto instanceof CertWorkItemDto) {
                List<ObjectReferenceType> reviewersList = ((CertWorkItemDto) dto).getReviewerRefList();
                if (CollectionUtils.isNotEmpty(reviewersList)) {
                    for (ObjectReferenceType reviewer : reviewersList) {
                        reviewersPanel.add(new AjaxLinkPanel(reviewersPanel.newChildId(), Model.of(WebComponentUtil.getDisplayNameOrName(reviewer))) {

                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClick(AjaxRequestTarget target) {
                                dispatchToObjectDetailsPage(reviewer, page, false);
                            }
                        });
                    }
                }
            }
            cellItem.add(reviewersPanel);
        }
    };
    return column;
}
Also used : AjaxLinkPanel(com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) List(java.util.List) CertWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto)

Example 4 with CertCaseOrWorkItemDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto in project midpoint by Evolveum.

the class CertDecisionHelper method createTargetNameColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createTargetNameColumn(final PageBase page, final String headerKey) {
    IColumn column;
    column = new AjaxLinkColumn<CertCaseOrWorkItemDto>(page.createStringResource(headerKey), SearchingUtils.TARGET_NAME, CertCaseOrWorkItemDto.F_TARGET_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<CertCaseOrWorkItemDto> rowModel) {
            CertCaseOrWorkItemDto dto = rowModel.getObject();
            dispatchToObjectDetailsPage(dto.getCertCase().getTargetRef(), page, false);
        }
    };
    return column;
}
Also used : CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 5 with CertCaseOrWorkItemDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto in project midpoint by Evolveum.

the class CertDecisionHelper method createObjectNameColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createObjectNameColumn(final PageBase page, final String headerKey) {
    IColumn column;
    column = new AjaxLinkColumn<CertCaseOrWorkItemDto>(page.createStringResource(headerKey), SearchingUtils.OBJECT_NAME, CertCaseOrWorkItemDto.F_OBJECT_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<CertCaseOrWorkItemDto> rowModel) {
            CertCaseOrWorkItemDto dto = rowModel.getObject();
            dispatchToObjectDetailsPage(dto.getCertCase().getObjectRef(), page, false);
        }
    };
    return column;
}
Also used : CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Aggregations

CertCaseOrWorkItemDto (com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto)6 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)3 CertWorkItemDto (com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto)2 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)2 DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)2 Item (com.evolveum.midpoint.prism.Item)1 Task (com.evolveum.midpoint.task.api.Task)1 AjaxLinkPanel (com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel)1 CertGuiHandler (com.evolveum.midpoint.web.page.admin.certification.handlers.CertGuiHandler)1 ObjectTypeGuiDescriptor (com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)1 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1 RepeatingView (org.apache.wicket.markup.repeater.RepeatingView)1