Beispiel #1
0
  /**
   * The widget's constructor.
   *
   * @param newImages the image bundle passed on by the parent object
   */
  public SettingsMenu(final Images newImages) {
    // The popup's constructor's argument is a boolean specifying that it
    // auto-close itself when the user clicks outside of it.
    super(true);
    setAnimationEnabled(true);
    images = newImages;

    Command userCredentialsCommand =
        new Command() {
          @Override
          public void execute() {
            CredentialsDialog dlg = new CredentialsDialog(newImages);
            dlg.center();
          }
        };
    contextMenu = new MenuBar(true);
    //		contextMenu.addItem("<span>" + newImages.preferences().getHTML() +
    // "&nbsp;Preferences</span>", true, cmd);
    MenuItem showCredentialsItem =
        new MenuItem(
            "<span>"
                + AbstractImagePrototype.create(newImages.credentials()).getHTML()
                + "&nbsp;Show Credentials</span>",
            true,
            userCredentialsCommand);
    showCredentialsItem.getElement().setId("topMenu.settingsMenu.showCredentials");
    contextMenu.addItem(showCredentialsItem);

    add(contextMenu);
    // setStyleName("toolbarPopup");
  }