Search in sources :

Example 6 with LinkColumn

use of com.evolveum.midpoint.web.component.data.column.LinkColumn in project midpoint by Evolveum.

the class ProcessInstancesPanel method createTargetNameColumn.

IColumn<ProcessInstanceDto, String> createTargetNameColumn(final String headerKey) {
    return new LinkColumn<ProcessInstanceDto>(createStringResource(headerKey), ProcessInstanceDto.F_TARGET_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<ProcessInstanceDto> rowModel) {
            ProcessInstanceDto dto = rowModel.getObject();
            dispatchToObjectDetailsPage(dto.getTargetRef(), getPageBase(), false);
        }
    };
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn)

Example 7 with LinkColumn

use of com.evolveum.midpoint.web.component.data.column.LinkColumn in project midpoint by Evolveum.

the class ProcessInstancesPanel method createNameColumn.

@NotNull
private IColumn<ProcessInstanceDto, String> createNameColumn() {
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_TASKS_ALL_URL, AuthorizationConstants.AUTZ_UI_TASK_URL)) {
        return new LinkColumn<ProcessInstanceDto>(createStringResource("MyRequestsPanel.name"), "name") {

            @Override
            public void onClick(AjaxRequestTarget target, IModel<ProcessInstanceDto> rowModel) {
                ProcessInstanceDto piDto = rowModel.getObject();
                itemDetailsPerformed(target, piDto.getTaskOid());
            }
        };
    } else {
        return new PropertyColumn<>(createStringResource("MyRequestsPanel.name"), F_NAME);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with LinkColumn

use of com.evolveum.midpoint.web.component.data.column.LinkColumn in project midpoint by Evolveum.

the class AuditLogViewerPanel method initColumns.

protected List<IColumn<AuditEventRecordType, String>> initColumns() {
    List<IColumn<AuditEventRecordType, String>> columns = new ArrayList<IColumn<AuditEventRecordType, String>>();
    IColumn<AuditEventRecordType, String> linkColumn = new LinkColumn<AuditEventRecordType>(createStringResource("AuditEventRecordType.timestamp"), "timestamp") {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<String> createLinkModel(final IModel<AuditEventRecordType> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    XMLGregorianCalendar time = rowModel.getObject().getTimestamp();
                    return WebComponentUtil.formatDate(time);
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<AuditEventRecordType> rowModel) {
            AuditEventRecordType record = rowModel.getObject();
            try {
                AuditEventRecord.adopt(record, pageBase.getPrismContext());
            } catch (SchemaException e) {
                throw new SystemException("Couldn't adopt event record: " + e, e);
            }
            pageBase.navigateToNext(new PageAuditLogDetails(record));
        }
    };
    columns.add(linkColumn);
    PropertyColumn<AuditEventRecordType, String> initiatorRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.initiatorRef"), AuditEventRecordType.F_INITIATOR_REF.getLocalPart()) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
            AuditEventRecordType auditEventRecordType = rowModel.getObject();
            createReferenceColumn(auditEventRecordType.getInitiatorRef(), item, componentId);
        }
    };
    columns.add(initiatorRefColumn);
    if (visibilityMap == null || visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY) == null || visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY)) {
        IColumn<AuditEventRecordType, String> eventStageColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("PageAuditLogViewer.eventStageLabel"), "eventStage");
        columns.add(eventStageColumn);
    }
    IColumn<AuditEventRecordType, String> eventTypeColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("PageAuditLogViewer.eventTypeLabel"), "eventType");
    columns.add(eventTypeColumn);
    if (visibilityMap == null || visibilityMap.get(TARGET_COLUMN_VISIBILITY) == null || visibilityMap.get(TARGET_COLUMN_VISIBILITY)) {
        PropertyColumn<AuditEventRecordType, String> targetRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetRef"), AuditEventRecordType.F_TARGET_REF.getLocalPart()) {

            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
                AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
                createReferenceColumn(auditEventRecordType.getTargetRef(), item, componentId);
            }
        };
        columns.add(targetRefColumn);
    }
    if (visibilityMap == null || visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY) == null || visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY)) {
        PropertyColumn<AuditEventRecordType, String> targetOwnerRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetOwnerRef"), AuditEventRecordType.F_TARGET_OWNER_REF.getLocalPart()) {

            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
                AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
                createReferenceColumn(auditEventRecordType.getTargetOwnerRef(), item, componentId);
            }
        };
        columns.add(targetOwnerRefColumn);
    }
    IColumn<AuditEventRecordType, String> channelColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.channel"), "channel") {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
            AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
            String channel = auditEventRecordType.getChannel();
            if (channel != null) {
                QName channelQName = QNameUtil.uriToQName(channel);
                String return_ = channelQName.getLocalPart();
                item.add(new Label(componentId, return_));
            } else {
                item.add(new Label(componentId, ""));
            }
            item.add(new AttributeModifier("style", new Model<String>("width: 10%;")));
        }
    };
    columns.add(channelColumn);
    IColumn<AuditEventRecordType, String> outcomeColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("PageAuditLogViewer.outcomeLabel"), "outcome");
    columns.add(outcomeColumn);
    return columns;
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) IModel(org.apache.wicket.model.IModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) QName(javax.xml.namespace.QName) PageAuditLogDetails(com.evolveum.midpoint.web.page.admin.reports.PageAuditLogDetails) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) AttributeModifier(org.apache.wicket.AttributeModifier) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) Item(org.apache.wicket.markup.repeater.Item) SystemException(com.evolveum.midpoint.util.exception.SystemException) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel)

Aggregations

LinkColumn (com.evolveum.midpoint.web.component.data.column.LinkColumn)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)8 IModel (org.apache.wicket.model.IModel)8 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)3 ArrayList (java.util.ArrayList)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)2 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)2 Item (org.apache.wicket.markup.repeater.Item)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 PageAuditLogDetails (com.evolveum.midpoint.web.page.admin.reports.PageAuditLogDetails)1 PageWorkItem (com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem)1 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)1 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 QName (javax.xml.namespace.QName)1 AttributeModifier (org.apache.wicket.AttributeModifier)1