Unrelated cleanup in UserComponentListRenderer
This commit is contained in:
parent
480961370c
commit
0258e04612
@ -9,6 +9,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import envoy.client.data.Settings;
|
||||
import envoy.client.ui.Color;
|
||||
import envoy.client.ui.Theme;
|
||||
import envoy.client.ui.list.ComponentList;
|
||||
import envoy.client.ui.list.ComponentListCellRenderer;
|
||||
@ -28,46 +29,42 @@ public class UserComponentListRenderer implements ComponentListCellRenderer<User
|
||||
private static final long serialVersionUID = -2379244319112111284L;
|
||||
|
||||
@Override
|
||||
public JComponent getListCellComponent(ComponentList<? extends User> list, User value, boolean isSelected) {
|
||||
public JComponent getListCellComponent(ComponentList<? extends User> list, User user, boolean isSelected) {
|
||||
final Theme theme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme());
|
||||
|
||||
final JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
final Theme theme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme());
|
||||
|
||||
// Panel background
|
||||
panel.setBackground(isSelected ? theme.getSelectionColor() : theme.getCellColor());
|
||||
panel.setOpaque(true);
|
||||
|
||||
panel.setPreferredSize(new Dimension(100, 35));
|
||||
|
||||
// TODO add profile picture support in BorderLayout.West
|
||||
|
||||
JLabel username = new JLabel(value.getName());
|
||||
JLabel username = new JLabel(user.getName());
|
||||
username.setForeground(theme.getUserNameColor());
|
||||
panel.add(username, BorderLayout.CENTER);
|
||||
|
||||
final UserStatus status = value.getStatus();
|
||||
final UserStatus status = user.getStatus();
|
||||
JLabel statusLabel = new JLabel(status.toString());
|
||||
java.awt.Color foreground;
|
||||
Color foreground;
|
||||
switch (status) {
|
||||
case OFFLINE:
|
||||
foreground = java.awt.Color.LIGHT_GRAY;
|
||||
break;
|
||||
case AWAY:
|
||||
foreground = java.awt.Color.YELLOW;
|
||||
foreground = Color.yellow;
|
||||
break;
|
||||
case BUSY:
|
||||
foreground = java.awt.Color.BLUE;
|
||||
foreground = Color.blue;
|
||||
break;
|
||||
case ONLINE:
|
||||
foreground = java.awt.Color.GREEN;
|
||||
foreground = Color.green;
|
||||
break;
|
||||
default:
|
||||
foreground = java.awt.Color.LIGHT_GRAY;
|
||||
foreground = Color.lightGray;
|
||||
break;
|
||||
}
|
||||
statusLabel.setForeground(foreground);
|
||||
panel.add(statusLabel, BorderLayout.NORTH);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user