code: public static void bindPopped (final Value<Boolean> popped, final Position pos,
                                     final Widget target, final PopupPanel panel)
      {
          Preconditions.checkNotNull(target, "target");
          Preconditions.checkNotNull(panel, "panel");
          panel.addCloseHandler(new CloseHandler<PopupPanel>() {
              public void onClose (CloseEvent<PopupPanel> event) {
                  popped.update(false);
              }
          });
          popped.addListenerAndTrigger(new Value.Listener<Boolean>() {
              public void valueChanged (Boolean visible) {
                  if (visible) {
                      show(panel, pos, target);
                  } else {
                      panel.hide();
                  }
              }
          });
      }
docs: Binds the popped up state of a popup to the supplied boolean value and vice versa (i.e. if
  the popup is popped down, the value will be updated to false).