You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/09/12 14:23:14 UTC
[2/4] git commit: ISIS-889: tweaked the javascript to adjust margin.
ISIS-889: tweaked the javascript to adjust margin.
The action prompt dialog is *meant to* be sized through our call to Wicket.Window.get().autoSizeWindow(). However, it seems not to size correctly on Chrome. I noticed though that manually adjusting the margin on one of the aciton panel's container element down by a pixel sorted out the issue.
So this is pretty hacky, but I've added in a patch to the javascript that calls ww.autoSizeWindow(), to manually change the CSS by 1 pixel. Seems to do the job, and unnoticeable on Firefox.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/df841459
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/df841459
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/df841459
Branch: refs/heads/master
Commit: df841459e777927ea0676429e6896f7bbb55089e
Parents: 0b52e7a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Sep 12 12:51:42 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Sep 12 12:51:42 2014 +0100
----------------------------------------------------------------------
.../actionprompt/ActionPromptModalWindow.java | 13 +++++++++----
.../actions/ActionParametersFormPanel.java | 15 ++++++++++++---
.../widgets/zclip/SimpleClipboardModalWindow.java | 12 +++++-------
3 files changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/df841459/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
index 746a7a6..742ece6 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
@@ -106,10 +106,15 @@ public class ActionPromptModalWindow extends ModalWindow implements ActionPrompt
StringBuilder builder = new StringBuilder();
// ISIS-771, WICKET-5101
- builder.append("window.setTimeout("
- + "function() {\n "
- + "var ww = Wicket.Window.get();\n ww.autoSizeWindow();\n "
- + "}\n, 0);\n");
+ builder.append(
+ "window.setTimeout(" +
+ "function() {\n " +
+ " var ww = Wicket.Window.get();\n " +
+ " ww.autoSizeWindow();\n " +
+ // this is a nasty hack to make dialog appear without scrollbars on Chrome (noticed in version 37.0.2062.120 m)
+ // really though this ought to be fixed in Wicket.Window.get().autoSizeWindow();
+ " $('.actionPanel .myBlockContainer').css('margin', '19px');\n " +
+ "}\n, 0);\n");
target.appendJavaScript(builder.toString());
http://git-wip-us.apache.org/repos/asf/isis/blob/df841459/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
index 1c2c5dc..529fa1a 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
@@ -180,9 +180,18 @@ public class ActionParametersFormPanel extends PanelAbstract<ActionModel> {
super.onError(target, form);
if(actionPromptIfAny != null) {
// resize, to show any feedback messages.
-
- // ISIS-771: in Wicket 6.12.0 the var ww returns null.
- target.appendJavaScript("var ww = Wicket.Window.get();\n ww.autoSizeWindow();");
+
+ target.appendJavaScript(
+ "window.setTimeout(" +
+ "function() {\n " +
+ " var ww = Wicket.Window.get();\n " +
+ " ww.autoSizeWindow();\n " +
+ // the hack that works for initial rendering of dialog on Chrome
+ // (to manually adjust the margin) doesn't seem to work if there's an error
+ // so have chosen just to leave things as the are
+ // (really, the issue is with Wicket.Window.get().autoSizeWindow() anyway...)
+ "}\n, 0);\n"
+ );
}
target.add(form);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/df841459/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
index 630dde1..a7d0d7b 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
@@ -22,9 +22,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
public class SimpleClipboardModalWindow extends ModalWindow implements ActionPrompt {
@@ -103,10 +100,11 @@ public class SimpleClipboardModalWindow extends ModalWindow implements ActionPro
builder.append("$('.first-field input').focus();\n");
// ISIS-771: in Wicket 6.12.0 the var ww returns null.
- builder.append("window.setTimeout("
- + "function() {\n "
- + "var ww = Wicket.Window.get();\n ww.autoSizeWindow();\n "
- + "}\n, 0);\n");
+ builder.append("window.setTimeout(" +
+ "function() {\n " +
+ " var ww = Wicket.Window.get();\n" +
+ " ww.autoSizeWindow();\n " +
+ "}\n, 0);\n");
target.appendJavaScript(builder.toString());
}