Sub-Window from Custom Component leads to Layout Exception

Hi,

I started yesterday migrating my Vaadin 6 application to Vaadin 7. I am also using the Spring integration Add-On.

The problem is, when I am opening a subwindow I get following Client-Side Exception:

The main Application looks like the following:


@Component("vaadinApp")
@Scope("prototype")
@Theme("myTheme")
public class VaadinApp extends UI {

	/**
	 * 
	 */
	private static final Logger	logger				= Logger.getLogger(VaadinApp.class);

	@Autowired
	private ConfigurationViewService view;
	
	@Autowired 
	private AddViewService addService;
	
	@Override
	public void markAsDirty() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void init(VaadinRequest request) {
		logger.info("Vaadin Application initialized");
		
		setContent(view.getConfigView());
		view.setVaadinApp(this);
		
		addService.setVaadinApp(this);
	}

}

So the ConfigurationViewService has the reference to the View. This view is an CustomComponent.

When I then add a new Sub-Window via


	vaadinApp.addWindow((Window)childWindow);

I get the before mentioned Exception.

Does somebody have a clue?

Best Regards

I’ve seem to have the same problem
project: Eclipse + Maven
after migrating from V6 to V7 (7.1.1) subwindows seem to fail to attach internal VerticalLayout to its content

even simple example from the book does not work


                                Window subWindow = new Window();
				VerticalLayout subContent = new VerticalLayout();

				subContent.setMargin(true);
				subWindow.setContent(subContent);

				// Put some components in it
				subContent.addComponent(new Label("Meatball sub"));
				subContent.addComponent(new Button("Awlright"));

				// Center it in the browser window
				subWindow.center();

				// Open it in the UI
				UI.getCurrent().addWindow(subWindow);

it just opens shrunk window with no content in it

this is what i get when vaadin debug monitor is on:
[i]

Only managed layouts can need layout, layout attempted for nulljava.lang.IllegalStateException: Only managed layouts can need layout, layout attempted for null
at Unknown.Qy(Unknown Source)
at Unknown.Ly(Unknown Source)
at Unknown.cU(Unknown Source)
at Unknown.GS(Unknown Source)
at Unknown.q6(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)

[/i]
the text of error goes from here:
http://dev.vaadin.com/browser/vaadin/src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java?rev=2f7d9810e53401c48d4a5972de726c1e5d9a8e46

any ideas on where to look to fix this?

Please make sure you have recompiled the widgetset and the new widgetset is actually used by the browser (check e.g. the network tab of the debugging tools of your browser).

We have very similar code in a large number of automated tests that are run for every build and this would break many applications so I wonder what is triggering the problem here.

I am getting the same error with Vaadin 7.1.7. What was the solution?

If you are able to reproduce this with a minimal valid UI class (either with the code posted above or with your own example) with unmodified Vaadin 7.1.7 and the default widgetset, please
create a ticket
with the UI code.

The problem is right in the UI code above: markAsDirty doesn’t call super. Either remove it or do:

    @Override
    public void markAsDirty() {
        // Your code here.
        super.markAsDirty();
    }

As a rule of thumb, make sure you call super in overriden methods. Might be more then just this one.