Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    208
    Vote Rating
    3
    gdlm is on a distinguished road

      0  

    Default (3.0.0. RC) NullPointerException @ ToolTip.onTargetOver

    (3.0.0. RC) NullPointerException @ ToolTip.onTargetOver


    Hi,
    I got this stack trace:

    Code:
    ERROR: Uncaught exception escaped. com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
        at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
        at com.sencha.gxt.widget.core.client.Component.fireEvent(Component.java:291)
        at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
        at com.sencha.gxt.widget.core.client.Component.onBrowserEvent(Component.java:595)
        at com.sencha.gxt.widget.core.client.grid.Grid.onBrowserEvent(Grid.java:473)
        at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
        at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
        at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
        at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.NullPointerException: null
        at com.sencha.gxt.widget.core.client.tips.ToolTip.onTargetOver(ToolTip.java:445)
        at com.sencha.gxt.widget.core.client.tips.ToolTip.onTargetMouseOver(ToolTip.java:432)
        at com.sencha.gxt.widget.core.client.tips.ToolTip$Handler.onMouseOver(ToolTip.java:95)
        at com.google.gwt.event.dom.client.MouseOverEvent.dispatch(MouseOverEvent.java:65)
        at com.google.gwt.event.dom.client.MouseOverEvent.dispatch(MouseOverEvent.java:1)
        at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
        at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
        at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
        at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
        at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
        at com.sencha.gxt.widget.core.client.Component.fireEvent(Component.java:291)
        at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
        at com.sencha.gxt.widget.core.client.Component.onBrowserEvent(Component.java:595)
        at com.sencha.gxt.widget.core.client.grid.Grid.onBrowserEvent(Grid.java:473)
        at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
        at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
        at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
        at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Thread.java:662)
    It looks like a Sencha bug to me.

  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    That looks interesting. I'd like to investigate the problem in more depth.

    To help us debug, please include your test case (implementing EntryPoint) and the browser in which you tested. Thanks.

  3. #3
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    208
    Vote Rating
    3
    gdlm is on a distinguished road

      0  

    Default


    Take the code of your Basic Grid example.
    Add this line after all existing grid.xxxx() statements:

    Code:
    grid.addHandler(new CellToolTipHandler(grid), MouseOverEvent.getType());
    with CellToolTipHandler.java being:

    Code:
    import com.google.gwt.dom.client.Element;
    import com.google.gwt.event.dom.client.MouseOverEvent;
    import com.google.gwt.event.dom.client.MouseOverHandler;
    import com.sencha.gxt.widget.core.client.grid.Grid;
    
    public class CellToolTipHandler implements MouseOverHandler {
    
        private Grid<?> grid;
    
        public CellToolTipHandler(Grid<?> grid) {
            this.grid = grid;
        }
    
        @Override
        public void onMouseOver(MouseOverEvent event) {
            String text = determineTextFromCell(findCell(event));
            if (isEmpty(text)) {
                removeToolTip();
                return;
            }
            grid.setToolTip(text);
            grid.getToolTip().showAt(event.getX(), event.getY());
        }
    
        private boolean isEmpty(String text) {
            return text == null || text.trim().isEmpty() || text.replaceAll("\u00A0", " ").trim().isEmpty();
        }
    
        private String determineTextFromCell(Element cell) {
            return cell == null ? null : toolTipFriendlyText(cell);
        }
    
        private String toolTipFriendlyText(Element cell) {
            return convertStringToMultiLineHTML(cell.getInnerText());
        }
    
        private Element findCell(MouseOverEvent event) {
            Element target = Element.as(event.getNativeEvent().getEventTarget());
            return grid.getView().findCell(target);
        }
    
        private void removeToolTip() {
            if (grid != null) {
                grid.removeToolTip();
            }
        }
    
        public static String convertStringToMultiLineHTML(String toolTipText) {
            final int OFFSET = 40;
            int toolTipTextSize = toolTipText.length();
            int startIndex = 0;
            int endIndex = OFFSET;
            StringBuffer stringBuffer = new StringBuffer();
            while (endIndex < toolTipTextSize) {
                stringBuffer.append(toolTipText.substring(startIndex, endIndex));
                stringBuffer.append("<br />");
                endIndex += OFFSET;
                startIndex += OFFSET;
            }
            stringBuffer.append(toolTipText.substring(startIndex, toolTipTextSize));
            return stringBuffer.toString();
        }
    
    }
    Hover with the mouse over the column headers and you get the error. [ IE - version 8.0.7601.17514 ]

    Extra question:
    • When hovering over the grid cells sometimes an empty tooltip appears
    • When hovering over the grid cells sometimes the tooltip appears "miles" away from where the mouse pointer is at that moment.
    Is that due to our custom code?
    What could be wrong with
    Code:
    grid.getToolTip().showAt(event.getX(), event.getY());

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Using your code in the GridExample class, I was able to reproduce the issue. However, the bug is from your use of grid.removeTooltip(). Since you are calling this during the OnMouseOver event, the tooltip's own handler is still about to go off, but calling remove unwires part of the tooltip. Calling this earlier would be more correct, as it would remove the handler before it even gets the chance to start firing that event.

    Remember that when writing event handlers, you must code as if handler order isn't guaranteed - if the tooltip's own onMouseOver handler had already been called, removing the tooltip as you are doing wouldn't have any effect.

    Quote Originally Posted by gdlm View Post
    Extra question:
    • When hovering over the grid cells sometimes an empty tooltip appears
    • When hovering over the grid cells sometimes the tooltip appears "miles" away from where the mouse pointer is at that moment.
    Is that due to our custom code?
    What could be wrong with
    Code:
    grid.getToolTip().showAt(event.getX(), event.getY());
    Take a look at the javadocs for those methods:
    Code:
      /**
       * Gets the mouse x-position relative to the event's current target element.
       * 
       * @return the relative x-position
       */
      public int getX() {//...
    Instead, I think you want getClientX() and getClientY(), to get the current position of the mouse within the visible window. That said, without that line, the tooltip still seems to draw correctly, and consistently in the correct location.

    What are you trying to achieve with this code? Have you looked into the QuickTip class? This allows you to set html attributes on elements that should have a tooltip. If this isn't quite right for you, how it is written might inspire another solution. The GridExample class already has a QuickTip created around the grid, though we aren't using it at the moment.

  5. #5
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    208
    Vote Rating
    3
    gdlm is on a distinguished road

      0  

    Default


    What are you trying to achieve with this code?
    Well, we thought it was needed to make the tooltip appear, but apparently it isn't.
    So we can just remove it.

    About the code
    Code:
    if (isEmpty(text)) {             
      removeToolTip(); 
      return;         
    }
    I understand now that calling removeToolTip() is a bad idea.
    But what can we do to avoid empty tooltips?
    If I change my code to this:

    Code:
        public void onMouseOver(MouseOverEvent event) {
            String text = determineTextFromCell(findCell(event));
            if (isEmpty(text)) {
                grid.setToolTip(null);
            } else {
                grid.setToolTip(text);
            }
        }
    when hovering over the column headers, I don't get no more NPE's but an empty tooltip appears.
    How can we avoid that? Calling
    Code:
    grid.setToolTip(null)
    apparently is not enough.

    I also tried this without success:
    Code:
        public void onMouseOver(MouseOverEvent event) {
            String text = determineTextFromCell(findCell(event));
            if (isEmpty(text)) {
                grid.setToolTip("");
                grid.getToolTip().getToolTipConfig().setEnabled(false);
            } else {
                grid.setToolTip(text);
                grid.getToolTip().getToolTipConfig().setEnabled(true);
            }
        }

    I've investigated the QuickTip way.
    Does that mean that for every ColumnConfig in my grid I need a cell renderer that renders the content with
    <span qtip='whatever tooltip you want'>the real value</span> ?
    So I need a StringCell, DateCell, NumberCell?
    That's quite some work and it doesn't feel right. Is it?

  6. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,634
    Vote Rating
    79
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    removeToolTip isn't a bad idea, but you can't call it when something else is about to trigger the tooltip to be drawn again. One option could be to remove the tooltip after it hides, and null out the tooltip data so it isn't drawn again. You might also toggle the config.setTrackMouse when the mouse enters a region with no data...

    Using QuickTip is an option, but I was offering it as a sample subclass of ToolTip to base your own code on. Instead of checking for the qtip attribute, check for the pretense of your data, and use that to decide if the tip gets shown or not.

    I tend to use QuickTip and a custom renderer when I know what data to show by default, and what extra data to show, and I want that to be part of the cell (i.e. the rendered html) instead of data that is looked up after the fact. As for how to render this, it would depend on what data you want to draw, and what you are passing to the cell. If just passing the value, consider checking the length (in chars, or getting an estimate of how long the text value is, or make the tooltip do that on hover) and make the tooltip only render if there is too much data.

  7. #7
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    208
    Vote Rating
    3
    gdlm is on a distinguished road

      0  

    Post


    ...null out the tooltip data so it isn't drawn again.
    My kingdom for a way to accomplish that!

    I keep getting empty tooltips.

    Everything I posted above doesn't work. Neither does the following:
    Code:
                    
    ToolTipConfig cfg = grid.getToolTip().getToolTipConfig();
    cfg.setBodyHtml((String)null);
    grid.getToolTip().update(cfg);

  8. #8
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    208
    Vote Rating
    3
    gdlm is on a distinguished road

      0  

    Default


    FYI: Now we're using QuickTip (as it is, not our own custom version).
    And it works as expected.
    Except from one bug: http://www.sencha.com/forum/showthre...ltips&p=776873.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar