JFreeChartWrapper - addComponent() is undefined

Hi :slight_smile:

Before I explain my problem here is my configuration:

  • Eclipse Luna (latest version) with Ivy and Vaadin 7 (all up to date)
  • Debian 7 Wheezy 64bit
  • Java 8 (Oracle version)
  • Tomcat 8

I’m just started working with Vaadin (Ivy too :D) and I wanted to create a simple chart. There is a huge amount of addons out there some of which pretty expensive and others - for free. I found the JFreeChartWrapper and decided on using it. For this purpose I also looked for examples and found
this one
. The description of the add-on says I have to also include the complete JFreeChart in my
ivy.xml
:

<ivy-module> <dependencies> ... <dependency org="org.vaadin.addon" name="jfreechartwrapper" rev="3.0.2" /> ... </dependencies> </ivy-module Eclipse does not report any dependecy issues whatsoever. Hower it complains when I try to add the JFreeChartWrapper to the custom
Panel
called
JFreeChartWrapperSample
(see link with example above). The tip Eclipse gives me is:


The method addComponent(JFreeChartWrapper) is undefined for the type JFreeChartWrapperSample

The complete error that appears upon executing the project on my Tomcat server (running on localhost) is telling me that a ServletException was thrown (
java.lang.Error
) due to an unresolved compilation problem namely that addComponent() is not defined for the JFreeChartWrapper. I have worked only with CustomComponent and Views (in Navigator) to implement something more customized but never implemented a Panel myself so I might be missing something here that is not JFreeChartWrapper related. I see that other people manage to get it up and running so the problem is obviously in something that I did (not do). In the example above I have included only the
createBasicDemo()
part including everything that is used in it to keep things as compact as possible.

EDIT: Further investigation told me to look at the declaration of the Panel class. For my surprise there is actually not a single addComponent() that has been overriden so this method comes from the AbstractSingleComponentContainer class which it extends. Since the Panel class does not override this particular method I can safely presume that it doesn’t need more that its super class is offering.

Thanks for your time,
AA

Hello,

Sample you are using is for Vaadin 6. That’s why you get compilation errors. Panel uses now a setcontent() instead of addComponent().

Anyway fixing this code to be working with Vaadin 7 should be as simple as :

public JFreeChartWrapperSample()
{

VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.addComponent(createBasicDemo());
layout.addComponent(getLevelChart());
layout.addComponent(regressionChart());

setContent(layout);

}

…Not tested anyway :wink:

Regards
Sebastien

Thank you so much. I had to do one additional step described by @Matti Tahvonen
here
. I have Vaadin 7.4.3 and the issue described in that thread is still present.

Thanks again! Your reply was really helpful! Now I’m going back to my charts. :stuck_out_tongue: