1 7 8 package poker.presentation.main; 9 10 import com.lutris.appserver.server.httpPresentation.HttpPresentation; 12 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms; 13 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 14 import com.lutris.util.KeywordValueException; 15 import com.lutris.appserver.server.session.SessionException; 16 17 import poker.Poker; 18 import poker.spec.PokerGame; 19 import poker.spec.GameManager; 20 21 public class QuitPresentation implements HttpPresentation { 22 23 public void run(HttpPresentationComms comms) 24 throws HttpPresentationException, SessionException, KeywordValueException { 25 26 QuitHTML quit; 27 quit = (QuitHTML)comms.xmlcFactory.create(QuitHTML.class); 28 29 Poker mainApp = (Poker)comms.session.getSessionData().get("app"); 30 GameManager gameManager = mainApp.getGameManager(); 31 PokerGame game = (PokerGame)comms.session.getSessionData().get("game"); 32 33 38 try{ 39 String name = game.getName(); 40 quit.setTextName(name); 41 42 comms.session.setUser(null); 43 if (game.getCash() < 1){ 44 gameManager.removeGame(name); 45 } 46 }catch (NullPointerException e){} 47 comms.response.writeDOM(quit); 48 } 49 50 } 51 | Popular Tags |