From 720a3c813092cb67b144c2ccb308677bf492e31a Mon Sep 17 00:00:00 2001 From: Maxim Solodovnik Date: Tue, 3 Dec 2024 13:04:21 +0700 Subject: [PATCH] [modalx] Default initStyles() is modified to set Theme --- .../org/wicketstuff/modalx/example/HomePage.java | 4 ++-- .../wicketstuff/modalx/ModalContentWindow.java | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modalx-parent/modalx-examples/src/main/java/org/wicketstuff/modalx/example/HomePage.java b/modalx-parent/modalx-examples/src/main/java/org/wicketstuff/modalx/example/HomePage.java index 5622a682a8..4fc9dea48b 100644 --- a/modalx-parent/modalx-examples/src/main/java/org/wicketstuff/modalx/example/HomePage.java +++ b/modalx-parent/modalx-examples/src/main/java/org/wicketstuff/modalx/example/HomePage.java @@ -29,7 +29,7 @@ public class HomePage extends ModalXPage implements IWindowCloseListener /** * Constructor that is invoked when page is invoked without a session. - * + * * @param parameters * Page parameters */ @@ -109,7 +109,7 @@ public void onClick(AjaxRequestTarget target) * ModalFormPanel (including MessageBox) is closed. Pass the listener into the constructor of * the ModelFormPanel or MessageBox */ - @Override + @Override public void windowClosed(Panel panel, AjaxRequestTarget target) { if (panel instanceof ModalFormPanel) diff --git a/modalx-parent/modalx/src/main/java/org/wicketstuff/modalx/ModalContentWindow.java b/modalx-parent/modalx/src/main/java/org/wicketstuff/modalx/ModalContentWindow.java index a7f50255e5..e9272e2c85 100644 --- a/modalx-parent/modalx/src/main/java/org/wicketstuff/modalx/ModalContentWindow.java +++ b/modalx-parent/modalx/src/main/java/org/wicketstuff/modalx/ModalContentWindow.java @@ -4,7 +4,7 @@ /** * � 2006, 2009. Step Ahead Software Pty Ltd. All rights reserved. - * + * * Source file created and managed by Javelin (TM) Step Ahead Software. To * maintain code and model synchronization you may directly edit code in method * bodies and any sections starting with the 'Keep_*' marker. Make all other @@ -15,6 +15,7 @@ import java.util.Optional; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalDialog; +import org.apache.wicket.extensions.ajax.markup.html.modal.theme.DefaultTheme; import org.apache.wicket.markup.head.CssHeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.request.resource.PackageResourceReference; @@ -27,7 +28,7 @@ * Class Name : ModalContentWindow Diagram : Wicket Generic Modal Windows Project : Echobase * framework Type : concrete Specialized form of ModalWindow that knows how to interact with * ModelContentPanels in a way which simplifies the code that opens a modal window. - * + * * @author Chris Colman */ public class ModalContentWindow extends ModalDialog @@ -42,8 +43,8 @@ public class ModalContentWindow extends ModalDialog protected ModalMgr modalMgr; - protected WindowClosedCallback windowClosedCallback; - + protected WindowClosedCallback windowClosedCallback; + // -[Methods]- /** @@ -59,6 +60,7 @@ public ModalMgr getModalMgr() */ public void initStyles() { + add(new DefaultTheme()); } @Override @@ -81,7 +83,7 @@ public ModalContentWindow(ModalMgr iModalMgr, String id, boolean maskBehind) initStyles(); } - + public void setWindowClosedCallback(final WindowClosedCallback callback) { this.windowClosedCallback = callback; } @@ -91,7 +93,7 @@ public ModalDialog close(AjaxRequestTarget target) { Optional.ofNullable(windowClosedCallback).ifPresent(w -> w.onClose(target)); return super.close(target); } - + /** * Callback called after the window has been closed. If no callback instance is specified using * {@link BaseModal#setWindowClosedCallback(BaseModal.WindowClosedCallback)}, no ajax @@ -106,5 +108,5 @@ public interface WindowClosedCallback extends IClusterable { * @param target {@link org.apache.wicket.ajax.AjaxRequestTarget} instance bound with the ajax request. */ void onClose(AjaxRequestTarget target); - } + } }