package org.ovirt.engine.ui.common.widget.table.column;

import org.ovirt.engine.core.common.businessentities.Permissions;

import com.google.gwt.resources.client.ImageResource;

/**
 * Image column that corresponds to XAML {@code PermissionTypeDataTemplate}.
 */
public class PermissionTypeColumn extends ImageResourceColumn<Permissions> {

    @Override
    public ImageResource getValue(Permissions user) {
        switch (user.getRoleType()) {
        case ADMIN:
            return getCommonResources().adminImage();
        case USER:
            return getCommonResources().userImage();
        default:
            return getCommonResources().userImage();
        }
    }

}

@@ -50,16 +50,46 @@
 olumn;%0A%0A
+import java.util.Comparator;%0A%0A
 import o
@@ -365,16 +365,449 @@
 ons%3E %7B%0A%0A
+    public PermissionTypeColumn() %7B%0A        makeSortable(new Comparator%3CPermissions%3E() %7B%0A%0A            @Override%0A            public int compare(Permissions o1, Permissions o2) %7B%0A                if (getValue(o1).equals(getValue(o2))) %7B%0A                    return 0;%0A                %7D else %7B%0A                    return (getCommonResources().userImage().equals(getValue(o1))) ? -1 : 1;%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A
     @Ove

Implement permission sorting by role icon