@Listen("onTimer = #timer")
  public void printVisibleWindows() {
    List<Component> popupList = Selectors.find(getPage(), "popup");
    List<Component> windowList =
        Selectors.find(
            getPage(),
            "window[mode='modal'][visible=true], window[mode='overlapped'][visible=true]");

    System.out.println(popupList.size() + " popup");
    System.out.println(windowList.size() + " window");

    popupList = Selectors.find(getPage(), "popup");
    int visibleCount = 0;
    for (Component c : popupList) {
      Popup p = (Popup) c;
      if (p.isVisible()) {
        visibleCount++;
      }
    }
    System.out.println(visibleCount + " visible popup");
  }
  public Popup generarPopupResultados(
      Textbox textboxResultado, boolean readonly, Pexamenes_paraclinicos pexamenes_paraclinicos) {
    // final Image image = (Image)form.getFellow("img_"+id_alumno);
    final Textbox tbxRes = textboxResultado;
    // popup.setId("popupResultados_" + key);
    Vlayout vlayout = new Vlayout();

    if (pexamenes_paraclinicos.getNormal_anormal().equals("S")) {
      String valor_na = (String) tbxRes.getAttribute("VALOR_NORMAL_ANORMAL");
      String valor_descripcion_na = (String) tbxRes.getAttribute("VALOR_DESCRIPCION_NA");
      final Radiogroup radiogroup_anormal = new Radiogroup();
      Radio radio_normal = new Radio("Normal");
      radio_normal.setValue("N");
      radiogroup_anormal.appendChild(radio_normal);
      radiogroup_anormal.appendChild(new Space());
      Radio radio_anormal = new Radio("Anormal");
      radio_anormal.setValue("A");
      radiogroup_anormal.appendChild(radio_anormal);

      vlayout.appendChild(radiogroup_anormal);

      final Textbox textbox_anormal = new Textbox();
      textbox_anormal.setWidth("400px");
      textbox_anormal.setRows(4);
      textbox_anormal.setVisible(false);

      if (valor_na != null) {
        if (valor_na.equals("S")) {
          radio_normal.setChecked(true);
          radio_anormal.setChecked(false);
          textbox_anormal.setVisible(true);
        } else {
          radio_anormal.setChecked(true);
          radio_normal.setChecked(false);
          textbox_anormal.setVisible(false);
        }
      } else {
        radio_normal.setChecked(true);
        radio_anormal.setChecked(false);
        textbox_anormal.setVisible(false);
      }

      if (valor_descripcion_na != null) {
        textbox_anormal.setValue(valor_descripcion_na);
      }

      radiogroup_anormal.addEventListener(
          Events.ON_CHECK,
          new EventListener<Event>() {

            @Override
            public void onEvent(Event arg0) throws Exception {
              Radio radio_seleccionado = radiogroup_anormal.getSelectedItem();
              if (radio_seleccionado != null) {
                if (radio_seleccionado.getValue().toString().equals("A")) {
                  textbox_anormal.setVisible(true);
                } else {
                  textbox_anormal.setVisible(false);
                }
                tbxRes.setAttribute(
                    "VALOR_NORMAL_ANORMAL", radio_seleccionado.getValue().toString());
              }
            }
          });

      textbox_anormal.addEventListener(
          Events.ON_CHANGING,
          new EventListener<Event>() {

            @Override
            public void onEvent(Event arg0) throws Exception {
              InputEvent inputEvent = (InputEvent) arg0;
              tbxRes.setAttribute("VALOR_DESCRIPCION_NA", inputEvent.getValue());
            }
          });

      vlayout.appendChild(textbox_anormal);
    }

    final Textbox textbox = new Textbox();
    textbox.setWidth("400px");
    textbox.setRows(8);

    vlayout.appendChild(new Label("Resultado paraclinico"));
    vlayout.appendChild(textbox);
    textbox.setValue(tbxRes.getValue());
    textbox.addEventListener(
        "onChanging",
        new EventListener() {

          @Override
          public void onEvent(Event event) throws Exception {
            InputEvent inputevent = (InputEvent) event;
            tbxRes.setValue(inputevent.getValue());
          }
        });
    final Popup popup = new Popup();
    popup.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            textbox.setValue(tbxRes.getValue());
            textbox.setFocus(true);
          }
        });
    popup.appendChild(vlayout);
    contenedor.appendChild(popup);
    return popup;
  }