Add Button programmatically to the visual designer?


I want to reuse the visual designer as a preview in the eclipse ide. So how can I e.g. add a button prgrammatically to source code and visual editor?

I tried this via an SWT Button, but the issue is about the properties of the vaadin control. How do I set them on the right way? I use ComponentProperties and VaadinComponentProperties, but it is not at all ok.

Here is my example source.

	Button button = new Button(getContainer(), SWT.PUSH);
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			try {
				List<ComponentModel> childComponents = getModelFromJava().getChildComponents();
				boolean debug=true;
				 ComponentModel button3 = new ComponentModel();
				 ComponentProperty captionKey = new StringComponentProperty("Caption");
				 button3.setProperty(captionKey, "BUTTON-TEST");

				 ComponentProperty widthKey = new VaadinComponentProperties.ResourceComponentProperty("Width", null, AbstractComponent.class);
				 button3.setProperty(widthKey, "-1px");

				 ComponentProperty heightKey = new VaadinComponentProperties.ResourceComponentProperty("Height", null, AbstractComponent.class);
				 button3.setProperty(heightKey, "-1px");
				 ComponentProperty immediateKey = new ComponentProperties.BooleanComponentProperty("Immediate", null, null);
				 button3.setProperty(immediateKey, "false");

				 ComponentProperty positionKey = new VaadinComponentProperties.ResourceComponentProperty("Position", null, AbstractComponent.class);
				 button3.setProperty(positionKey, "200.0px;left:180.0px");

// System.out.println(“Test”);
} catch (CoreException e1) {

		private void debug(List<ComponentModel> childComponents) {
			ComponentModel componentModel = childComponents.get(0);
			Map<ComponentProperty, String> properties = componentModel.getProperties();
			List theList = new ArrayList(properties.entrySet());
			for (Object object : theList) {
	button.setText("Click me");

Thanks for help.

best regards,



i find the way to use the defined attributes like

                                     ComponentProperty heightKey = VaadinComponentProperties.HEIGHT;
				 button3.setProperty(heightKey, "-1px");

				 ComponentProperty widthKey = VaadinComponentProperties.WIDTH;
				 button3.setProperty(widthKey, "-1px");
				 ComponentProperty captionKey = VaadinComponentProperties.CAPTION;
				 button3.setProperty(captionKey, "Hallo Welt");
				 ComponentProperty immediateKey = VaadinComponentProperties.IMMEDIATE;
				 button3.setProperty(immediateKey, "false");
				 ComponentProperty positionKey = VaadinComponentProperties.ABSOLUTE_POSITION;
				 button3.setProperty(positionKey, "top:200.0px;left:180.0px");

But when the component is added to the model, how can I update the visualpage?

Best regards,