/**
   * Sets the image to use in this menu button.
   *
   * @param image
   */
  public void setImage(ImageResource image) {

    this.image = image;

    Image imageHtml = new Image(image.getSafeUri());
    Style imageStyle = imageHtml.getElement().getStyle();
    imageStyle.setDisplay(Display.BLOCK);
    imageStyle.setProperty("margin", "1.25em auto 0");
    imageStyle.setProperty("maxWidth", "60%");
    imageStyle.setPosition(Position.ABSOLUTE);
    imageStyle.setTop(0, Unit.PX);
    imageStyle.setRight(0, Unit.PX);
    imageStyle.setBottom(0, Unit.PX);
    imageStyle.setLeft(0, Unit.PX);

    panel.add(imageHtml);
  }
Exemple #2
0
  protected ProgressIndicator addProgressIndicator() {
    final SlideLabel label = new SlideLabel(true);
    Element labelEl = label.getElement();
    Style labelStyle = labelEl.getStyle();
    labelStyle.setPosition(Style.Position.ABSOLUTE);
    labelStyle.setLeft(0, Style.Unit.PX);
    labelStyle.setRight(0, Style.Unit.PX);
    labelStyle.setTop(-12, Style.Unit.PX);
    getWidget().getElement().getParentElement().appendChild(labelEl);

    return new ProgressIndicator() {
      public void onProgress(String message) {
        if (message == null) {
          label.setText("", true);
          if (showing_) endProgress();
        } else {
          label.setText(message, false);
          if (!showing_) {
            enableControls(false);
            label.show();
            showing_ = true;
          }
        }
      }

      public void onCompleted() {
        endProgress();
        closeDialog();
      }

      public void onError(String message) {
        endProgress();
        RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", message);
      }

      private void endProgress() {
        if (showing_) {
          enableControls(true);
          label.hide();
          showing_ = false;
        }
      }

      private boolean showing_;
    };
  }
  /**
   * Internal method which opens the gallery dialog.
   *
   * <p>
   */
  protected void openGalleryDialog() {

    String title =
        org.opencms.gwt.client.Messages.get()
            .key(org.opencms.gwt.client.Messages.GUI_GALLERY_SELECT_DIALOG_TITLE_0);
    final CmsFramePopup popup = new CmsFramePopup(title, buildGalleryUrl());
    popup.setCloseHandler(
        new Runnable() {

          public void run() {

            m_textbox.setGhostMode(false);
          }
        });
    popup.setId(m_id);
    popup.getFrame().setSize("700px", "490px");
    popup.center();

    CmsPushButton button = new CmsPushButton(I_CmsImageBundle.INSTANCE.style().closeIcon());

    Style style = button.getElement().getStyle();
    style.setRight(4, Unit.PX);
    style.setTop(0, Unit.PX);
    style.setPosition(Position.ABSOLUTE);
    style.setCursor(Cursor.POINTER);
    button.addClickHandler(
        new ClickHandler() {

          /**
           * @see
           *     com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
           */
          public void onClick(ClickEvent event) {

            popup.hide();
          }
        });

    popup.insertFront(button);
  }
Exemple #4
0
  /**
   * Constructor.
   *
   * <p>
   */
  @SuppressWarnings("unused")
  private DebugLog() {

    if (!DEBUG) {
      return;
    }
    m_html = new HTML();
    initWidget(m_html);
    Style style = getElement().getStyle();
    style.setWidth(200, Unit.PX);
    style.setHeight(500, Unit.PX);
    style.setPadding(10, Unit.PX);
    style.setOverflow(Overflow.AUTO);
    style.setBorderStyle(BorderStyle.SOLID);
    style.setBorderColor(I_LayoutBundle.INSTANCE.constants().css().borderColor());
    style.setBorderWidth(1, Unit.PX);
    style.setPosition(Position.FIXED);
    style.setTop(50, Unit.PX);
    style.setRight(50, Unit.PX);
    style.setBackgroundColor(I_LayoutBundle.INSTANCE.constants().css().backgroundColorDialog());
    style.setZIndex(10);
  }