Prafulljohri / gwt-google-apis

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

Exception Thrown Placing AnnotatedTimeLine in TabPanel. #330

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release: gwt 1.7.1, gwt-visulisation 1.0.2

Detailed description:

I am using GWT 1.7.1 and GWT-VIZ 1.0.2 on XP.  The following code
works fine for me...

1. TabPanel tp = new TabPanel();
2. VerticalPanel vp = new VerticalPanel();
3. vp.add(new MyTimeline());
4. RootPanel.get().add(tp);
5. tp.add(vp, "stuff");
6. tp.selectTab(0);

...but just switching lines (4) and (5) as below...

1. TabPanel tp = new TabPanel();
2. VerticalPanel vp = new VerticalPanel();
3. vp.add(new MyTimeline());
4. tp.add(vp, "stuff");
5. RootPanel.get().add(tp);
6. tp.selectTab(0);

...causes the following exception;

[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (Error):
 number: 0
 description:
        at
com.google.gwt.visualization.client.visualizations.Visualization.draw
(Native Method)
        at
com.google.gwt.visualization.client.visualizations.Visualization.onLoad
(Visualization.java:116)
        at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:264)
        at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
        at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
        at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
        at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
        at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
        at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
        at com.google.gwt.user.client.ui.Composite.onAttach(Composite.java:
102)
        at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:393)
        at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:119)
        at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:
86)
        at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:
80)
        at uk.co.wibble.client.HistoryGetter.<init>(HistoryGetter.java:19)
        at uk.co.wibble.client.TestTimeLine.run(TestTimeLine.java:22)
        at com.google.gwt.ajaxloader.client.ExceptionHelper.runProtected
(ExceptionHelper.java:36)

Why should the order of these statements cause this kind of issue?
The above issue replicator models a production defect for me that
suffers from the same kind of line order related wierdness.  It's not
related to the data as I can reproduce this with a wide range of
datasets.  My host web page is empty (default one generated by GWT).
FYI, here is my AnnotatedTimeLine derivative...

public class MyTimeline extends AnnotatedTimeLine
{
        public MyTimeline()
        {
                super(getData(), getOptions(), "700px", "240px");
        }

        private static AbstractDataTable getData()
        {
                DataTable data = DataTable.create();
            data.addColumn(ColumnType.DATETIME, "Date");
            data.addColumn(ColumnType.NUMBER, "Stuff)");
            data.addRows(6);

            try
            {
                        data.setValue(0, 0, new Date(2008 - 1900, 1, 1, 1,
1, 1));
                        data.setValue(1, 0, new Date(2008 - 1900, 1, 2, 2,
2, 2));
                        data.setValue(2, 0, new Date(2008 - 1900, 1, 3, 3,
3, 3));
                        data.setValue(3, 0, new Date(2008 - 1900, 1, 4, 4,
4, 4));
                        data.setValue(4, 0, new Date(2008 - 1900, 1, 5, 5,
5, 5));
                        data.setValue(5, 0, new Date(2008 - 1900, 1, 6, 6,
6, 6));
            }
            catch (JavaScriptException ex)
            {
                GWT.log("Error creating data table - Date bug on mac?", ex);
            }
            data.setValue(0, 1, 30000);
            data.setValue(1, 1, 14045);
            data.setValue(2, 1, 0);
            data.setValue(3, 1, 75284);
            data.setValue(4, 1, 41476);
            data.setValue(5, 1, 33322);
                return data;
        }

        private static AnnotatedTimeLine.Options getOptions()
        {
                AnnotatedTimeLine.Options options =
AnnotatedTimeLine.Options.create
();
                options.setDisplayAnnotations(true);
                options.setOption("displayRangeSelector", false);
                options.setScaleType(AnnotatedTimeLine.ScaleType.ALLFIXED);
                return options;
        } 

Workaround if you have one:

None

Links to the relevant GWT Developer Forum posts:

http://groups.google.com/group/google-visualization-api/browse_thread/thread/658
60b8fa99dbbe7

Original issue reported on code.google.com by douglas....@gmail.com on 19 Nov 2009 at 9:55

GoogleCodeExporter commented 9 years ago
How often do these bugs get reviewed - I have had no feedback on this forum or 
the
relevant group.  Can someone set my expectations please?

Original comment by douglas....@gmail.com on 29 Nov 2009 at 5:35

GoogleCodeExporter commented 9 years ago
I've seen something similar with the annotated time line.  Documented in
http://code.google.com/p/google-web-toolkit/issues/detail?id=4290&can=4

My problem has to do with the container being visible or not when actually 
drawing
the visualization.  If the contains is not visible, then it gets an exception
regarding a container width of zero.  

Original comment by smulle...@gmail.com on 30 Nov 2009 at 9:33

GoogleCodeExporter commented 9 years ago
Thanks smullen27.  Sounds potentially related.  I will have a look to see if 
this is
indeed the case.

Original comment by douglas....@gmail.com on 14 Dec 2009 at 2:49

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 24 Feb 2010 at 1:24

GoogleCodeExporter commented 9 years ago
I have just encountered this problem.
Try this work around:

DeferredCommand.addCommand(new Command(){

                    @Override
                    public void execute() {
                          myPanel.setWidget(theChart);
                    }

                });

Original comment by chenlong...@gmail.com on 28 Mar 2010 at 8:17

GoogleCodeExporter commented 9 years ago
Suck a dick

Original comment by justus3...@gmail.com on 10 Jan 2014 at 8:57

GoogleCodeExporter commented 9 years ago

Original comment by justus3...@gmail.com on 10 Jan 2014 at 9:10

Attachments: