Exemplo n.º 1
0
  public void testHandlerIsCleared() {
    DialogBox dialogBox = new DialogBox();

    assertNull(dialogBox.resizeHandlerRegistration);

    dialogBox.show();
    assertNotNull(dialogBox.resizeHandlerRegistration);

    dialogBox.hide();
    assertNull(dialogBox.resizeHandlerRegistration);

    DialogBox autoHideBox = new DialogBox(true);
    assertNull(autoHideBox.resizeHandlerRegistration);

    autoHideBox.show();
    assertNotNull(autoHideBox.resizeHandlerRegistration);

    // trigger auto hide with mouse down
    NativeEvent mouseDownEvent =
        dialogBox
            .getElement()
            .getOwnerDocument()
            .createMouseDownEvent(0, 0, 0, 0, 0, false, false, false, false, 0);
    Document.get().getBody().dispatchEvent(mouseDownEvent);
    // handler should be gone
    assertNull(autoHideBox.resizeHandlerRegistration);
  }
Exemplo n.º 2
0
  private void popupDbCurator() {

    ClientSequenceDatabase csd = (ClientSequenceDatabase) dlb.getSelected();
    Integer selected = csd.getId();

    Map<String, String> emailInitialPairs = new TreeMap<String, String>();

    for (Map.Entry<String, ClientUser> me : userInfo.entrySet()) {
      emailInitialPairs.put(me.getKey(), me.getValue().getInitials());
    }

    final DialogBox dialogBox = new DialogBox(false);
    CurationEditor ce =
        new CurationEditor(
            selected,
            user.getEmail(),
            emailInitialPairs,
            new EditorCloseCallback() {
              public void editorClosed(final Integer openCurationID) {
                validationController.getAllowedValues(
                    dlb,
                    new Callback() {
                      public void done() {
                        if (openCurationID != null) {
                          dlb.select(openCurationID, validationController);
                        }
                        dialogBox.hide();
                      }
                    });
              }
            });
    DOM.setElementAttribute(dialogBox.getElement(), "id", "db-curator");
    dialogBox.setStyleName("dbCuratorEmbed");
    dialogBox.setWidget(ce);
    dialogBox.setSize(Window.getClientWidth() * .8 + "px", Window.getClientHeight() * .8 + "px");
    ce.setPixelSize(
        Math.max((int) (Window.getClientWidth() * .8), 770), (int) (Window.getClientHeight() * .8));
    //		LightBox lb = new LightBox(dialogBox);
    //		try {
    //			lb.show();
    //		} catch (Exception ignore) {
    dialogBox.show();
    //		}
    dialogBox.center();
  }
Exemplo n.º 3
0
  public void testDebugId() {
    DialogBox dBox = new DialogBox();
    dBox.setAnimationEnabled(false);
    dBox.ensureDebugId("myDialogBox");
    dBox.setText("test caption");
    Label content = new Label("content");
    dBox.setWidget(content);
    dBox.show();

    // Check the body ids
    UIObjectTest.assertDebugId("myDialogBox", dBox.getElement());
    UIObjectTest.assertDebugId("myDialogBox-content", DOM.getParent(content.getElement()));

    delayTestFinish(5000);
    // Check the header IDs
    Scheduler.get()
        .scheduleDeferred(
            new ScheduledCommand() {
              public void execute() {
                UIObjectTest.assertDebugIdContents("myDialogBox-caption", "test caption");
                finishTest();
              }
            });
  }