Dynamical Component Adding with Push enabled not working

Hello everybody,

in our current Vaadin-7-Project (7.4.2), we are using the Wizards-Addon (https://vaadin.com/directory#addon/wizards-for-vaadin:vaadin) to let the user generate some data. We put the Wizard into a GridLayout, wrap our server-side data-object inside a BeanItem and bind its properties to the fields in the Wizard-Steps. Besides the Wizard, we put a self-designed component (extending from VerticalLayout, just a few other small Layouts and Labels in it) into the GridLayout where we want to display the current configuration from the Wizard. So we decided to bind the same BeanItem-Properties from the Wizard to the Labels displaying the current configuration. Now the following Problem occurs:

In our WizardSteps, we have some CheckBoxes with ValueChangeListeners. On value-change, we want to add Labels to our self-designed component. It occurs, that the Server-Log tells us the correct number of dynamically added labels, but they are not displayed in the UI.
If we add Buttons to the self-designed Component to add Labels via ClickListener, they are being displayed but not logged on the server in the parent’s componentCount.

Our UI is annotated the following:[code]
@Title(“Our Application Title”)
@Push(value = PushMode.MANUAL, transport = Transport.STREAMING)
public class OurVaadinUI extends UI {

The method to add the Label to the self-designed component receives a correctly built Label (ensured by debugging-results):

public void addToContent(final Label label) { content.addComponent(new Panel(label)); LOGGER.debug("I have " + content.getComponentCount() + " Components."); UI.getCurrent().push(); } The structure looks like this:

public class OurVaadinUI extends UI {
    private OurContentClass content;

public class OurContentClass extends GridLayout {
    public OurContentClass() {
        super(2, 1)
        addComponent(new Wizard(), 0, 0);
        addComponent(new OurCurrentConfigComponent(), 1, 0);

public class OurCurrentConfigComponent extends VerticalLayout {
    public void addToContent(final Label labe) {

As I said, the Steps inside the Wizard contain components with listeners, which tell the OurCurrentConfigComponent to generate a new Label on event fired, while the generated Label is added to the Layout but is not being displayed.

Thanks in advance for your help.


PS: Tell us if you need more code-snippets.

If you adding the label as a result of a Value Change event you don’t have to use push. Only if you do it in a seperate thread.
Also if you actually need to push you should synchronize your access to the UI using:

Hello Marius,
thanks for your reply.

We already tried it with and without the push. We also tried the UI.access(), without success.

Weird. The code seems fairly straight forward. I personally can’t see anything that might be wrong in the code snippets you posted.
Could you post a little snippet from where you actually call addToComponent? Maybe there is some problem with the call or the reference to the OurCurrentConfigComponent.

The OurCurrentConfigComponent is stored in a kind of global storage singleton, which is known by any component needed. In the UI construction, we create 1 OurCurrentConfigComponent and store it in a field there. From inside a wizard-step in a components value-change-event, the OurCurrentConfigComponent can be received from the data-singleton and the following method in the OurCurrentConfigComponent is called:

public void addArtifact(Property content) { Label label = new Label(content); label.setCaption("TEST"); label.setIcon(new ThemeResource("anyImage.png")); subComponent.addToContent(label); } This method calls the method asked for (addToContent), where the created label is actually added to the UI.

In addition, it appears that the method is called, but even caption-changes for example in components already added (in the constructor) and displayed in the OurCurrentConfigComponent don’t work.

I get this suspicion that there might be a problem when storing the OnCurrentConfigComponent.
The described behaviour makes total sense if the Component you call a function on inside value change might be a different one then the one actually added to the gridlayout.
In one of your code snippet you also have this: addComponent(new OurCurrentConfigComponent(), 1, 0); so your creating a new Component and adding it to the layout and don’t store it somewhere. (although i’m guessing that this is not the actual code you use and you just simplified it)