From b7c2bdf69c49630528bcef00fc00235da44a5c29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Risto=20Yrj=C3=A4n=C3=A4?= Date: Tue, 16 Sep 2008 14:31:10 +0000 Subject: [PATCH] Changed to comply to Java 1.5 and GWT 1.5, added setAnimation(boolean) svn changeset:5416/svn branch:trunk --- .../terminal/gwt/client/ui/IPopupView.java | 18 ++++++----- src/com/itmill/toolkit/ui/PopupView.java | 30 +++++++++++++++---- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java index 1fb53a68c0..a4867d44af 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java @@ -99,6 +99,10 @@ public class IPopupView extends HTML implements Paintable { setTitle(uidl.getStringAttribute("description")); } + if (uidl.hasAttribute("animation")) { + popup.setAnimationEnabled(uidl.getBooleanAttribute("animation")); + } + // Render the popup if visible and show it. if (hostPopupVisible) { UIDL popupUIDL = uidl.getChildUIDL(0); @@ -167,10 +171,10 @@ public class IPopupView extends HTML implements Paintable { } public static native void nativeBlur(Element e) /*-{ - if(e.focus) { - e.blur(); - } - }-*/; + if(e.focus) { + e.blur(); + } + }-*/; private class CustomPopup extends IToolkitOverlay implements Container { @@ -179,11 +183,11 @@ public class IPopupView extends HTML implements Paintable { private ICaptionWrapper captionWrapper = null; private boolean hasHadMouseOver = false; - private Set activeChildren; + private Set activeChildren; public CustomPopup() { super(true, false, true); // autoHide, not modal, dropshadow - activeChildren = new HashSet(); + activeChildren = new HashSet(); } // For some reason ONMOUSEOUT events are not always recieved, so we have @@ -222,7 +226,7 @@ public class IPopupView extends HTML implements Paintable { } // Notify children that have used the keyboard - for (Iterator iterator = activeChildren.iterator(); iterator + for (Iterator iterator = activeChildren.iterator(); iterator .hasNext();) { nativeBlur((Element) iterator.next()); } diff --git a/src/com/itmill/toolkit/ui/PopupView.java b/src/com/itmill/toolkit/ui/PopupView.java index 51cbde96e9..4e8a18a3b2 100644 --- a/src/com/itmill/toolkit/ui/PopupView.java +++ b/src/com/itmill/toolkit/ui/PopupView.java @@ -18,9 +18,10 @@ import com.itmill.toolkit.terminal.PaintTarget; */ public class PopupView extends AbstractComponentContainer { - Content content; - boolean popupVisible; - ArrayList componentList; + private Content content; + private boolean popupVisible; + private ArrayList componentList; + private boolean animationEnabled; /* Constructors */ @@ -58,7 +59,8 @@ public class PopupView extends AbstractComponentContainer { super(); setContent(content); popupVisible = false; - componentList = new ArrayList(1); + animationEnabled = false; + componentList = new ArrayList(1); } /** @@ -101,6 +103,24 @@ public class PopupView extends AbstractComponentContainer { return popupVisible; } + /** + * Enable / disable popup viewing animation + * + * @param enabled + */ + public void setAnimation(boolean enabled) { + animationEnabled = enabled; + } + + /** + * Query if the viewing animation is enabled. + * + * @return true if the animation is enabled + */ + public boolean isAnimationEnabled() { + return animationEnabled; + } + /* * Methods inherited from AbstractComponentContainer. These are unnecessary * (but mandatory). Most of them are not supported in this implementation. @@ -200,7 +220,7 @@ public class PopupView extends AbstractComponentContainer { } target.addAttribute("html", content.getMinimizedValueAsHTML()); target.addAttribute("popupVisible", popupVisible); - + target.addAttribute("animation", animationEnabled); // Only paint component to client if we know that the popup is showing if (popupVisible) { Component c = content.getPopupComponent(); -- 2.39.5