google-code-export / rocket-gwt

Automatically exported from code.google.com/p/rocket-gwt
1 stars 1 forks source link

ContextMenu with GWT's Tree #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As described at
http://groups.google.com/group/rocket-gwt/browse_frm/thread/15b96c7f9f483678,
 the ContextMenu when used as a Tree shows the menu far away, so it is not
clickable. 

After modifying ContextMenu.open() method by replacing

DomHelper.setAbsolutePosition( menuListElement, x, y);

with

DOM.setStyleAttribute(menuListElement, "left", x + "");
DOM.setStyleAttribute(menuListElement, "top", y + "");

The placement issue is fixed. However, in the attached example,
notice how the expander (plus or minus) icon moves when an item is
right-clicked and menu appears.

(In the attached example, the top-level tree nodes have menus
attached).

Original issue reported on code.google.com by deb...@gmail.com on 22 Nov 2006 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
Problem was due to DomHelper.getParentContainerLeft/getParentContainerTop was 
not
stopping at an ancestor with position:relative when calculating the coordinates 
of
the menu list.

DomHelper
//////////
   protected static native int getParentContainerLeft0(final Element element) /*-{
     var left = 0;
     var element0 = element;
     while( element0 ){
     // stop if this element is absolutely/relative positioned. 
      var position = element0.style.position.toLowerCase();
     if( "absolute" == position || "relative" == position ){
     break;
     }
     left = left + element0.offsetLeft;
     element0 = element0.offsetParent;
     }
     return left;
     }-*/;

    protected static native int getParentContainerTop0(final Element element) /*-{
     var top = 0;
     var element0 = element;
     while( element0 ){
     // stop if this element is absolutely/relative positioned. 
      var position = element0.style.position.toLowerCase();
     if( "absolute" == position || "relative" == position ){
     break;
     }
     top = top + element0.offsetTop;
     element0 = element0.offsetParent;
     }
     return top;
     }-*/;

Original comment by miroslav...@gmail.com on 27 Nov 2006 at 10:13

GoogleCodeExporter commented 9 years ago
Released in 0.21

Original comment by miroslav...@gmail.com on 29 Nov 2006 at 8:19