for (int i = 0; i < userTurnList.size(); i++) {
final int tmp = i;
final String cell = "<img src = 'http://graph.facebook.com/" + userTurnList.get(i).getId()
+ "/picture' height = '50px' width = '50px'>" + userTurnList.get(i).getName() + " / "
+ "["+(userTurnList.get(i).getRank()-2*userTurnList.get(i).getrd())+" , "+(userTurnList.get(i).getRank()+2*userTurnList.get(i).getrd())+"]" + " / Your Turn";
SafeHtml friendCell = new SafeHtml() {
@Override
public String asString() {
return cell;
}
};
friendList.addItem(friendCell, new Command() {
@Override
public void execute() {
AsyncCallback<MatchInfo> callback = new AsyncCallback<MatchInfo>(){
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(MatchInfo result) { //load the game from the server
presenter.loadGame(result.toString());
}
};
opponentId = userTurnList.get(tmp).getId();
loginService.LoadMatchByOpponentInDropdown(fbUid, opponentId, callback);
}
});
}
for (int i = 0; i < opponentTurnList.size(); i++) {
final String cell = "<img src = 'http://graph.facebook.com/" + opponentTurnList.get(i).getId()
+ "/picture' height = '50px' width = '50px'>" + opponentTurnList.get(i).getName() + " / "
+ "["+(opponentTurnList.get(i).getRank()-2*opponentTurnList.get(i).getrd())+" , "+(opponentTurnList.get(i).getRank()+2*opponentTurnList.get(i).getrd())+"]" + " / Opponent Turn";
SafeHtml friendCell = new SafeHtml() {
@Override
public String asString() {
return cell;
}
};
final int tmp = i;
friendList.addItem(friendCell, new Command() {
@Override
public void execute() {
AsyncCallback<MatchInfo> callback = new AsyncCallback<MatchInfo>(){
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(MatchInfo result) { //load the game from the server
presenter.loadGame(result.toString());
}
};
opponentId = opponentTurnList.get(tmp).getId();
loginService.LoadMatchByOpponentInDropdown(fbUid, opponentId, callback);
}
});
}
for (int i = 0; i < noAgainstList.size(); i++) {
final int tmp = i;
final String cell = "<img src = 'http://graph.facebook.com/" + noAgainstList.get(i).getId()
+ "/picture' height = '50px' width = '50px'>" + noAgainstList.get(i).getName() + " / "
+"["+(noAgainstList.get(i).getRank()-2*noAgainstList.get(i).getrd())+" , "+(noAgainstList.get(i).getRank()+2*noAgainstList.get(i).getrd())+"]";
SafeHtml friendCell = new SafeHtml() {
@Override
public String asString() {
return cell;
}
};