You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Roland Kurucz (Jira)" <ji...@apache.org> on 2019/08/29 13:30:00 UTC
[jira] [Commented] (WICKET-6613) Wicket 8.1 ModalWindow autosizing
problem
[ https://issues.apache.org/jira/browse/WICKET-6613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16918627#comment-16918627 ]
Roland Kurucz commented on WICKET-6613:
---------------------------------------
Dear Support/Dev Team,
I have got a problem with the preserve the real content height of ModalWindow.
I have found the root cause of this problem. You cannot put a null Java reference to the *com.github.openjson.JSONObject*. You have to use the *JSONObject.NULL*.
{code:java|title=org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.java}
package org.apache.wicket.extensions.ajax.markup.html.modal;
import com.github.openjson.JSONObject;
...
public class ModalWindow extends Panel {
...
protected final String getWindowOpenJavaScript() {
JSONObject settings = new JSONObject();
...
if ((isUseInitialHeight() == true) || (isCustomComponent() == false)) {
settings.put("height", getInitialHeight());
} else {
settings.put("height", (Object)null);
}
...
}
...
}
{code}
The appropriate part of Javadoc of com.github.openjson.JSONObject is:
{{Warning: *this class represents null* in two incompatible ways: the standard Java null reference, and the sentinel value NULL. In particular, calling put(name, null) removes the named entry from the object but *put(name, JSONObject.NULL) stores an entry whose value is JSONObject.NULL*.}}
*Workaround solution:*
You have to override the postProcessSettings() method of the ModalWindow class:
{code:java}
@Override
protected void postProcessSettings(JSONObject settings) {
super.postProcessSettings(settings);
if ((isUseInitialHeight()) || (!isCustomComponent())) {
settings.put("height", getInitialHeight());
} else {
settings.put("height", JSONObject.NULL.toString());
}
}
{code}
> Wicket 8.1 ModalWindow autosizing problem
> ------------------------------------------
>
> Key: WICKET-6613
> URL: https://issues.apache.org/jira/browse/WICKET-6613
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Affects Versions: 8.1.0
> Reporter: Daniel Sram
> Priority: Minor
> Attachments: broken-modal-window-app.zip
>
>
> Hi,
> I've recently upgraded my project from Wicket version 6 to 8.1.0 and
> autosizing of ModalWindows suddenly stopped working. All ModalWindows are
> either too big or too small, in that case the scrollbar appears. I need my
> ModalWindows to be autosized so the content fits perfectly without any
> scrollbar or excessive window size. I've been trying to play around with
> various combinations of set/useInitial/Minimal/Height() and setAutoSize()
> without any luck so far.
> I attached a quickstart application that demonstrates the problem.
> Any help is appreciated, thank you.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)