use of com.evolveum.midpoint.web.component.box.InfoBoxType in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createSchemaStatusInfoBoxModel.
private ReadOnlyModel<InfoBoxType> createSchemaStatusInfoBoxModel() {
return new ReadOnlyModel<>(() -> {
String backgroundColor = "bg-gray";
String icon = "fa fa-times";
String numberMessage;
String description = null;
Integer progress = null;
ResourceSchema refinedSchema;
try {
refinedSchema = getObjectDetailsModels().getRefinedSchema();
if (refinedSchema != null) {
backgroundColor = "bg-purple";
icon = "fa fa-cubes";
// TODO is this correct?
int numObjectTypes = refinedSchema.getObjectTypeDefinitions().size();
int numAllDefinitions = numObjectTypes + refinedSchema.getObjectClassDefinitions().size();
numberMessage = numObjectTypes + " " + getPageBase().getString("PageResource.resource.objectTypes");
if (numAllDefinitions != 0) {
progress = numObjectTypes * 100 / numAllDefinitions;
if (progress > 100) {
progress = 100;
}
}
description = numAllDefinitions + " " + getPageBase().getString("PageResource.resource.schemaDefinitions");
} else {
numberMessage = getPageBase().getString("PageResource.resource.noSchema");
}
} catch (SchemaException e) {
backgroundColor = "bg-danger";
icon = "fa fa-warning";
numberMessage = getPageBase().getString("PageResource.resource.schemaError");
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString("PageResource.resource.schema"));
infoBoxType.setNumber(numberMessage);
infoBoxType.setProgress(progress);
infoBoxType.setDescription(description);
return infoBoxType;
});
}
use of com.evolveum.midpoint.web.component.box.InfoBoxType in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createSourceTargetInfoBoxModel.
private ReadOnlyModel<InfoBoxType> createSourceTargetInfoBoxModel() {
return new ReadOnlyModel<>(() -> {
PrismObjectWrapper<ResourceType> resource = getObjectDetailsModels().getObjectWrapper();
String backgroundColor = "bg-aqua";
SourceTarget sourceTarget = determineIfSourceOrTarget(resource);
String numberKey;
switch(sourceTarget) {
case SOURCE:
numberKey = "PageResource.resource.source";
break;
case TARGET:
numberKey = "PageResource.resource.target";
break;
case SOURCE_TARGET:
numberKey = "PageResource.resource.sourceAndTarget";
break;
default:
backgroundColor = "bg-gray";
numberKey = "PageResource.resource.noMappings";
break;
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, sourceTarget.getCssClass(), getPageBase().getString("PageResource.resource.mappings"));
infoBoxType.setNumber(getPageBase().getString(numberKey));
if (isSynchronizationDefined(resource)) {
infoBoxType.setDescription(getPageBase().getString("PageResource.resource.sync"));
}
return infoBoxType;
});
}
Aggregations