Search in sources :

Example 1 with UserActionWithValue

use of jetbrains.communicator.util.UserActionWithValue in project intellij-plugins by JetBrains.

the class UserTreeRenderer method customizeCellRenderer.

public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    TreeUtils.convertValueIfUserNode(value, new UserActionWithValue() {

        public Object execute(User user) {
            append(user.getDisplayName() + " ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
            append(user.getPresence().getDisplayText(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
            setIcon(user.getIcon());
            customizeUserNode(user);
            return null;
        }
    });
    if (TreeUtils.getUserObject(value) instanceof String) {
        // group
        if (leaf) {
            setIcon(IdetalkCoreIcons.Nodes.Group_close);
        } else {
            setIcon(IconLoader.getIcon(expanded ? "/nodes/group_open.png" : "/nodes/group_close.png"));
        }
        String group = value.toString();
        append(group, getGroupAttributes(group));
    }
}
Also used : User(jetbrains.communicator.core.users.User) UserActionWithValue(jetbrains.communicator.util.UserActionWithValue)

Aggregations

User (jetbrains.communicator.core.users.User)1 UserActionWithValue (jetbrains.communicator.util.UserActionWithValue)1