Skip to content

Commit

Permalink
Adjusting the icons
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 12, 2016
1 parent 99f0e6e commit 14cdd15
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 21 deletions.
Expand Up @@ -33,7 +33,7 @@ public class GuiStyleConstants {
public static final String STYLES_OBJECT_SERVICE_ICON = "fa fa-cloud";
public static final String STYLES_OBJECT_SERVICE_ICON_COLORED = STYLES_OBJECT_SERVICE_ICON + " object-service-color";

public static final String STYLES_OBJECT_RESOURCE_ICON = "fa fa-laptop";
public static final String STYLES_OBJECT_RESOURCE_ICON = "fa fa-database";
public static final String STYLES_OBJECT_RESOURCE_ICON_COLORED = STYLES_OBJECT_RESOURCE_ICON + " object-resource-color";

public static final String STYLES_OBJECT_TASK_ICON = "fa fa-tasks";
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.gui.api.component;

import java.util.Collection;
Expand All @@ -21,8 +36,10 @@
import com.evolveum.midpoint.web.page.admin.configuration.PageImportObject;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

/**
* @author katkav
*/
public abstract class MainObjectListPanel<T extends ObjectType> extends ObjectListPanel<T> {

private static final long serialVersionUID = 1L;

private static final String ID_REFRESH = "refresh";
Expand All @@ -42,7 +59,7 @@ protected void onClickPerformed(AjaxRequestTarget target) {
};
add(refreshIcon);

LinkIconPanel newObjectIcon = new LinkIconPanel(ID_NEW_OBJECT, new Model<String>("fa fa-edit")){
LinkIconPanel newObjectIcon = new LinkIconPanel(ID_NEW_OBJECT, new Model<String>("fa fa-edit")){

@Override
protected void onClickPerformed(AjaxRequestTarget target) {
Expand All @@ -51,7 +68,7 @@ protected void onClickPerformed(AjaxRequestTarget target) {
};
add(newObjectIcon);

LinkIconPanel importObject = new LinkIconPanel(ID_IMPORT_OBJECT, new Model<String>("fa fa-download")){
LinkIconPanel importObject = new LinkIconPanel(ID_IMPORT_OBJECT, new Model<String>("fa fa-download")){

@Override
protected void onClickPerformed(AjaxRequestTarget target) {
Expand Down
Expand Up @@ -64,12 +64,12 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
* @author katkav
*/
public abstract class ObjectListPanel<T extends ObjectType> extends BasePanel<T> {

/**
*
*/
private static final long serialVersionUID = 1L;

// private static final String ID_SEARCH_FORM = "searchForm";
private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_BUTTON_CANCEL = "cancelButton";
Expand Down
Expand Up @@ -16,6 +16,7 @@

package com.evolveum.midpoint.gui.api.util;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.prism.*;
Expand Down Expand Up @@ -733,37 +734,51 @@ public static String createUserIcon(PrismObject<UserType> object) {
continue;
}
if (StringUtils.equals(targetRef.getOid(), SystemObjectsType.ROLE_SUPERUSER.value())) {
return "fa fa-male text-danger";
return GuiStyleConstants.STYLES_OBJECT_USER_ICON + " text-danger";
}
}

ActivationType activation = user.getActivation();
if (activation != null && ActivationStatusType.DISABLED.equals(activation.getEffectiveStatus())) {
return "fa fa-male text-muted";
}

return "fa fa-male";
return getIconEnabledDisabled(object, GuiStyleConstants.STYLES_OBJECT_USER_ICON);
}


public static String createRoleIcon(PrismObject<RoleType> object) {
return "fa fa-street-view";
return getIconEnabledDisabled(object, GuiStyleConstants.STYLES_OBJECT_ROLE_ICON);
}

public static String createOrgIcon(PrismObject<OrgType> object) {
return "fa fa-building";
return getIconEnabledDisabled(object, GuiStyleConstants.STYLES_OBJECT_ORG_ICON);
}

public static String createServiceIcon(PrismObject<ServiceType> object) {
return "fa fa-building";
return getIconEnabledDisabled(object, GuiStyleConstants.STYLES_OBJECT_SERVICE_ICON);
}


private static <F extends FocusType> String getIconEnabledDisabled(PrismObject<F> object, String baseIcon) {
ActivationType activation = object.asObjectable().getActivation();
if (activation != null && ActivationStatusType.DISABLED.equals(activation.getEffectiveStatus())) {
return baseIcon + " text-muted";
}

return baseIcon;
}

public static String createResourceIcon(PrismObject<ResourceType> object) {
return "fa fa-laptop";
OperationalStateType operationalState = object.asObjectable().getOperationalState();
if (operationalState != null) {
AvailabilityStatusType lastAvailabilityStatus = operationalState.getLastAvailabilityStatus();
if (lastAvailabilityStatus == AvailabilityStatusType.UP) {
return GuiStyleConstants.STYLES_OBJECT_RESOURCE_ICON + " text-success";
}
if (lastAvailabilityStatus == AvailabilityStatusType.DOWN) {
return GuiStyleConstants.STYLES_OBJECT_RESOURCE_ICON + " text-danger";
}
}
return GuiStyleConstants.STYLES_OBJECT_RESOURCE_ICON;
}

public static String createTaskIcon(PrismObject<TaskType> object) {
return "fa fa-tasks";
return GuiStyleConstants.STYLES_OBJECT_TASK_ICON;
}

public static String createShadowIcon(PrismObject<ShadowType> object) {
Expand Down

0 comments on commit 14cdd15

Please sign in to comment.