I have a static method which I use, periodically, to ensure that a
popup panel has a zIndex which is (practically) guaranteed to be on
top of everything else. (And yes, I'm sure there's another way, using
pure CSS to do this, but never mind that for the moment ;-)

This class looks something like this:

public class ZIndexHelpers {
  private static final int
TOPMOST_Z_INDEX = 2004318071;

  public static void makeTopmost( Element elem ) {
    setZIndex( elem, TOPMOST_Z_INDEX );
  }

  public static void setZIndex(Element elem, int index) {
    elem.getStyle().setZIndex( index );
  }

}

By running the compiler with -style=DETAILED, I can see that where I'm
calling the makeTopmost() method, it gets turned into some inlined
code. E.g.,
   this
$static.com_gindin_client_utils_ui_dropdown_DropDown_dropDown.com_google_gwt_user_client_ui_UIObject_element.style[$intern_94]
= $intern_3318;

Looking in the generated JavaScript, I can see:
  * $intern_94 = 'zIndex'
  * $intern_3318 = '2.004318071E9'

Putting the pieces together, this means that the resulting JavaScript
is gonig to be something like:
  elem.style[ 'zIndex' ] = '2.004318071E9'

Well, this doesn't work :-(

My work-around is to:
  1. Declare:
  private static final String
TOPMOST_Z_INDEX_STR = "" + TOPMOST_Z_INDEX;

  2. Change my makeTopmost() method to just the single line:
 elem.getStyle().setProperty( "zIndex", TOPMOST_Z_INDEX_STR );


My question is: Is this a compiler bug? Or is it just a "gosh, yeah,
that's what we do, so uh...be careful ;-)"

FWIW, this exact same code was working just fine with GWT 1.7...

Thanks,

jay

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe, reply using "remove me" as the subject.

Reply via email to