Weird Layout(?) problem with third party GWT component

Hello all!

I’m new to vaadin and wanted to develop a little test site involving dynamic charts. So i tried to implement an example found in the wiki to integrate gflot to vaadin:


Integrating an existing GWT widget

I created a new Vaadin 7 project in eclipse (Indigo SR2) using the vaadin plugin (2.1.0.2013…), reproduced the steps mentioned in the wiki and compiled the widgets. For the class LinePlotState I had to use AbstractComponentState as a superclass because ComponentState could not be found (I hope this was correct?)

If Im using this new component like:

public class TestUI extends UI {

	@Override
	protected void init(VaadinRequest request) {
		VerticalLayout layout = new VerticalLayout();
		layout.setMargin(true);
		setContent(layout);

                LinePlot mp = new LinePlot();
                mp.addSeries("Test", "green", new Float[] {3f,5f,3f,6f,8f,12f,1f,9f});

		layout.addComponent(mp);
	}
}

the graph is correctly displayed, but the component (graph) gradually grows vertically without interaction (and without limits -_-). I tried using different vaadin versions (7.0.0 and snapshot) and different gflot versions (2.4.0, 2.4.3, 3.0.1).

Can someone help with this problem? I can provide he code and other details if needed. Thanks in advance.

Best regards…

Hi, and welcome!

Just a little background info: Vaadin components can have three different states regarding it size; defined, relative and undefined. Define means a set size like 300px, relative is something like 50% of the parent layout and undefined means that the size of the component should be as big as component itself wants to be - in a way that it fits just right.

I am fairly certain that the default for new component is undefined (component.setSizeUndefined()), which means that in this case, it is what the GWT component wants to be. It seems that some event happens within the GWT component which changes the size a bit bigger all the time. I haven’t heard about a problem like this in Vaadin components before so I don’t think it is directly Vaadin that is causing this.

What I suggest you do, is getting familiar with debugging client side code. You put breakpoints into the java classes in appropriate methods and start something called
DevMode
or
SuperDevMode
. Then you can walk trough the code and see what happens. Maybe something within the connector or the widget SimplePlot?

Sorry that I can’t give you an exact answer on what is causing your behavior, but this is anyhow a good practice on GWT development within Vaadin, if that is something that you are in to.