From portal-commits at lists.jboss.org Wed Jul 9 18:42:01 2008 Content-Type: multipart/mixed; boundary="===============7895788579509456273==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r11390 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client: util and 1 other directory. Date: Wed, 09 Jul 2008 18:42:00 -0400 Message-ID: --===============7895788579509456273== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2008-07-09 18:42:00 -0400 (Wed, 09 Jul 2008) New Revision: 11390 Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentat= ion/ajax/client/model/AjaxPane.java modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentat= ion/ajax/client/model/AjaxWindow.java modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentat= ion/ajax/client/util/Tools.java Log: fix issue where a pane drag would prevent the usage of one of its children Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/pr= esentation/ajax/client/model/AjaxPane.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/model/AjaxPane.java 2008-07-09 21:43:10 UTC (rev 11389) +++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/model/AjaxPane.java 2008-07-09 22:42:00 UTC (rev 11390) @@ -27,9 +27,11 @@ import com.google.gwt.user.client.Element; = import java.util.Map; +import java.util.Iterator; = import org.jboss.portal.presentation.ajax.client.dnd.Draggable; import org.jboss.portal.presentation.ajax.client.dnd.Droppable; +import org.jboss.portal.presentation.ajax.client.util.Tools; = /** * @author Julien Viet @@ -116,12 +118,20 @@ = protected Draggable doFindDraggable(int x, int y) { - int left =3D widget.getAbsoluteLeft(); - int right =3D left + widget.getOffsetWidth(); - int top =3D widget.getAbsoluteTop(); - int bottom =3D top + widget.getOffsetHeight(); - if (x >=3D left && x <=3D right && y >=3D top && y <=3D bottom) + // Let's not shadow any widget + for (Iterator i =3D getChildren().iterator();i.hasNext();) { + AjaxObject child =3D (AjaxObject)i.next(); + Widget childWidget =3D child.getWidget(); + if (Tools.contains(childWidget, x, y)) + { + return null; + } + } + + // + if (Tools.contains(widget, x, y)) + { return draggable; } else Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/pr= esentation/ajax/client/model/AjaxWindow.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/model/AjaxWindow.java 2008-07-09 21:43:10 UTC (rev 11389) +++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/model/AjaxWindow.java 2008-07-09 22:42:00 UTC (rev 11390) @@ -134,11 +134,7 @@ = protected Draggable doFindDraggable(int x, int y) { - int left =3D title.getAbsoluteLeft(); - int right =3D left + title.getOffsetWidth(); - int top =3D title.getAbsoluteTop(); - int bottom =3D top + title.getOffsetHeight(); - if (x >=3D left && x <=3D right && y >=3D top && y <=3D bottom) + if (Tools.contains(title, x, y)) { return draggable; } Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/pr= esentation/ajax/client/util/Tools.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/util/Tools.java 2008-07-09 21:43:10 UTC (rev 11389) +++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presenta= tion/ajax/client/util/Tools.java 2008-07-09 22:42:00 UTC (rev 11390) @@ -24,6 +24,7 @@ = import com.google.gwt.user.client.Element; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.ui.Widget; = import java.util.Map; = @@ -37,6 +38,29 @@ { = /** + * Returns true if the specified widget does contain the point located = at (x,y). + * + * @param widget the widget + * @param x the x value + * @param y the y value + * @return true is the point is contained within the widget + */ + public static boolean contains(Widget widget, int x, int y) + { + if (widget =3D=3D null) + { + throw new IllegalArgumentException(); + } + + // + int left =3D widget.getAbsoluteLeft(); + int right =3D left + widget.getOffsetWidth(); + int top =3D widget.getAbsoluteTop(); + int bottom =3D top + widget.getOffsetHeight(); + return x >=3D left && x <=3D right && y >=3D top && y <=3D bottom; + } + + /** * Returns an element tag name. * * @param element the element to obtain the tag name from --===============7895788579509456273==--