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());
}
}
};
}
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;
}
}
};
}
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());
}
}
};
}
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);
}
};
}
Aggregations