Search in sources :

Example 1 with IconColumn

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

the class WorkItemsPanel method createTypeIconColumn.

public IColumn<WorkItemDto, String> createTypeIconColumn(final boolean object) {
    // true = object, false = target
    return new IconColumn<WorkItemDto>(createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(IModel<WorkItemDto> rowModel) {
            if (getObjectType(rowModel) == null) {
                return null;
            }
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return new Model<>(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(IModel<WorkItemDto> rowModel) {
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(getObjectType(rowModel)));
        }

        private QName getObjectType(IModel<WorkItemDto> rowModel) {
            return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
        }

        @Override
        public void populateItem(Item<ICellPopulator<WorkItemDto>> item, String componentId, IModel<WorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
}
Also used : PageWorkItem(com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem) Item(org.apache.wicket.markup.repeater.Item) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)

Example 2 with IconColumn

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

the class ProcessInstancesPanel method createOutcomeColumn.

@NotNull
private IconColumn<ProcessInstanceDto> createOutcomeColumn() {
    return new IconColumn<ProcessInstanceDto>(createStringResource("pageProcessInstances.item.result")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected DisplayType getIconDisplayType(IModel<ProcessInstanceDto> rowModel) {
            return GuiDisplayTypeUtil.createDisplayType(choose(rowModel, null, ApprovalOutcomeIcon.IN_PROGRESS.getIcon(), ApprovalOutcomeIcon.APPROVED.getIcon(), ApprovalOutcomeIcon.REJECTED.getIcon()), "", choose(rowModel, null, createStringResource("MyRequestsPanel.inProgress").getString(), createStringResource("MyRequestsPanel.approved").getString(), createStringResource("MyRequestsPanel.rejected").getString()));
        }

        // Cannot have the default "icon" class here. This column has text label in the header.
        // Having class "icon" would shrink the column to 25px and the text will overflow.
        @Override
        public String getCssClass() {
            return "shrink";
        }

        private String choose(IModel<ProcessInstanceDto> rowModel, String noReply, String inProgress, String approved, String rejected) {
            ProcessInstanceDto dto = rowModel.getObject();
            Boolean result = ApprovalUtils.approvalBooleanValueFromUri(dto.getOutcome());
            if (result == null) {
                if (dto.getEndTimestamp() != null) {
                    return noReply;
                } else {
                    return inProgress;
                }
            } else {
                return result ? approved : rejected;
            }
        }
    };
}
Also used : IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with IconColumn

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

the class ProcessInstancesPanel method createTypeIconColumn.

public IColumn<ProcessInstanceDto, String> createTypeIconColumn(final boolean object) {
    // true = object, false = target
    return new IconColumn<ProcessInstanceDto>(createStringResource("")) {

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

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(IModel<ProcessInstanceDto> rowModel) {
            QName type = getObjectType(rowModel);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(type));
        }

        private QName getObjectType(IModel<ProcessInstanceDto> rowModel) {
            return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
        }

        @Override
        public void populateItem(Item<ICellPopulator<ProcessInstanceDto>> item, String componentId, IModel<ProcessInstanceDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
}
Also used : Item(org.apache.wicket.markup.repeater.Item) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) QName(javax.xml.namespace.QName) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Example 4 with IconColumn

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

the class TaskTablePanel method createTaskStatusIconColumn.

private IconColumn<SelectableBean<TaskType>> createTaskStatusIconColumn() {
    return new IconColumn<>(createStringResource("pageTasks.task.status"), TaskType.F_RESULT_STATUS.getLocalPart()) {

        @Override
        protected DisplayType getIconDisplayType(final IModel<SelectableBean<TaskType>> rowModel) {
            TaskInformation taskInformation = getAttachedTaskInformation(rowModel.getObject());
            OperationResultStatusType status = taskInformation.getResultStatus();
            String icon = OperationResultStatusPresentationProperties.parseOperationalResultStatus(status).getIcon() + " fa-lg";
            String title = createStringResource(status).getString();
            return GuiDisplayTypeUtil.createDisplayType(icon, "", title);
        }
    };
}
Also used : IModel(org.apache.wicket.model.IModel) TaskInformation(com.evolveum.midpoint.schema.util.task.TaskInformation) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn)

Aggregations

IconColumn (com.evolveum.midpoint.web.component.data.column.IconColumn)4 IModel (org.apache.wicket.model.IModel)4 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)2 ObjectTypeGuiDescriptor (com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)2 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)2 Item (org.apache.wicket.markup.repeater.Item)2 TaskInformation (com.evolveum.midpoint.schema.util.task.TaskInformation)1 PageWorkItem (com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem)1 WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)1 QName (javax.xml.namespace.QName)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 Model (org.apache.wicket.model.Model)1 PropertyModel (org.apache.wicket.model.PropertyModel)1 NotNull (org.jetbrains.annotations.NotNull)1