Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setOutputMarkupId

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setOutputMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setOutputMarkupId.

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

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 ww  w. j  av a 2 s. c o 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   w ww  .java 2  s.c om
    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  a  v  a 2s .  com
        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 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);/*from w  w  w .j  a  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   w w  w.j a  va  2 s.c o  m*/
    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);/*from   www. j av a2 s .co 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);
}

From source file:ro.nextreports.server.web.dashboard.WidgetPopupMenuModel.java

License:Apache License

private AjaxLink createEditLink(final IModel<Widget> model) {
    AjaxLink<Void> editLink = new AjaxLink<Void>(MenuPanel.LINK_ID) {

        @Override/*from  w  w  w.j a va2s.c  o m*/
        public void onClick(AjaxRequestTarget target) {

            final Widget widget = model.getObject();
            final ModalWindow dialog = findParent(BasePage.class).getDialog();

            dialog.setTitle(new StringResourceModel("WidgetPopupMenu.editSettings", null).getString());
            dialog.setUseInitialHeight(false);
            dialog.setOutputMarkupId(true);

            final WidgetRuntimeModel runtimeModel;
            final ParameterRuntimePanel paramRuntimePanel;

            final EntityWidget entityWidget = (EntityWidget) widget;

            String userDataPath = WidgetUtil.getUserWidgetParametersPath(ServerUtil.getUsername()) + "/"
                    + entityWidget.getId();
            UserWidgetParameters wp = null;
            try {
                String dashboardId = getDashboardId(entityWidget.getId());
                String owner = dashboardService.getDashboardOwner(dashboardId);
                String user = ServerUtil.getUsername();
                boolean isDashboardLink = !owner.equals(user);
                boolean hasWrite = securityService.hasPermissionsById(user, PermissionUtil.getWrite(),
                        dashboardId);
                if (isDashboardLink && !hasWrite) {
                    wp = (UserWidgetParameters) storageService.getEntity(userDataPath);
                }
            } catch (NotFoundException e) {
                // nothing to do
                Log.info("There is no UserWidgetParameters for : " + userDataPath);
                System.out.println("----> NOT FOUND");
            }
            final UserWidgetParameters fwp = wp;

            runtimeModel = ChartUtil.getRuntimeModel(storageService.getSettings(), entityWidget, reportService,
                    dataSourceService, true, fwp);
            if ((widget instanceof ChartWidget) || ((widget instanceof DrillDownWidget)
                    && (((DrillDownWidget) widget).getEntity() instanceof Chart))) {
                Chart chart = (Chart) entityWidget.getEntity();
                paramRuntimePanel = new ChartRuntimePanel("chartRuntimePanel", chart, runtimeModel);
            } else if ((widget instanceof TableWidget) || ((widget instanceof DrillDownWidget)
                    && (((DrillDownWidget) widget).getEntity() instanceof Report))) {
                paramRuntimePanel = new TableWidgetRuntimePanel("chartRuntimePanel", entityWidget.getEntity(),
                        runtimeModel);
            } else {
                paramRuntimePanel = new GeneralWidgetRuntimePanel("chartRuntimePanel", entityWidget.getEntity(),
                        runtimeModel);
            }

            boolean isDynamic = false;
            if (paramRuntimePanel instanceof DynamicParameterRuntimePanel) {
                if (((DynamicParameterRuntimePanel) paramRuntimePanel).hasDynamicParameter()) {
                    isDynamic = true;
                }
            }

            if (paramRuntimePanel.hasPalette()) {
                if (isDynamic) {
                    dialog.setInitialWidth(720);
                } else {
                    dialog.setInitialWidth(685);
                }
            } else {
                if (isDynamic) {
                    dialog.setInitialWidth(445);
                } else {
                    dialog.setInitialWidth(435);
                }
            }

            final Component component = this;

            dialog.setContent(new WidgetSettingsPanel(dialog.getContentId(), paramRuntimePanel) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onChange(AjaxRequestTarget target) {
                    changeSettings(getFeedbackPanel(), component, widget, runtimeModel, target);
                }

                @Override
                public void onCancel(AjaxRequestTarget target) {
                    ModalWindow.closeCurrent(target);
                }

                @Override
                public void onReset(AjaxRequestTarget target) {
                    resetSettings(getFeedbackPanel(), component, widget, target);
                }
            });

            dialog.show(target);
        }

        //         @Override
        //            public boolean isVisible() {            
        //            return hasWritePermission(model.getObject());
        //         }              
    };

    return editLink;
}