If I try to create FormPanel inside TabPanel I get strange layout behavior.

How it looks when I call show() on window for the first time:
1st.png

When I show window for the second time I get correct layout.
2nd.png


PHP Code:
    private TextField titleText;
    private 
TextArea abstractText;
    private 
TextField doiText;
    private 
TextButton saveButton;
    private 
Window window;

    public 
ArticleWindowView()
    {
        
initialize();
    }

    private 
void initialize()
    {
        
window = new Window();
        
window.setPixelSize(800500);
        
window.setPlain(true);
        
window.setModal(true);
        
window.setBlinkModal(true);
        
window.setHeadingText("Article");

        
createTabs();

        
saveButton = new TextButton("Save");
        
window.addButton(saveButton);

        
TextButton b = new TextButton("Close");
        
b.addSelectHandler(new SelectHandler()
        {

            @
Override
            
public void onSelect(SelectEvent event)
            {
                
window.hide();
            }
        });
        
window.addButton(b);
    }

    private 
void createTabs()
    {
        
TabPanel tabPanel = new TabPanel();
        
tabPanel.setAnimScroll(true);
        
tabPanel.setPlain(true);

        
window.setWidget(tabPanel);

        
initGeneralTab(tabPanel);
        
initFileTab(tabPanel);
    }

    private 
void initGeneralTab(TabPanel tabPanel)
    {
        
VerticalLayoutContainer p = new VerticalLayoutContainer();
        
p.setLayoutData(new MarginData(8));
        
tabPanel.add(p"General");

        
titleText = new TextField();
        
p.add(new FieldLabel(titleText"Title"));
        
abstractText = new TextArea();
        
p.add(new FieldLabel(abstractText"Abstract"), new VerticalLayoutContainer.VerticalLayoutData(-18, -100));
    }

    private 
void initFileTab(TabPanel tabPanel)
    {
        final 
VerticalPanel verticalPanel = new VerticalPanel();
        
verticalPanel.setLayoutData(new MarginData(8));
        
tabPanel.add(verticalPanel"Files");

        final 
FramedPanel framedPanel = new FramedPanel();
        
framedPanel.setHeadingText("File Upload Example");
        
framedPanel.setButtonAlign(BoxLayoutPack.CENTER);
        
framedPanel.setWidth(350);
        
verticalPanel.add(framedPanel);


        final 
FormPanel formPanel = new FormPanel();
        
formPanel.setAction("myurl");
        
formPanel.setEncoding(Encoding.MULTIPART);
        
formPanel.setMethod(Method.POST);
        
framedPanel.add(formPanel);

        
VerticalLayoutContainer p = new VerticalLayoutContainer();
        
formPanel.add(p);

        
TextField firstName = new TextField();
        
firstName.setAllowBlank(false);
        
p.add(new FieldLabel(firstName"Name"), new VerticalLayoutData(-18, -1));

        final 
FileUploadField fileField = new FileUploadField();
        
// file.setAllowBlank(false);
        
fileField.setName("uploadedfile");
        
p.add(new FieldLabel(fileField"File"), new VerticalLayoutData(-18, -1));

        
TextButton btn = new TextButton("Reset");
        
framedPanel.addButton(btn);

        
btn = new TextButton("Submit");
        
framedPanel.addButton(btn);


    }

    public 
void show()
    {
        
window.show();
    }