In fact I have found WiQuery dialog more helpful. I am sharing my code with you; just to show my version of using the dialog. Not necessarily the best way, but is working for me and very helpful.
(I HAVE DEVELOPED MY VERSION USING ERNESTO REINALDO'S ORIGINAL SUGGESTION FOR DIALOG BOX CREATION, AND WITH ADDITIONAL INTERFACE STRUCTURE FOR MY OWN PURPOSE.). Please note that the Dialog creation class is part of interface which also has methods used within extended classes; to be implemented in the respective page classes when adding the dialog. package mypackage; import org.apache.wicket.ajax.AjaxRequestTarget; import org.odlabs.wiquery.ui.dialog.AjaxDialogButton; import org.odlabs.wiquery.ui.dialog.Dialog; import java.io.Serializable; import java.util.HashMap; import java.util.Map; /** * Created by Chhaya-MX on 6/23/14. */ public interface MyDialogBox extends Serializable { public static final long serialVersionUID = 1L; public enum Btn{ YES, NO, RESET, DEFAULT } public class MyDialogBoxWindow extends Dialog { /** * */ private static final long serialVersionUID = 1L; public AjaxDialogButton YES; public AjaxDialogButton NO; public AjaxDialogButton RESET; Map<Btn, String> btnTitles = new HashMap<Btn, String>(); //Note the window positioning as parameter to the constructor public MyDialogBoxWindow(String propertyName, String title, WindowPosition windowPosition) { super(propertyName); setTitle(title); setMinHeight(200); //You can customize as input parameter or have protected method to set (similar to setTitle above) setMinWidth(800); //You can customize as input parameter or have protected method to set (similar to setTitle above) setModal(true); setAutoOpen(false); setPosition(windowPosition); setButtonTitles(); YES = dialogYesButton(btnTitles.get(Btn.YES)); NO = dialogNoButton(btnTitles.get(Btn.NO)); RESET = dialogResetButton(btnTitles.get(Btn.RESET)); setButtons(YES, NO); setOutputMarkupId(true); } public void setButtons(AjaxDialogButton... buttons) { super.setButtons(buttons); } private AjaxDialogButton dialogYesButton(String title) { if (null == title || title.trim().length() <= 0){ title = "Yes"; } return new AjaxDialogButton(title) { private static final long serialVersionUID = 1L; @Override protected void onButtonClicked(AjaxRequestTarget target) { onConfirmation(target); } }; } private AjaxDialogButton dialogNoButton(String title) { if (null == title || title.trim().length() <= 0){ title = "No"; } return new AjaxDialogButton(title) { private static final long serialVersionUID = 1L; @Override protected void onButtonClicked(AjaxRequestTarget target) { onCancel(target); close(target); } }; } private AjaxDialogButton dialogResetButton(String title) { if (null == title || title.trim().length() <= 0){ title = "Reset"; } return new AjaxDialogButton(title) { private static final long serialVersionUID = 1L; @Override protected void onButtonClicked(AjaxRequestTarget target) { //Implement ME... } }; } public void onConfirmation(AjaxRequestTarget target) { //Override ME } public void onCancel(AjaxRequestTarget target) { //Override ME } protected void setButtonTitles(){ } public void setBtnTitles(Map<Btn, String> btnTitles) { this.btnTitles = btnTitles; } } } Now in your wicket page/panel get MyDialogBox method. Check how you can pass different WindowPosition constant to meet your requirements: private void addConfirmationDialog(final DataGrid<GridList<HTOffender>, GridObject> grid) { confirmationDialog = new MyDialogBox.MyDialogBoxWindow("confirmationDialog", "Are you sure you want to delete offender(s)?", Dialog.WindowPosition.TOP) { /** * */ private static final long serialVersionUID = 1L; /* (non-Javadoc) * @see mypackage.MyDialogBox.MyDialogBoxWindow#setButtonTitles() */ @Override protected void setButtonTitles() { Map<MyDialogBox.Btn, String> btnTitles = new HashMap<MyDialogBox.Btn, String>(); btnTitles.put(MyDialogBox.Btn.YES, "Confirm"); btnTitles.put(MyDialogBox.Btn.NO, "No"); setBtnTitles(btnTitles); } @Override public void onConfirmation(AjaxRequestTarget target) { if (null != grid && null != grid.getSelectedItems() && grid.getSelectedItems().size() > 0) { //Take confirmation action //info("Selected record(s) deleted successfully..."); confirmationDialog.close(target); setResponsePage(new AnotherPage("somename")); } else { error("No records to delete..."); confirmationDialog.close(target); } } }; confirmationDialog.setMarkupId("confirmationDialogId"); //If you are using multiple dialog boxes in same page hierarchy, then this value should be different for //each dialog add(confirmationDialog); } Hope this helps, -Mihir. On Wed, Aug 20, 2014 at 4:31 AM, Martin Dietze <mdie...@gmail.com> wrote: > I have looked into that issue a bit further. > > On 17 August 2014 17:23, Mihir Chhaya <mihir.chh...@gmail.com> wrote: > > I have used WQuery Dialog for Wicket 1.4 and could make it work in center > > using setMinimumHeight and setMinimumWidth methods when adding dialog. > > That's true, but this is part of the problem. Since this only takes > effect when adding the dialog, it will not change after the page (and > therefore the generated Javascript code containing the settings) has > been rendered. > > Since the dialog is shown using Javascript, Wicket will normally not > even know about this. One can probably add some Javascript code to the > links that open the dialog, but that does not seem very robust as > there does not seem to be any official API for manipulations like this > (one would have to read the generated Javascript code and write some > stuff that changes the settings). > > I now ended up with two "global" dialogs, one for a small dialog that > is shown in the center of the page and one for large dialogs that is > positioned at the top. Not elegant, but it does the job. > > I actually doubt that using WiQuery for the dialogs actually leads to > any benefit at all. I inherited the code I am working with, and not > using Wicket's standard dialog API seems to make code harder to > understand, less maintainable why not leading to obvious optimization. > > Cheers, > > Martin > > -- > ---------- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org > ---- > ------------- / http://herbert.the-little-red-haired-girl.org / > ------------- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >