PDA

View Full Version : [FNR] [2.0-M2] Charts & Windows



mtarantini
15 May 2009, 4:19 AM
Hi,

It seems where is an issue when you add a chart within a Windows,

Here a snippet of my Test :



//All needed imported...
import....


public class Test implements EntryPoint
{

/**
* This is the entry point method.
*/
public void onModuleLoad()
{

Window win = new Window();
win.setSize(400, 400);
win.setLayout(new FitLayout());
ContentPanel cp = new ContentPanel();
cp.setHeading("Pie chart");
cp.setLayout(new FitLayout());

final Chart chart = new Chart("../res/chart/open-flash-chart.swf");
chart.setBorders(true);
chart.setChartModel(getPieChartData());

cp.add(chart);

win.add(cp);

RootPanel.get().add(win);
}

private ChartListener listener = new ChartListener()
{

public void chartClick(ChartEvent ce)
{
Info.display("Chart Clicked", "You selected {0}.", "" + ce.getValue());
}
};

private ChartModel getPieChartData()
{
ChartModel cm = new ChartModel("Sales by Region", "font-size: 14px; font-family: Verdana; text-align: center;");
cm.setBackgroundColour("#fffff5");
Legend lg = new Legend(Position.RIGHT, true);
lg.setPadding(10);
cm.setLegend(lg);

PieChart pie = new PieChart();
pie.setAlpha(0.5f);
pie.setNoLabels(true);
pie.setTooltip("#label# $#val#M<br>#percent#");
pie.setColours("#ff0000", "#00aa00", "#0000ff", "#ff9900", "#ff00ff");
pie.addSlices(new PieChart.Slice(100, "Australia"));
pie.addSlices(new PieChart.Slice(200, "USA"));
pie.addSlices(new PieChart.Slice(150, "Japan"));
pie.addSlices(new PieChart.Slice(120, "Germany"));
pie.addSlices(new PieChart.Slice(60, "United Kingdom"));
pie.addChartListener(listener);

cm.addChartConfig(pie);
return cm;
}
}
The problem is that you can't move the windows anymore, but the resizing is working.
This bug append when running under the shell or a WebKit browser (tested on Chrome), FF3 is working well.

also, when resizing the windows, a null point exception occurs in the shell



java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.core.El.isStyleAttribute(El.java:1778)
at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1760)
at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1744)
at com.extjs.gxt.ui.client.widget.Layer.sync(Layer.java:324)
at com.extjs.gxt.ui.client.widget.Layer.setWidth(Layer.java:275)
at com.extjs.gxt.ui.client.core.El.setSize(El.java:2447)
at com.extjs.gxt.ui.client.core.El.setSize(El.java:2433)
at com.extjs.gxt.ui.client.widget.Layer.setSize(Layer.java:224)
at com.extjs.gxt.ui.client.widget.Shim.createShim(Shim.java:84)
at com.extjs.gxt.ui.client.widget.Shim.cover(Shim.java:52)
at com.extjs.gxt.ui.client.fx.Resizable.handleMouseDown(Resizable.java:495)
at com.extjs.gxt.ui.client.fx.Resizable.access$0(Resizable.java:461)
at com.extjs.gxt.ui.client.fx.Resizable$ResizeHandle.onBrowserEvent(Resizable.java:96)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)
at sun.reflect.GeneratedMethodAccessor12.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.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
Any Idea of what cause this problem ?

Thanks in advance.

sven
15 May 2009, 4:22 AM
Thanks for reporting. I already have the NPE fixed but not yet in SVN

sven
15 May 2009, 4:25 AM
ALso your code has an issue:


RootPanel.get().add(win); is wrong for windows. You need to call
win.show()

mtarantini
15 May 2009, 4:34 AM
I change the call of the windows, but the same issue occurs in the Shell

sven
15 May 2009, 4:38 AM
Are you on a mac? Can you post me the stracktrace you get, when you try to drag?

mtarantini
15 May 2009, 4:43 AM
i'm on Windows Xp, JDK 1.6.0_13, and the thing is, I can't even drag the window, I have the cross pointer when the mouser over the header, but that's all, no error, no stack.

It's like the Click Event on the windows header wasn't catch.

Edit : More information, my code works on FF3, IE7 (but don't on the Shell, and Chrome 2.0beta)

sven
15 May 2009, 4:46 AM
No it is somethign else. The webkit engine is throwing an exception.

mtarantini
20 May 2009, 2:46 AM
Problem Solved with the last SVN release.

Thanks.

sven
20 May 2009, 3:32 AM
Yes, it is fixed in SVN

mtarantini
20 May 2009, 4:21 AM
hummm in fact, it's working under the Shell, but still bugging with WebKit (Chrome 2 Beta in my case).

sven
20 May 2009, 4:22 AM
Chroem 2 beta is not supported yet.