Announcement

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

    Strange error when adding backgroundlistener to timeline

    Hello. I want to have my own editor to popup when clicking in my timeline, so i have added listeners to the plus-button. I have also added an eventclickhandler.

    These two work fine, but i also want my custom editor when clicking in the background where there is no event. I have therefor tried to just add a "background" clickhandler that only does SC.say(), like this:
    Code:
    timeline.addBackgroundClickHandler(new BackgroundClickHandler() {
                @Override
                public void onBackgroundClick(BackgroundClickEvent backgroundClickEvent) {
                    SC.say("HELLO!!");
                    //backgroundClickEvent.cancel();
                }
            });
    However, when i click on various locations in my timeline background, i only get the sc.say sometimes. A lot of times i get very weird errors in the module log.

    I am unsure how to deal with this, but it feels unlikely to be something wrong with my clickhandler.

    Trace below (5.0-p20150808, Firefox and Chrome):

    ERROR: 23:48:10.349:MUP9:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/xxxx/sc/modules/ISC_Calendar.js, line 310
    com.smartgwt.client.core.JsObject$SGWT_WARN: 23:48:10.349:MUP9:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/xxxx/sc/modules/ISC_Calendar.js, line 310
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    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:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.util.SC.logWarn(SC.java)
    at com.smartgwt.client.util.LogUtil.handleOnError(LogUtil.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    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:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:695)
    ERROR: 23:48:17.825:MUP6:WARN:Log:TypeError: _8 is undefined
    Stack from error.stack:
    TimelineView.cellMouseUp() @ xxxx/sc/modules/ISC_Calendar.js:310
    anonymous() @ nuba/sc/modules/ISC_Core.js:77
    GridRenderer.mouseUp() @ xxxx/sc/modules/ISC_Grids.js:692
    [a]MathFunction.invokeSuper() @ xxxx/sc/modules/ISC_Core.js:281
    [a]MathFunction.Super() @ xxxx/sc/modules/ISC_Core.js:273
    GridBody.mouseUp() @ xxxx/sc/modules/ISC_Grids.js:830
    Canvas.handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:2822
    [c]EventHandler.bubbleEvent() @ xxxx/sc/modules/ISC_Core.js:1570
    EventHandler._handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:1412
    [c]EventHandler.handleMouseUp() @ xxxx/sc/modules/ISC_Core.js:1407
    [c]EventHandler.dispatch() @ xxxx/sc/modules/ISC_Core.js:1645
    anonymous() @ xxxx/sc/modules/ISC_Core.js:76

    #2
    You shouldn't get these if you *just* add a backgroundClickHandler to the sample, so can you isolate what's different, so we can reproduce the problem?

    Also, you might try not using SC.say() - log a message instead, just in case that problem is interference between showing the "Say" dialog and something else your code is doing.

    Comment


      #3
      I have found something new.

      If i add a listener with only event.cancel(); in the method, my listener is called but no errors in the log.

      If i remove the cancel call, so that the method is *completely* empty, the errors appear. No SC.say call in either case.

      To me, it indicates that it happens after my listener is called.


      Does that help?

      Comment


        #4
        Is there any reason you don't just install EventEditorCustomizer and/or EventDialogCustomizer instead of these button and click handlers?

        Comment


          #5
          Yes. I don't want the strange "2-step" editor process you have, where you first show a small window and you have to press "details" to get up the proper form.

          I want to show the "proper" form every time a window pops up, right away.

          Comment


            #6
            Then setShowQuickEventDialog(false) and just install an EventEditorCustomizer.

            Comment


              #7
              An EventEditorCustomizer is definitely the right way to go here, because it will be automatically called in numerous circumstances that you would need to separately handle yourself if you go down the event handler route.

              But if you want to continue down that route, please show a standalone test-case that demonstrates the issues you were having there, and we can take a look.

              Comment


                #8
                Issue with setWorkDays and Timeline

                Hello,

                while investigating another issue related to Timeline i found a bug, i think. Consider the following timeline:
                Code:
                    public class TestTimeline extends Timeline{
                
                        public TestTimeline() {
                            super();
                            int[] workdays = {1, 2, 3, 4, 5, 6, 7};
                            setWorkdays(workdays);
                            setWidth100();
                            setHeight100();
                            Date begin = new Date();
                            Date end = new Date();
                            CalendarUtil.addMonthsToDate(end, 1);
                            setStartDate(begin);
                            setEndDate(end);
                            setLanes(new Lane("Banana", "banana"), new Lane("Orange", "orange"), new Lane("Apple", "apple"));
                        }
                    }
                If you then go ahead and add that to a layout, then add a BackgroundClickHandler to it, like this:

                Code:
                timeline.addBackgroundClickHandler(new BackgroundClickHandler() {
                                @Override
                                public void onBackgroundClick(BackgroundClickEvent backgroundClickEvent) {
                                    SC.say("Hello");
                                }
                            });

                The handler still won't be called if you click on a saturday or a sunday in the Timeline grid.

                Either i am missing something, or this is a bug. :)

                Comment


                  #9
                  Marking all days as being work days does not change the default setting of disableWeekends.....

                  Comment


                    #10
                    Heh, ok. IMHO pretty confusing, but what do i know ;)

                    Thanks for the quick response!

                    Comment


                      #11
                      If you happen to work on a Saturday, that makes it a work day, but it doesn't stop it from being a weekend day - and weekend days are disabled by default...

                      Comment


                        #12
                        Hi! I'm back in the saddle on this topic again... I above got the message from you that "an EventEditorCustomizer is the way to go", so i tried that...

                        However, i did that and i get the exact same type of error!

                        code:
                        Code:
                        (in timeline):
                        setShowQuickEventDialog(false);
                        ...
                        timeline.setEventDialogCustomizer(new EventDialogCustomizer() {
                            @Override
                            public boolean showEventDialog(CalendarEvent calendarEvent, Boolean aBoolean) {
                                handleShowEditor(calendarEvent);
                                return false;
                            }
                        });
                        The showeventdialog method is never even called, instead i get this in the log:

                        Code:
                        ERROR: 22:09:11.690:MUP4:WARN:Log:TypeError: _8 is undefined
                        Stack from error.stack:
                            TimelineView.cellMouseUp() @ mymodule/sc/modules/ISC_Calendar.js:313
                            anonymous() @ mymodule/sc/modules/ISC_Core.js:77
                            GridRenderer.mouseUp() @ mymodule/sc/modules/ISC_Grids.js:692
                            [a]MathFunction.invokeSuper() @ mymodule/sc/modules/ISC_Core.js:281
                            [a]MathFunction.Super() @ mymodule/sc/modules/ISC_Core.js:273
                            GridBody.mouseUp() @ mymodule/sc/modules/ISC_Grids.js:830
                            Canvas.handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:2825
                            [c]EventHandler.bubbleEvent() @ mymodule/sc/modules/ISC_Core.js:1573
                            EventHandler._handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:1415
                            [c]EventHandler.handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:1410
                            [c]EventHandler.dispatch() @ mymodule/sc/modules/ISC_Core.js:1648
                            anonymous() @ mymodule/sc/modules/ISC_Core.js:76
                        
                        com.smartgwt.client.core.JsObject$SGWT_WARN: 22:09:11.690:MUP4:WARN:Log:TypeError: _8 is undefined
                        Stack from error.stack:
                            TimelineView.cellMouseUp() @ mymodule/sc/modules/ISC_Calendar.js:313
                            anonymous() @ mymodule/sc/modules/ISC_Core.js:77
                            GridRenderer.mouseUp() @ mymodule/sc/modules/ISC_Grids.js:692
                            [a]MathFunction.invokeSuper() @ mymodule/sc/modules/ISC_Core.js:281
                            [a]MathFunction.Super() @ mymodule/sc/modules/ISC_Core.js:273
                            GridBody.mouseUp() @ mymodule/sc/modules/ISC_Grids.js:830
                            Canvas.handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:2825
                            [c]EventHandler.bubbleEvent() @ mymodule/sc/modules/ISC_Core.js:1573
                            EventHandler._handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:1415
                            [c]EventHandler.handleMouseUp() @ mymodule/sc/modules/ISC_Core.js:1410
                            [c]EventHandler.dispatch() @ mymodule/sc/modules/ISC_Core.js:1648
                            anonymous() @ mymodule/sc/modules/ISC_Core.js:76
                        
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                            at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                            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:293)
                            at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
                            at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
                            at java.lang.Thread.run(Thread.java:695)
                        ERROR: 22:09:11.691:MUP4:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/mymodule/sc/modules/ISC_Calendar.js, line 313
                        com.smartgwt.client.core.JsObject$SGWT_WARN: 22:09:11.691:MUP4:WARN:Log:Uncaught JavaScript exception: TypeError: _8 is undefined in http://127.0.0.1:8888/mymodule/sc/modules/ISC_Calendar.js, line 313
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                            at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                            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:338)
                            at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                            at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
                            at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                            at com.smartgwt.client.util.SC.logWarn(SC.java)
                            at com.smartgwt.client.util.LogUtil.handleOnError(LogUtil.java:35)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                            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:293)
                            at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
                            at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
                            at java.lang.Thread.run(Thread.java:695)

                        Comment

                        Working...
                        X