Problem resizing component

Hi.

We have HorizontalSplitPanel with a Tree on the left side and a content panel on the right side. Each option of the tree makes different content is shown on the right side. We do this by adding and removing different content. Also we have a button to ‘maximize’ the right content, i.e., to show the content in the whole browser space. To restore the original layout we have another button.

Here comes the problem.
The maximize button works ok the first time. But when the panel is restored to its original size, the next time is maximized the content of this panel is not resized to fit the whole window.

This is the code that makes the ‘maximization’ is the following:

  public static void ampliarFichaOriginal(final AbstractLayout contenido, final VlPanel panel) {
    final Window wMed = new Window();
    wMed.setModal(true);
    wMed.setClosable(false);
    wMed.setResizable(false);
    wMed.setSizeFull();
    contenido.setSizeFull();
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    vl.addComponent(contenido);
    vl.setExpandRatio(contenido, 1);
    final HorizontalLayout hl = new HorizontalLayout();//pasat a final
    hl.setHeight(40, Sizeable.Unit.PIXELS);
    hl.setSpacing(true);
    vl.addComponent(hl);
    vl.setExpandRatio(hl, 0);
    Button bAceptar = new Button("OK", FontAwesome.CHECK);
    bAceptar.addClickListener(new Button.ClickListener() {
      @Override
      public void buttonClick(Button.ClickEvent event) {
        UI.getCurrent().removeWindow(wMed);
      }
    });
    hl.addComponent(bAceptar);
    wMed.addCloseListener(new Window.CloseListener() {
      @Override
      public void windowClose(Window.CloseEvent e) {
        panel.addComponent(contenido);
        contenido.setSizeFull();
      }
    });
    wMed.setContent(vl);
    wMed.getContent().setSizeFull();
    UI.getCurrent().addWindow(wMed);
  }

You can see a sample here:
https://217.160.208.195/test/6/

We have had this problem with several Vaadin versions. We are using the latest version (7.6.4). We have tested with Firefox, Chrome and IE. The same happens on all browsers.

Thank you.