Hi We are having issues with Darg and Drop when using flot charts in the SmartGWT widgets. The chart in the widget vanishes when we drag and drop. Thus we started experimenting with HTMLPanel(pure GWT), which works great when its text or images but am not able to display a JSNI- call to draw flot chart into a samrtGWT widget....see the code for portlet1 below...The exception we get is as below..not sure why is height=0. Any suggestions will be welcome...
Exception received--> Unable to load module entry point class com.tripod.eui.client.DoJo (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (String): Invalid dimensions for plot, width = 812, height = 0 at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: 237) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java: 126) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: 561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java: 289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java: 107) at com.tripod.eui.client.DoJo.DrawFlotChart(DoJo.java) at com.tripod.eui.client.DoJo.onModuleLoad(DoJo.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java: 396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java: 183) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java: 510) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java: 352) at java.lang.Thread.run(Unknown Source) Code for reference --> public class DoJo implements EntryPoint { @Override public void onModuleLoad() { /*** * 1) Place Flot API Related Function Call Javascript code in the HTML */ String strCode = "<script type=\"text/javascript\" language= \"javascript\" >"+ "$().ready(function(){$.plot($(\"#\"+targetID),[{label: \"Citrizine \", data: [[1,13], [2,21], [3,5], [4,1]]},{ data: [[1,8],[2,12], [3,18]], label: \"Tipin\"}],{series: {pie: {show: true}},legend: {show: true}});});"+ "</script>"; Widget widget = new Widget(); widget.setID("widget"); widget.setWidth100(); widget.setHeight100(); HTMLPanel clientHTMLPanel = new HTMLPanel("<div id='portlet' style='width=400; height=400;'>"+strCode+"</div>"); clientHTMLPanel.setSize("100%", "100%"); widget.addItem(clientHTMLPanel); widget.setTitle("widget"); /** * Try to set some text in the widget through a native script dynamically */ Widget widget1 = new Widget(); widget1.setWidth100(); widget1.setHeight100(); HTMLPanel clientHTMLPanelOne = new HTMLPanel("<div id='portlet1' style='width=400; height=400;'></div>"); widget1.addItem(clientHTMLPanelOne); widget1.setTitle("widget1"); widget1.setID("widget1"); /** * */ Widget widget2 = new Widget(); widget2.setWidth100(); widget2.setHeight100(); HTMLPanel clientHTMLPanelTwo = new HTMLPanel("<div id='portlet2' style='width=400; height=400;'></div>"); clientHTMLPanelTwo.setHeight("400"); clientHTMLPanelTwo.setWidth("400"); widget2.addItem(clientHTMLPanelTwo); widget2.setTitle("widget2"); widget2.setID("widget2"); /** * Place a SmartGWT Canvas. * Draw Flot chat on the Canvas through native script. */ Widget widget3 = new Widget(); widget3.setWidth100(); widget3.setHeight100(); Canvas clientHTMLPanelThree = new Canvas(); clientHTMLPanelThree.setID("portlet3"); clientHTMLPanelThree.setHeight100(); clientHTMLPanelThree.setWidth100(); widget3.addItem(clientHTMLPanelThree); widget3.setTitle("widget3"); widget3.setID("widget3"); Widget widget4 = new Widget(); widget4.setID("widget4"); widget4.setWidth100(); widget4.setHeight100(); Canvas clientHTMLPanelFour = new Canvas(); clientHTMLPanelFour.setID("portlet4"); clientHTMLPanelFour.setHeight100(); clientHTMLPanelFour.setWidth100(); widget4.addItem(clientHTMLPanelFour); widget4.setTitle("widget4"); /** * Placing all the widgets in a HLayout Panel. */ final PortalLayout portalLayout = new PortalLayout(2); portalLayout.setWidth100(); portalLayout.setHeight100(); portalLayout.setID("portalLayout"); portalLayout.addPortlet(widget); portalLayout.addPortlet(widget1); portalLayout.addPortlet(widget2); portalLayout.addPortlet(widget3); portalLayout.addPortlet(widget4); /** * Creating a TabSet */ TabSet tabSet = new TabSet(); tabSet.setHeight100(); tabSet.setWidth100(); tabSet.setOverflow(Overflow.VISIBLE); Tab tTab = new Tab("DashBoard"); tabSet.addTab(tTab); Tab tTabOne = new Tab("NextTab"); tabSet.addTab(tTabOne); tabSet.getTabs()[0].setPane(portalLayout); tabSet.draw(); // WriteMessage("portlet1"); ReDrawFlotChart("portlet3"); WriteMessage("portlet2"); WriteMessageOnCanvas("portlet4"); DrawFlotChart("portlet1"); } private static native void WriteMessage(String targetID)/*-{ $wnd.$("#"+targetID).append("<font size=\"6\">This Message is written on Pure GWT HTMLPanel. If you Drag & Drop this Widget. Widget Do not lose this Message. PlaceHolder ID :- "+targetID+"</font>"); }-*/; private static native void WriteMessageOnCanvas(String targetID)/*-{ $wnd.$("div[eventproxy=" + targetID + "]:eq(0)").append("<font size= \"8\">This Message is written on SmartGWT Canvas. If you Drag&Drop this Widget. Widget will lose this Message. PlaceHolder ID :- "+targetID+"</font>"); }-*/; private static native void AlertFromHTML(String targetID)/*-{ $wnd.sayHello(targetID); }-*/; private static native void DrawFlotChart(String targetID)/*-{ $wnd.$().ready(function(){ $wnd.$.plot($wnd.$("#"+targetID) ,[{label: "Citrizine", data: [[1,13], [2,21], [3,5], [4,1]]},{ data: [[1,8],[2,12],[3,18]], label: "Tipin"}] ,{series: {pie: {show: true}},legend: {show: true}} ); }); }-*/; private static native void ReDrawFlotChart(String targetID)/*-{ $wnd.$().ready(function(){ $wnd.$.plot($wnd.$("div[eventproxy=" + targetID + "]:eq(0)") ,[{label: "Citrizine", data: [[1,13], [2,21], [3,5], [4,1]]}, {label: "Tipin",data: [[1,8],[2,12],[3,18]]}] ,{series: {pie: {show: true}},legend: {show: true}} ); }); }-*/; } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.