public AddToBookmarks(View view) {
   this.view = view;
   setEnabled(view.getOpenId() != null && view.getOpenId().isLoggedIn());
   setWidth(ICON_WIDTH);
   setHeight(ICON_HEIGHT);
   setShowDown(false);
   setShowRollOver(false);
   setHandlers();
 }
  /**
   * Get content for bookmark popup
   *
   * @return
   */
  private HLayout getPopupContent() {
    HLayout hlayout = new HLayout();
    hlayout.setWidth100();
    hlayout.setHeight100();
    DynamicForm form = new DynamicForm();
    form.setHeight100();
    form.setWidth(260);
    form.setTitleWidth(100);
    bookmarkTitle = new TextItem();
    bookmarkTitle.setTitle("Title");
    if (!view.getSettings().inSingleEndpointMode()) {
      includeEndpoint = new CheckboxItem();
      includeEndpoint.setTitle("Include endpoint");
      includeEndpoint.setLabelAsTitle(true);
      form.setItems(bookmarkTitle, includeEndpoint);
    } else {
      form.setItems(bookmarkTitle);
    }

    Button bookmarkButton = new Button("Bookmark");
    bookmarkButton.setHeight100();
    bookmarkButton.setWidth(60);
    bookmarkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Bookmark bookmark = new Bookmark();
            if (includeEndpoint != null && includeEndpoint.getValueAsBoolean()) {
              bookmark.setEndpoint(view.getSelectedTabSettings().getEndpoint());
            }
            bookmark.setQuery(view.getSelectedTabSettings().getQueryString());
            bookmark.setTitle(bookmarkTitle.getValueAsString());

            window.clear();
            setSrc(Imgs.get(Imgs.LOADING));
            view.getRemoteService()
                .addBookmark(
                    bookmark,
                    new AsyncCallback<Void>() {
                      public void onFailure(Throwable caught) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                        if (caught instanceof OpenIdException) {
                          view.getElements().onError(caught.getMessage() + ". Logging out");
                          view.getOpenId().logOut();
                        } else {
                          view.getElements().onError(caught);
                        }
                      }

                      @Override
                      public void onSuccess(Void result) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                      }
                    });
          }
        });
    hlayout.addMembers(form, Helper.getHSpacer(), bookmarkButton);
    return hlayout;
  }