コード例 #1
0
 private TextArea createClipboardTextArea() {
   final TextArea pasteArea = new TextArea();
   pasteArea.setPixelSize(0, 0);
   Style style = pasteArea.getElement().getStyle();
   style.setPosition(Style.Position.FIXED);
   RootPanel.get().add(pasteArea);
   pasteArea.setFocus(true);
   return pasteArea;
 }
コード例 #2
0
ファイル: VWindow.java プロジェクト: JamesLefeu/vaadin
  private void fixIE8FocusCaptureIssue() {
    Element e = DOM.createInputText();
    Style elemStyle = e.getStyle();
    elemStyle.setPosition(Position.ABSOLUTE);
    elemStyle.setTop(-10, Unit.PX);
    elemStyle.setWidth(0, Unit.PX);
    elemStyle.setHeight(0, Unit.PX);

    contentPanel.getElement().appendChild(e);
    e.focus();
    contentPanel.getElement().removeChild(e);
  }
コード例 #3
0
ファイル: VCustomLayout.java プロジェクト: chinjh/vaadin
  public VCustomLayout() {
    setElement(DOM.createDiv());
    // Clear any unwanted styling
    Style style = getElement().getStyle();
    style.setBorderStyle(BorderStyle.NONE);
    style.setMargin(0, Unit.PX);
    style.setPadding(0, Unit.PX);

    if (BrowserInfo.get().isIE()) {
      style.setPosition(Position.RELATIVE);
    }

    setStyleName(CLASSNAME);
  }
コード例 #4
0
  /**
   * Sets the title to display with this menu button.
   *
   * @param label
   */
  public void setLabel(String label) {

    this.label = label;

    HTMLPanel labelHtml = new HTMLPanel(label);
    Style labelStyle = labelHtml.getElement().getStyle();
    labelStyle.setColor("white");
    labelStyle.setFontSize(0.8, Unit.EM);
    labelStyle.setFontWeight(FontWeight.BOLD);
    labelStyle.setPosition(Position.ABSOLUTE);
    labelStyle.setTextAlign(TextAlign.CENTER);
    labelStyle.setTop(75, Unit.PCT);
    labelStyle.setWidth(100, Unit.PCT);

    panel.add(labelHtml);
  }
コード例 #5
0
  /**
   * 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);
  }
コード例 #6
0
ファイル: ModalDialogBase.java プロジェクト: vwendy/rstudio
  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_;
    };
  }
コード例 #7
0
ファイル: UIConnector.java プロジェクト: bharathvu/vaadin
 protected void onChildSizeChange() {
   ComponentConnector child = getContent();
   if (child == null) {
     return;
   }
   Style childStyle = child.getWidget().getElement().getStyle();
   /*
    * Must set absolute position if the child has relative height and
    * there's a chance of horizontal scrolling as some browsers will
    * otherwise not take the scrollbar into account when calculating the
    * height. Assuming v-ui does not have an undefined width for now, see
    * #8460.
    */
   if (child.isRelativeHeight() && !BrowserInfo.get().isIE9()) {
     childStyle.setPosition(Position.ABSOLUTE);
   } else {
     childStyle.clearPosition();
   }
 }
コード例 #8
0
  /**
   * 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);
  }
コード例 #9
0
ファイル: DebugLog.java プロジェクト: alkacon/geranium
  /**
   * 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);
  }
コード例 #10
0
  public DateCellDayEvent(DateCell dateCell, WeekGrid parent, CalendarEvent event) {
    super();
    this.dateCell = dateCell;

    handlers = new LinkedList<HandlerRegistration>();

    setStylePrimaryName("v-calendar-event");
    setCalendarEvent(event);

    weekGrid = parent;

    Style s = getElement().getStyle();
    if (event.getStyleName().length() > 0) {
      addStyleDependentName(event.getStyleName());
    }
    s.setPosition(Position.ABSOLUTE);

    caption = DOM.createDiv();
    caption.addClassName("v-calendar-event-caption");
    getElement().appendChild(caption);

    eventContent = DOM.createDiv();
    eventContent.addClassName("v-calendar-event-content");
    getElement().appendChild(eventContent);

    VCalendar calendar = weekGrid.getCalendar();
    if (weekGrid.getCalendar().isEventResizeAllowed()) {
      topResizeBar = DOM.createDiv();
      bottomResizeBar = DOM.createDiv();

      topResizeBar.addClassName("v-calendar-event-resizetop");
      bottomResizeBar.addClassName("v-calendar-event-resizebottom");

      getElement().appendChild(topResizeBar);
      getElement().appendChild(bottomResizeBar);
    }

    eventIndex = event.getIndex();
  }
コード例 #11
0
  private DivElement addPanel(String styleName, int halign, int valign) {
    DivElement div = Document.get().createDivElement();
    div.setClassName(styleName);

    Style style = div.getStyle();
    style.setPosition(Style.Position.ABSOLUTE);

    switch (halign) {
      case LEFT:
        style.setPropertyPx("left", 0);
        style.setPropertyPx("width", 10);
        break;
      case CENTER:
        style.setPropertyPx("left", 10);
        style.setPropertyPx("right", 10);
        break;
      case RIGHT:
        style.setPropertyPx("right", 0);
        style.setPropertyPx("width", 10);
        break;
    }
    switch (valign) {
      case TOP:
        style.setPropertyPx("top", 0);
        style.setPropertyPx("height", 26);
        break;
      case MIDDLE:
        style.setPropertyPx("top", 26);
        style.setPropertyPx("bottom", 26);
        break;
      case BOTTOM:
        style.setPropertyPx("bottom", 0);
        style.setPropertyPx("height", 26);
    }

    layout_.getElement().appendChild(div);
    return div;
  }
コード例 #12
0
  public DatePickerDOMElement(
      final DatePicker widget, final GridLayer gridLayer, final GridWidget gridWidget) {
    super(widget, gridLayer, gridWidget);
    final Style style = widget.getElement().getStyle();
    style.setWidth(100, Style.Unit.PCT);
    style.setHeight(HEIGHT, Style.Unit.PX);
    style.setPaddingLeft(2, Style.Unit.PX);
    style.setPaddingRight(2, Style.Unit.PX);
    style.setFontSize(10, Style.Unit.PX);

    // --- Workaround for BS2 ---
    style.setPosition(Style.Position.RELATIVE);
    style.setPaddingTop(0, Style.Unit.PX);
    style.setPaddingBottom(0, Style.Unit.PX);
    style.setProperty("WebkitBoxSizing", "border-box");
    style.setProperty("MozBoxSizing", "border-box");
    style.setProperty("boxSizing", "border-box");
    style.setProperty("lineHeight", "normal");
    // --- End workaround ---

    getContainer().getElement().getStyle().setPaddingLeft(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5, Style.Unit.PX);
    getContainer().setWidget(widget);
  }