List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setContent
public ModalWindow setContent(final Component component)
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateMulliganLink(final String id, final ModalWindow window) { window.setInitialWidth(500);//from w w w.ja va 2s . c o m window.setInitialHeight(150); window.setTitle("HatchetHarry - Mulligan"); window.setContent(new MulliganModalWindow(window, window.getContentId())); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.add(window); final AjaxLink<Void> mulliganLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 8140325977385015896L; @Override public void onClick(final AjaxRequestTarget target) { target.prependJavaScript(BattlefieldService.HIDE_MENUS); target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); window.show(target); } }; mulliganLink.setOutputMarkupId(true); window.setOutputMarkupId(true); this.add(mulliganLink); return window; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateTeamInfoLink(final String id, final ModalWindow window) { window.setInitialWidth(475);//from w w w. j a va 2 s . c o m window.setInitialHeight(750); window.setTitle("HatchetHarry Team info"); window.setContent(new TeamInfoModalWindow(window.getContentId(), window)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.add(window); final AjaxLink<Void> teamInfoLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 8140325977385015896L; @Override public void onClick(final AjaxRequestTarget target) { target.prependJavaScript(BattlefieldService.HIDE_MENUS); target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); window.show(target); } }; teamInfoLink.setOutputMarkupId(true); window.setOutputMarkupId(true); this.add(teamInfoLink); return window; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateCreateGameModalWindow(final String id, final Player _player, final ModalWindow window) { window.setInitialWidth(475);/* w ww. j a v a 2s . c o m*/ window.setInitialHeight(550); window.setTitle("Create a match"); window.setContent(new CreateGameModalWindow(window, window.getContentId(), _player, this)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.createGameLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget _target) { _target.prependJavaScript(BattlefieldService.HIDE_MENUS); _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); window.show(_target); } }; this.createGameLink.setOutputMarkupId(true).setMarkupId(id); this.createGameWindow.setOutputMarkupId(true); this.add(this.createGameLink); return window; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateJoinGameModalWindow(final String id, final Player _player, final ModalWindow window) { window.setInitialWidth(475);/*from www.j a va 2 s .c om*/ window.setInitialHeight(430); window.setTitle("Join a match"); window.setContent( new JoinGameModalWindow(window, window.getContentId(), _player, this.dataBoxParent, this)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.joinGameLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget _target) { _target.prependJavaScript(BattlefieldService.HIDE_MENUS); _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); window.show(_target); } }; this.joinGameLink.setOutputMarkupId(true).setMarkupId(id); window.setOutputMarkupId(true); this.add(this.joinGameLink); return window; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateJoinGameWithoutIdModalWindow(final String id, final Player _player, final ModalWindow window) { window.setInitialWidth(475);/*from w w w . ja va2s . co m*/ window.setInitialHeight(500); window.setTitle("Join a match without ID"); window.setContent( new JoinGameWithoutIdModalWindow(window, window.getContentId(), _player, this.dataBoxParent, this)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.joinGameWithoutIdLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget _target) { _target.prependJavaScript(BattlefieldService.HIDE_MENUS); _target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); window.show(_target); } }; this.joinGameWithoutIdLink.setOutputMarkupId(true).setMarkupId(id); window.setOutputMarkupId(true); this.add(this.joinGameWithoutIdLink); return window; }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generateRevealTopLibraryCardLink(final String id, final String idModalWindow) { final ModalWindow window = new ModalWindow(idModalWindow); window.setWindowClosedCallback(new WindowClosedCallback() { private static final long serialVersionUID = 1L; @Override/*from w w w.j av a 2s.c om*/ public void onClose(final AjaxRequestTarget target) { if (HomePage.this.session.getTopCardIndex() > 0L) { HomePage.this.session .setTopCardIndex(Long.valueOf(HomePage.this.session.getTopCardIndex() - 1L)); } } }); window.setInitialWidth(500); window.setInitialHeight(510); final List<MagicCard> allCardsInLibrary = this.persistenceService.getAllCardsInLibraryForDeckAndPlayer( this.session.getGameId(), this.session.getPlayer().getId(), this.session.getPlayer().getDeck().getDeckId()); final MagicCard firstCard; if (allCardsInLibrary.isEmpty()) { firstCard = null; } else { firstCard = allCardsInLibrary.get(this.session.getTopCardIndex().intValue()); } window.setContent(new RevealTopLibraryCardModalWindow(window.getContentId(), window, firstCard)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setOutputMarkupId(true); this.revealTopLibraryCardWindow = window; this.add(this.revealTopLibraryCardWindow); final AjaxLink<Void> revealTopLibraryCardLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @SuppressWarnings("boxing") @SuppressFBWarnings({ "PATH_TRAVERSAL_IN", "PATH_TRAVERSAL_IN" }) @Override public void onClick(final AjaxRequestTarget target) { final List<MagicCard> _allCardsInLibrary = HomePage.this.persistenceService .getAllCardsInLibraryForDeckAndPlayer(HomePage.this.session.getGameId(), HomePage.this.session.getPlayer().getId(), HomePage.this.session.getPlayer().getDeck().getDeckId()); if (_allCardsInLibrary.isEmpty()) { return; } final MagicCard _firstCard = _allCardsInLibrary .get(HomePage.this.session.getTopCardIndex().intValue()); final String topCardName = _firstCard.getBigImageFilename(); final String cardPath = ResourceBundle.getBundle(HatchetHarryApplication.class.getCanonicalName()) .getString("SharedResourceFolder"); final String cardPathAndName = cardPath.replace("/cards", "") + topCardName; final File from = new File(cardPathAndName); final File to = new File(cardPath + "topLibraryCard.jpg"); try { Files.copy(from, to); } catch (final IOException e) { HomePage.LOGGER.error( "could not copy from: " + cardPathAndName + " to: " + cardPath + "topLibraryCard.jpg", e); } final Long _gameId = HomePage.this.persistenceService .getPlayer(HomePage.this.session.getPlayer().getId()).getGame().getId(); final RevealTopLibraryCardCometChannel chan = new RevealTopLibraryCardCometChannel( HomePage.this.session.getPlayer().getName(), _firstCard, HomePage.this.session.getTopCardIndex()); final ConsoleLogStrategy logger = AbstractConsoleLogStrategy.chooseStrategy( ConsoleLogType.REVEAL_TOP_CARD_OF_LIBRARY, null, null, null, _firstCard.getTitle(), HomePage.this.session.getPlayer().getName(), null, HomePage.this.session.getTopCardIndex() + 1L, null, Boolean.FALSE, _gameId); final List<BigInteger> allPlayersInGame = HomePage.this.persistenceService .giveAllPlayersFromGame(_gameId); EventBusPostService.post(allPlayersInGame, chan, new ConsoleLogCometChannel(logger)); } }; revealTopLibraryCardLink.setOutputMarkupId(true).setMarkupId(id); this.add(revealTopLibraryCardLink); }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generateCreateTokenLink(final String id, final ModalWindow window) { window.setInitialWidth(500);/* w w w . j a v a2 s .c om*/ window.setInitialHeight(510); final CreateTokenModalWindow createTokenModalWindow = new CreateTokenModalWindow(window.getContentId(), window); window.setContent(createTokenModalWindow); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setTitle("Create a token"); window.setOutputMarkupId(true); this.setCreateTokenModalWindow(window); this.add(window); final AjaxLink<Void> createTokenLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { target.prependJavaScript(BattlefieldService.HIDE_MENUS); target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); HomePage.this.createTokenWindow.show(target); } }; createTokenLink.setOutputMarkupId(true).setMarkupId(id); this.add(createTokenLink); }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generateCountCardsLink(final String id, final ModalWindow window) { window.setInitialWidth(740);//from w w w .ja v a 2 s. c o m window.setInitialHeight(550); window.setContent(new CountCardsModalWindow(window.getContentId(), this.session.getGameId())); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setOutputMarkupId(true); this.add(window); final AjaxLink<Void> countCardsLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { target.prependJavaScript(BattlefieldService.HIDE_MENUS); final Long _gameId = HomePage.this.session.getGameId(); final CountCardsCometChannel cccc = new CountCardsCometChannel(_gameId, HomePage.this.session.getPlayer().getName()); final List<BigInteger> allPlayersInGame = HomePage.this.persistenceService .giveAllPlayersFromGame(_gameId); EventBusPostService.post(allPlayersInGame, cccc); } }; countCardsLink.setOutputMarkupId(true); this.add(countCardsLink); }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generateLoginLink(final String id, final ModalWindow window) { window.setInitialWidth(300);//from www . ja va 2s .c om window.setInitialHeight(200); window.setTitle("HatchetHarry login"); window.setContent(new LoginModalWindow(window.getContentId(), window)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setOutputMarkupId(true); window.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { private static final long serialVersionUID = 1L; @Override public boolean onCloseButtonClicked(final AjaxRequestTarget target) { target.appendJavaScript("authenticateUserWithFacebook();"); return true; } }); this.add(window); final AjaxLink<Void> loginLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { target.prependJavaScript(BattlefieldService.HIDE_MENUS); target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); HomePage.this.loginWindow.show(target); } }; loginLink.setOutputMarkupId(true); this.add(loginLink); }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private void generatePreferencesLink(final String id, final ModalWindow window) { window.setInitialWidth(630);// www .jav a 2 s . c o m window.setInitialHeight(300); window.setTitle("User preferences"); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); window.setOutputMarkupId(true); this.add(window); final AjaxLink<Void> preferencesLink = new AjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { window.setContent(new UserPreferencesModalWindow(window.getContentId(), window)); target.prependJavaScript(BattlefieldService.HIDE_MENUS); target.appendJavaScript("Wicket.Window.unloadConfirmation = false;"); HomePage.this.preferencesWindow.show(target); } }; preferencesLink.setOutputMarkupId(true); this.add(preferencesLink); }