This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
UserPanel.java
70 lines (60 loc) · 2.24 KB
/
UserPanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package org.zanata.webtrans.client.ui;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
public class UserPanel extends ListItemWidget implements HasManageUserPanel {
private static final long serialVersionUID = 1L;
private final Image userImage;
private final String personName;
private final ListItemWidget colorLabel = new ListItemWidget();
public UserPanel(String personName, String imgUrl) {
super();
UnorderedListWidget container = new UnorderedListWidget();
container.setStyleName("list--horizontal");
this.personName = personName;
userImage = new Image(imgUrl);
container.add(new ListItemWidget(userImage));
container.add(new ListItemWidget(colorLabel));
container.add(new ListItemWidget(personName));
add(container);
}
@Override
public void setColor(String color) {
colorLabel.getElement().getStyle().setProperty("borderColor", color);
colorLabel.getElement().getStyle().setProperty("borderWidth", "1px");
colorLabel.getElement().getStyle().setProperty("borderStyle", "solid");
colorLabel.getElement().getStyle().setProperty("height", "1.25em");
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result =
prime * result
+ ((personName == null) ? 0 : personName.hashCode());
result =
prime * result
+ ((userImage == null) ? 0 : userImage.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UserPanel other = (UserPanel) obj;
if (personName == null) {
if (other.personName != null)
return false;
} else if (!personName.equals(other.personName))
return false;
if (userImage == null) {
if (other.userImage != null)
return false;
} else if (!userImage.equals(other.userImage))
return false;
return true;
}
}