PopupView doesn't display caption

Since my
bug report
isn’t getting any attention, perhaps someone here can think of a work-around.

The caption text (AbstractComponent.setCaption()) on a PopupView does not display. An example program is below. I don’t see how to just use a label for the caption, since it wouldn’t line up with the other captions in the FormLayout.

package com.example.vaadintest;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class VaadinTestApplication extends Application
{
  public void init()
  {
    Window mainWindow = new Window("Vaadin Test Application");
    setMainWindow(mainWindow);

    FormLayout mainLayout = new FormLayout();
    mainWindow.setContent(mainLayout);
    
    TextField text = new TextField("Text Caption:");
    mainLayout.addComponent(text);

    PopupView popup = new PopupView ("Popup short text", new Label("I'm the popup content!"));
    popup.setCaption("Popup Caption:");
    mainLayout.addComponent(popup);
  }
}

Hi,

the reason for this and the usable workarounds are exactly the same as for CheckBox within a FormLayout - see
this post
for more information.

-tepi

Also you can just wrap the PopupView to a CssLayout and set the caption to the layout.

CssLayout layout = new CssLayout();
PopupView popup = new PopupView("Popup short text", new Label("I'm the popup content!"));
layout.setCaption("Popup Caption:");
layout.addComponent(popup);
mainLayout.addComponent(layout);

Thanks Johannes. That looks like the work-around I was looking for.