예제 #1
0
  public void showModal() {
    if (mainWidget_ == null) {
      mainWidget_ = createMainWidget();

      // get the main widget to line up with the right edge of the buttons.
      mainWidget_.getElement().getStyle().setMarginRight(3, Unit.PX);

      mainPanel_.insert(mainWidget_, 0);
    }

    originallyActiveElement_ = DomUtils.getActiveElement();
    if (originallyActiveElement_ != null) originallyActiveElement_.blur();

    // position the dialog
    positionAndShowDialog();

    // defer shown notification to allow all elements to render
    // before attempting to interact w/ them programatically (e.g. setFocus)
    Timer timer =
        new Timer() {
          public void run() {
            onDialogShown();
          }
        };
    timer.schedule(100);
  }