List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow getContentId
public String getContentId()
From source file:ontopoly.pages.ModalGeoPickerPage.java
License:Apache License
public ModalGeoPickerPage(ModalWindow dialog, Topic thetopic) { super(dialog.getContentId()); this.dialog = dialog; this.thetopic = new TopicModel<Topic>(thetopic); //setInitialHeight(700); final WebMarkupContainer popupContent = new WebMarkupContainer("popupContent"); popupContent.setOutputMarkupId(true); add(popupContent);// w w w .j a v a 2s . co m popupContent.add(new Label("title", new Model<String>("Pick location for '" + thetopic.getName() + "'"))); behave = new ReceiveRequest(this); this.add(behave); // using a label to provide the callback URI to the JavaScript code // in the page. unfortunately, we don't know the URI here, so we set // things up, then insert it later. ajaxurlmodel = new Model<String>("// and the url is ..."); ajaxurllabel = new Label("ajaxurl", ajaxurlmodel); ajaxurllabel.setEscapeModelStrings(false); popupContent.add(ajaxurllabel); }
From source file:org.alienlabs.hatchetharry.view.page.HomePage.java
License:Open Source License
private ModalWindow generateAboutLink(final String id, final ModalWindow window) { window.setInitialWidth(450);//w w w . j a v a2 s.c o m window.setInitialHeight(700); window.setTitle("About HatchetHarry"); window.setContent(new AboutModalWindow(window.getContentId(), window)); window.setCssClassName(ModalWindow.CSS_CLASS_GRAY); window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT); this.add(window); final AjaxLink<Void> aboutLink = 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); } }; aboutLink.setOutputMarkupId(true); window.setOutputMarkupId(true); this.add(aboutLink); return window; }
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 .j av a 2 s. co 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 om*/ 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 2 s.co 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 w w w.j a va 2 s .co m 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 ww w.j a v a2s . c o 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//w w w . j av a 2 s . co m 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);//from w ww . j a v a 2 s . c o m 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);// w w w . j a v a 2 s . c om 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); }