pombreda / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

MenuBar : add possibility to force sub-menu position from left or right without locale RTL information #437

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hello, 

We have a menu which is positionned completely on the right of the screen.

When this menu have a submenu, the submenu is positionned on the right of its 
base item (with our french locale).

So the submenu is unvisible because it is offscreen.

Could you please add the possibility to force the submenu position even if the 
local is or not RTL or give us the possibility to access the private variables 
used in this method (like parentMenu private variable) in order to override it ?

The code is here in MenuBar :

private void openPopup(final MenuItem item)
{
   ...

    // Show the popup, ensuring that the menubar's event preview remains on top
    // of the popup's.
    popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

      public void setPosition(int offsetWidth, int offsetHeight) {

        // depending on the bidi direction position a menu on the left or right
        if (LocaleInfo.getCurrentLocale().isRTL()) {
          if (vertical) {
            popup.setPopupPosition(MenuBar.this.getAbsoluteLeft() - offsetWidth
                + 1, item.getAbsoluteTop());
          } else {
            popup.setPopupPosition(item.getAbsoluteLeft()
                + item.getOffsetWidth() - offsetWidth,
                MenuBar.this.getAbsoluteTop() + MenuBar.this.getOffsetHeight()
                    - 1);
          }
        } else {
          if (vertical) {
            popup.setPopupPosition(MenuBar.this.getAbsoluteLeft()
                + MenuBar.this.getOffsetWidth() - 1, item.getAbsoluteTop());
          } else {
            popup.setPopupPosition(item.getAbsoluteLeft(),
                MenuBar.this.getAbsoluteTop() + MenuBar.this.getOffsetHeight()
                    - 1);
          }
        }
}

Thanks a lot,

S.Delune

Original issue reported on code.google.com by mail2...@gmail.com on 10 Dec 2010 at 5:17

Attachments:

GoogleCodeExporter commented 9 years ago
Is there a way to do this in the JavaScript API  
http://code.google.com/apis/maps/documentation/javascript/v2/

Original comment by zundel@google.com on 10 Dec 2010 at 6:07

GoogleCodeExporter commented 9 years ago
unfortunately, i don't think javascript can help me in this case, unless i can 
access private variables with JSNI.

If i can do that, i can override MenuBar.openMenu() method and force submenu to 
position on the left of its parent even if the Locale is not LTR

More generally, it would be great if we could access parent variables in order 
to redefine widgets methods for particular cases, with protected variables or 
protected accessors.

Original comment by mail2...@gmail.com on 10 Dec 2010 at 6:34

GoogleCodeExporter commented 9 years ago
Oh, I'm sorry, I think you meant to post this as an issue for GWT in general, 
not the gwt-google-apis.  Try filing your issue here:

http://code.google.com/p/google-web-toolkit

Original comment by zundel@google.com on 10 Dec 2010 at 6:57

GoogleCodeExporter commented 9 years ago
Oh sorry, i re-post my issue in google-web-toolkit, thanks ! !

Original comment by mail2...@gmail.com on 10 Dec 2010 at 7:12

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 10 Dec 2010 at 7:48