Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    EventHandler.getTarget() over Tile throws AssertionError

    SmartClient Version: v11.0p_2016-07-14/LGPL Development Only (built 2016-07-14)
    Chome latest (compiled mode), Firefox 26 (devel mode)

    I'm trying to apply addMouseOverHandler on a Tile in a TileGrid as follow:
    Code:
    addMouseOverHandler(new MouseOverHandler() {
                @Override
                public void onMouseOver(MouseOverEvent event) {
                    Canvas tile = EventHandler.getTarget();
                    if (tile instanceof SimpleTile) {
                        SC.say(getTileIndex(tile));
                    }
                }
            });
    and recover the event's target canvas (hopefully a Tile) as has been said here in the forums using EventHandler.getTarget(). If the target is the TileGrid it works. The problem getTarget() throws AssertionError when SmartGWT instance the SimpleTile

    SimpleTile.class
    Code:
     public static SimpleTile getOrCreateRef(JavaScriptObject jsObj) {
            if (jsObj == null) return null;
            final BaseWidget refInstance = BaseWidget.getRef(jsObj);
            if (refInstance == null) {
                return new SimpleTile(jsObj);
            } else {
                [B]assert refInstance instanceof SimpleTile; <= Exception is thrown!![/B]
                return (SimpleTile)refInstance;
            }
        }
    In the marked line refInstance is a Canvas instance and the assert fails even when refInstance JSON is:
    Code:
    SimpleTile {
        creator : [TileGrid ID : isc_FotoTileGrid_9],
        canHover : true,
        tileGrid : [TileGrid ID : isc_FotoTileGrid_9],
        ID : "isc_FotoTileGrid_9_tile_2",
        position : "absolute",
        className : "simpleTileOver",
        width : 150,
        height : 168,
        left : 349,
        top : 5,
        styleName : "simpleTileOver",
        tileNum : 2,
        record : Obj {
            ID : 149808
        },
        parentElement : [TileGrid ID : isc_FotoTileGrid_9],
        topElement : [Window ID : isc_FotoPeritacionWindowDynamicForm_0],
        tabIndex : 2628,
        ruleScope : "isc_FotoPeritacionWindowDynamicForm_0",
        cacheOffsetCoords : true,
        showDown : false,
        zIndex : 209630,
        state : "Over",
    }
    Is this the normal behaviour? If yes, how do you add an over handler to a tile?

    Best regards

    #2
    Can you show a minimal, ready-to-run test case demonstrating this issue? If this happens every time without special settings, you should be able to quickly reproduce the problem by starting from one of the TileGrid samples.

    Comment


      #3
      Test case attached based on basic tiling sample in the showcase just without images and all in one file. The same behaviour happens
      Attached Files

      Comment


        #4
        We've applied a fix for this issue to SGWT 6.0p and newer that should be in the nightly builds dated 2016-07-18 and beyond.

        Comment


          #5
          Thanks fot the fix. Issue solved in the latest patched build 2016-07-18. Just one more question regarding patched builds. I can't use that latest build because now I get a cast exception in setValuesManager. Nothing changed on my code. Just replaced the library. This kind of new weird errors always happen to me when changing the library with the latest patched version even after cleaning the project, browser cache, etc. Is this a normal behaviour with latest patched builds?

          Comment


            #6
            Hi hespresati,

            it definitely should not happen, but does so from time to time.
            This time you had just bad luck, this bug was there only one day (should be gone tomorrow), see here.

            Best regards
            Blama

            Comment


              #7
              Originally posted by Blama View Post
              Hi hespresati,

              it definitely should not happen, but does so from time to time.
              This time you had just bad luck, this bug was there only one day (should be gone tomorrow), see here.

              Best regards
              Blama
              Thank you Blama for your answer. I'll try today's patched version hoping I'll have more luck

              Best regards

              Comment

              Working...
              X