Skip to content

Commit

Permalink
object list icons style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jan 3, 2020
1 parent e6a2ead commit 3164267
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
Expand Up @@ -1990,8 +1990,9 @@ public static String createUserIcon(PrismObject<UserType> object) {
}
}

String additionalStyle = getIconEnabledDisabled(object);
if (additionalStyle == null) {
String additionalStyle = "";
// getIconEnabledDisabled(object);
// if (additionalStyle == null) {
// Set manager and end-user icon only as a last resort. All other
// colors have priority.
if (isManager) {
Expand All @@ -2001,7 +2002,7 @@ public static String createUserIcon(PrismObject<UserType> object) {
} else {
additionalStyle = GuiStyleConstants.CLASS_ICON_STYLE_NORMAL;
}
}
// }
return GuiStyleConstants.CLASS_OBJECT_USER_ICON + " " + additionalStyle;
}

Expand All @@ -2013,15 +2014,19 @@ public static String createRoleIcon(PrismObject<RoleType> object) {
}
}

return getIconEnabledDisabled(object, GuiStyleConstants.CLASS_OBJECT_ROLE_ICON);
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_OBJECT_ROLE_ICON);
}

public static String createOrgIcon(PrismObject<OrgType> object) {
return getIconEnabledDisabled(object, GuiStyleConstants.CLASS_OBJECT_ORG_ICON);
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_OBJECT_ORG_ICON);
}

public static String createServiceIcon(PrismObject<ServiceType> object) {
return getIconEnabledDisabled(object, GuiStyleConstants.CLASS_OBJECT_SERVICE_ICON);
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_OBJECT_SERVICE_ICON);
}

private static <AHT extends AssignmentHolderType> String getObjectNormalIconStyle(String baseIcon){
return baseIcon + " " + GuiStyleConstants.CLASS_ICON_STYLE_NORMAL;
}

private static <F extends FocusType> String getIconEnabledDisabled(PrismObject<F> object,
Expand Down Expand Up @@ -3314,18 +3319,19 @@ public static <O extends ObjectType> DisplayType getDisplayTypeForObject(O obj,
return ((ArchetypeType)obj).getArchetypePolicy().getDisplay();
}
DisplayType displayType = WebComponentUtil.getArchetypePolicyDisplayType(obj, pageBase);
if (displayType != null){
String disabledStyle = "";
if (obj instanceof FocusType) {
disabledStyle = WebComponentUtil.getIconEnabledDisabled(((FocusType)obj).asPrismObject());
if (displayType.getIcon() != null && StringUtils.isNotEmpty(displayType.getIcon().getCssClass()) &&
disabledStyle != null){
displayType.getIcon().setCssClass(displayType.getIcon().getCssClass() + " " + disabledStyle);
displayType.getIcon().setColor("");
}
}
} else {
displayType = WebComponentUtil.createDisplayType(ColumnUtils.getIconColumnValue(obj, result),
// if (displayType != null){
// String disabledStyle = "";
// if (obj instanceof FocusType) {
// disabledStyle = WebComponentUtil.getIconEnabledDisabled(((FocusType)obj).asPrismObject());
// if (displayType.getIcon() != null && StringUtils.isNotEmpty(displayType.getIcon().getCssClass()) &&
// disabledStyle != null){
// displayType.getIcon().setCssClass(displayType.getIcon().getCssClass() + " " + disabledStyle);
// displayType.getIcon().setColor("");
// }
// }
// } else {
if (displayType == null){
displayType = WebComponentUtil.createDisplayType(createDefaultIcon(obj.asPrismObject()),
"", ColumnUtils.getIconColumnTitle(obj, result));
}
return displayType;
Expand All @@ -3340,11 +3346,15 @@ public static <O extends ObjectType> CompositedIcon createCompositeIconForObject
IconType lifecycleStateIcon = getIconForLifecycleState(obj);
IconType activationStatusIcon = getIconForActivationStatus(obj);

String iconColor = getIconColor(basicIconDisplayType);

CompositedIcon compositedIconForObject = iconBuilder.setBasicIcon(
WebComponentUtil.getIconCssClass(basicIconDisplayType), IconCssStyle.IN_ROW_STYLE)
getIconCssClass(basicIconDisplayType), IconCssStyle.IN_ROW_STYLE)
.appendColorHtmlValue(StringUtils.isNotEmpty(iconColor) ? iconColor : "")
.appendLayerIcon(lifecycleStateIcon, IconCssStyle.BOTTOM_LEFT_FOR_COLUMN_STYLE)
.appendLayerIcon(activationStatusIcon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE)
.build();

return compositedIconForObject;
}

Expand Down
Expand Up @@ -56,7 +56,7 @@ private void initLayout(){
if(compositedIcon.hasBasicIcon()) {
basicIcon.add(AttributeAppender.append("class", compositedIcon.getBasicIcon()));
if (compositedIcon.hasBasicIconHtmlColor()){
basicIcon.add(AttributeAppender.append("style", compositedIcon.getBasicIconHtmlColor()));
basicIcon.add(AttributeAppender.append("style", "color:" + compositedIcon.getBasicIconHtmlColor()));
}
}
layeredIcon.add(basicIcon);
Expand Down

0 comments on commit 3164267

Please sign in to comment.