Tuesday, February 26, 2013

Disable a specific button in a ButtonCell

Hey,

we tried it in different ways and we couldnt find a solution for our problem.
We create a Table with games, so a lobby and there are all our games with informations and a "join"-button.
If the game is full or the user is already in the game, we want to disable the button.

// Join Column for the Game (Join a Game)
ButtonCell joinGame = new ButtonCell();
Column<Game,String> gameOption = new Column<Game,String>(joinGame) {
public String getValue(Game game) {
if(game instanceof RunningGame){
return "Game is running";
}else if(!game.hasFreeSlot()){
return "Game is full";
}else if(game.containsUser(Presenter.currentUser.getName())){
return "You are already in this game";
}
return "Go in";
}
};

 Like this we get after every redraw the right caption for the buttons. We used a lot of time to write a new class for deactivatable ButtonCells, but it didnt work.

Can anyone please help us?

Best Regards
Björn

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment