martin-g commented on a change in pull request #361: WICKET-6666 initial 
checkin of new ModalDialog
URL: https://github.com/apache/wicket/pull/361#discussion_r283860195
 
 

 ##########
 File path: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java
 ##########
 @@ -0,0 +1,240 @@
+package org.apache.wicket.extensions.ajax.markup.html.modal;
+
+import java.io.Serializable;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.EmptyPanel;
+import org.apache.wicket.markup.html.panel.Panel;
+
+import com.github.openjson.JSONStringer;
+
+/**
+ * Presents a modal dialog to the user. See open and close methods.
+ * 
+ * @author Igor Vaynberg (ivaynberg)
+ */
+public class ModalDialog extends Panel
+{
+
+       public static final String CONTENT_ID = "content";
+
+       private final WebMarkupContainer container;
+       private final WebMarkupContainer contentContainer;
+       private boolean open = false;
+       private transient boolean openedInThisRequest = false;
+       private Options options;
+
+       public ModalDialog(String id)
+       {
+               super(id);
+               setOutputMarkupId(true);
+
+               // Container controls the overall visibility of the modal form 
innards. In its initial state
+               // this is set to
+               // hidden so only the external tag renders. When the modal is 
openedInThisRequest it is
+               // first repainted with
+               // this shown to
+               // insert the markup into the dom, and then the modal 
javascript is invoked to rip out this
+               // tag out of the dom
+               // and make it modal.
+               container = new WebMarkupContainer("container");
+               container.setOutputMarkupId(true);
+               container.setVisible(false);
+               add(container);
+
+               // We need this here in case the modal itself is placed inside 
a form. If that is the case
 
 Review comment:
   Actually the question should be "Why do we need a Form here at all ?"
   Why not let the application provide a Form inside the `content` container if 
it needs one or use the outer (if there is such) ? 
   I am on my mobile now, so I cannot re-read ModalWindow's javadoc. But it 
would be good to simplify here as much as possible. AFAIR Wicket-Bootstrap's 
Modal component does not provide such mandatory Form and no one complained.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to