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

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

Introduction

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

Prototype

public ModalWindow setInitialWidth(final int initialWidth) 

Source Link

Document

Sets the initial width of the window.

Usage

From source file:nl.knaw.dans.common.wicket.components.popup.confirm.ConfirmPanel.java

License:Apache License

protected ModalWindow createConfirmModal(String id, String modalMessageText, String modalTitleText) {
    ModalWindow modalWindow = new ModalWindow("confirmModal");
    modalWindow.setTitle(modalTitleText);
    modalWindow.setUseInitialHeight(false);
    modalWindow.setInitialWidth(400);
    modalWindow.setCookieName(id);//from  w w w  . j a va2 s  .co  m

    modalWindow.setContent(new YesNoPanel(modalWindow, modalMessageText, answer));

    modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        private static final long serialVersionUID = -3911323073933533800L;

        @Override
        public void onClose(AjaxRequestTarget target) {
            if (answer.isAnswer()) {
                onConfirm(target);
            } else {
                onCancel(target);
            }
        }
    });
    return modalWindow;
}

From source file:nl.knaw.dans.dccd.common.web.confirm.ConfirmDialogPanel.java

License:Apache License

private void initModalWindow(final ModalWindow modalWindow) {
    modalWindow.setTitle("Please confirm");
    // use label from property files when available
    try {//w w w  .jav a2 s.c o  m
        String title = getString("confirmDialog.title");
        //if (title != null && !title.isEmpty())
        modalWindow.setTitle(title);
    } catch (MissingResourceException e) {
        // do Nothing
    }

    modalWindow.setInitialHeight(150);
    modalWindow.setInitialWidth(250);
}

From source file:nl.knaw.dans.dccd.web.search.pages.AdvSearchPage.java

License:Apache License

private void initTaxonSelection(final AdvancedSearchForm form, final AdvSearchData data) {
    // With plain text input:
    //add(new TextField("elementTaxon", new SearchFieldModel(data, "elementTaxon")));
    // With autocomplete:
    //add(new TridasVocabularyAutoCompleteSelector("elementTaxon", 
    //      new SearchFieldModel(data, "elementTaxon"),
    //      "element.taxon"));         
    // With ComboBox:
    final DropDown elemTaxonComboBox = new DropDown("elementTaxon", new SearchFieldModel(data, "elementTaxon"),
            new DropDownDataSource<String>() {
                private static final long serialVersionUID = 1L;

                public String getName() {
                    return "element.taxon";
                }//  www . j ava2 s  .  c  o m

                public List<String> getValues() {
                    // Use current language to get terms for that language
                    String langCode = getSession().getLocale().getLanguage();
                    return DccdVocabularyService.getService().getTerms("element.taxon", langCode);
                }

                public String getDescriptionForValue(String t) {
                    return t;
                }
            }, false);
    elemTaxonComboBox.setCharacterWidth(25);
    elemTaxonComboBox.setOutputMarkupId(true);
    //form.add(elemTaxonComboBox);
    // FIX Container is needed to workaround visural-wicket ISSUE 67
    final WebMarkupContainer taxonContainer = new WebMarkupContainer("elementTaxonContainer");
    taxonContainer.setOutputMarkupId(true);
    form.add(taxonContainer);
    taxonContainer.add(elemTaxonComboBox);

    //TEST adding the window with the table
    //Problem, the TaxonSelectPanel wants a real TridasTaxon
    final ModalWindow modalSelectDialog;
    form.add(modalSelectDialog = new ModalWindow("taxonSelectPanel"));
    final TaxonSelectPanel taxonSelectPanel = new TaxonSelectPanel(modalSelectDialog.getContentId(),
            new Model(null)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSelectionChanged(AjaxRequestTarget target) {
            String taxonString = getSelectionAsString();
            LOGGER.debug("Selected taxon: " + taxonString);
            data.elementTaxon.setValue(taxonString);
            //target.addComponent(elemTaxonComboBox);
            // FIX   workaround visural-wicket ISSUE 67 by updating the container         
            target.addComponent(taxonContainer);
        }
    };
    modalSelectDialog.setContent(taxonSelectPanel);
    //modalSelectDialog.setTitle(ProjectPermissionSettingsPage.this.getString("userAddDialogTitle"));
    modalSelectDialog.setCookieName("taxonSelectPanelWindow");
    modalSelectDialog.setInitialWidth(400);
    modalSelectDialog.setInitialHeight(160);
    modalSelectDialog.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        private static final long serialVersionUID = 1L;

        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            return true;
        }
    });

    //button to show the dialog
    AjaxLink taxonSelectButton = new IndicatingAjaxLink("taxonSelectButton") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            //LOGGER.debug("term=" + data.elementTaxon.getValue());
            //taxonSelectPanel.selectTerm(elemTaxonComboBox.getValue());
            modalSelectDialog.show(target);
        }
    };
    form.add(taxonSelectButton);
}

From source file:nl.mpi.lamus.web.components.ConfirmPanel.java

License:Open Source License

public ConfirmPanel(String id, final ModalWindow modalWindow, final ConfirmationOptions options) {
    super(id);/*w ww . jav  a 2 s  . c o m*/

    Form confirmSubmitForm = new Form("confirmSubmitForm");

    MultiLineLabel infoText = new MultiLineLabel("confirmation_info_text", options.getConfirmationInfoText());

    confirmSubmitForm.add(infoText);

    confirmSubmitForm.add(new Label("confirmation_text", options.getConfirmationText()));

    CheckBox keepUnlinkedFilesCheckbox = new CheckBox("checkbox", Model.of(options.isKeepUnlinkedFiles())) {

        @Override
        protected void onSelectionChanged(Boolean newSelection) {
            options.setKeepUnlinkedFiles(newSelection);
        }

        @Override
        protected void onModelChanged() {
            options.setKeepUnlinkedFiles(getModelObject());
        }
    };

    keepUnlinkedFilesCheckbox.setLabel(Model.of("keep unlinked files"));
    confirmSubmitForm.add(keepUnlinkedFilesCheckbox);

    modalWindow.setTitle("Please confirm");

    if (options.getConfirmationInfoText() != null && !options.getConfirmationInfoText().isEmpty()) {
        modalWindow.setInitialHeight(300);
        modalWindow.setInitialWidth(580);
    } else {
        infoText.setVisible(Boolean.FALSE);
        modalWindow.setInitialHeight(200);
        modalWindow.setInitialWidth(350);
    }

    AjaxButton yesButton = new AjaxButton("yesButton", confirmSubmitForm) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            if (target != null) {
                options.setConfirmed(true);
                modalWindow.close(target);
            }
        }
    };

    AjaxButton noButton = new AjaxButton("noButton", confirmSubmitForm) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            if (target != null) {
                options.setConfirmed(false);
                modalWindow.close(target);
            }
        }
    };

    confirmSubmitForm.add(yesButton);
    confirmSubmitForm.add(noButton);

    add(confirmSubmitForm);
}

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);
    window.setInitialHeight(700);//from w  w w.j a v a  2  s  . c  om
    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);
    window.setInitialHeight(150);// ww  w . ja va2s  .  c  om
    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);
    window.setInitialHeight(750);//w  w w .  j  a  v a  2s.  c  om
    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);
    window.setInitialHeight(550);//from  w w  w  . ja v a2s .com
    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);
    window.setInitialHeight(430);/*ww w .  ja v  a 2  s .c om*/
    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);
    window.setInitialHeight(500);//  www .  j  av  a  2s.  c  om
    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;
}