AbsoluteLayout Not working within Eclipse Visual Editor

Hi!

I am trying to use the Eclipse plug-in and WYSIWYG Editor. Non of the generated code works. Can anyone help out? I’m in a bind with a pressing deadline!!

Here’s the generated code:
package org.iec.smartgridmapping.pages;

import com.vaadin.annotations.AutoGenerated;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;

public class IECHeader extends CustomComponent {

@AutoGenerated
private AbsoluteLayout mainLayout;
@AutoGenerated
private Label label_welcome;
@AutoGenerated
private Embedded embedded_iec;
@AutoGenerated
private Button button_disclaimer;
@AutoGenerated
private Button button_help;

/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */



/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */

/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 */
public IECHeader() {
	buildMainLayout();
	setCompositionRoot(mainLayout);

	// TODO add user code here
}

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new AbsoluteLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("100%");
	mainLayout.setHeight("100%");
	mainLayout.setMargin(false);
	
	// top-level component properties
	setWidth("100.0%");
	setHeight("100.0%");
	
	// button_help
	button_help = new Button();
	button_help.setCaption("Help");
	button_help.setImmediate(true);
	button_help.setWidth("-1px");
	button_help.setHeight("-1px");
	mainLayout.addComponent(button_help, "top:34.0px;left:886.0px;");
	
	// button_disclaimer
	button_disclaimer = new Button();
	button_disclaimer.setCaption("Disclaimer");
	button_disclaimer.setImmediate(true);
	button_disclaimer.setWidth("-1px");
	button_disclaimer.setHeight("-1px");
	mainLayout.addComponent(button_disclaimer, "top:34.0px;left:972.0px;");
	
	// embedded_iec
	embedded_iec = new Embedded();
	embedded_iec.setImmediate(false);
	embedded_iec.setWidth("-1px");
	embedded_iec.setHeight("-1px");
	embedded_iec.setSource(new ThemeResource(
			"img/component/embedded_icon.png"));
	embedded_iec.setType(1);
	embedded_iec.setMimeType("image/png");
	mainLayout.addComponent(embedded_iec, "top:20.0px;left:60.0px;");
	
	// label_welcome
	label_welcome = new Label();
	label_welcome.setCaption("Welcome!");
	label_welcome.setImmediate(false);
	label_welcome.setWidth("-1px");
	label_welcome.setHeight("-1px");
	label_welcome.setValue("Label");
	mainLayout.addComponent(label_welcome, "top:42.0px;left:450.0px;");
	
	return mainLayout;
}

}

I don’t see anything inherently wrong with your generated code. But it is hard to say since you do not describe what goes wrong. Could you please describe in more detail what you are trying to do with the component you have created with the visual editor and what fails?

It turns out nothing was wrong with the generated code. The issue was that I was trying to use .addComponent to my main window when, apparently, I am supposed to use .setContent when using a component container or composite.

Thanks for your reply.