Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.Style


      Utils.setTranslateY(w.getElement(), 0); //anti-flickering on iOS.
    }
  }
 
  private int getStyleTop() {
    Style style = getWidget().getElement().getStyle();
    String top = style.getTop();
    if (top.isEmpty()) {
      return 0;
    }
    else {
      return Integer.parseInt(top.replace("px", ""));
View Full Code Here


      return Integer.parseInt(top.replace("px", ""));
    }
  }

  private void setStyleTop(int top) {
    Style style = getWidget().getElement().getStyle();
    style.setTop(top, Unit.PX);
  }
View Full Code Here

    FocusImpl.getFocusImplForPanel().focus(menu.getElement());
  }

  @Override
  public void setPopupPositionAndMakeVisible(Element reference, final Element popup) {
    Style popupStyle = popup.getStyle();

    // TODO(danilatos): Do something more intelligent than arbitrary constants (which might be
    // susceptible to font size changes, etc)
    popupStyle.setLeft(popupAnchor.getAbsoluteLeft() - popup.getOffsetWidth() + 26, Unit.PX);
    popupStyle.setTop(popupAnchor.getAbsoluteBottom() + 5, Unit.PX);

    popupStyle.setVisibility(Visibility.VISIBLE);
  }
View Full Code Here

   * {@inheritDoc}
   */
  public void setPopupPositionAndMakeVisible(final Element relative, final Element p) {
    ScheduleCommand.addCommand(new Scheduler.Task() {
      public void execute() {
        Style s = p.getStyle();
        int horizontalCenter = RootPanel.get().getOffsetWidth() / 2;
        int verticalCenter = RootPanel.get().getOffsetHeight() / 2;
        int left = relative.getAbsoluteLeft();
        int right = relative.getAbsoluteRight();
        int top = relative.getAbsoluteTop();
        int bottom = relative.getAbsoluteBottom();
        if (inHorizontalList) {
          // Place popup above or below relative
          if (right > horizontalCenter) {
            // Place popup left of relative's right
            s.setRight(RootPanel.get().getOffsetWidth() - right + PIXEL_OFFSET, Unit.PX);
            if (top < verticalCenter) {
              // Place popup below bottom of relative
              s.setTop(bottom, Unit.PX);
            } else {
              // Place popup above top of relative
              s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX);
            }
          } else {
            // Place popup right of relative's left
            s.setLeft(left + PIXEL_OFFSET, Unit.PX);
            if (top < verticalCenter) {
              // Place popup below bottom of relative
              s.setTop(bottom, Unit.PX);
            } else {
              // Place popup above top of relative
              s.setBottom(RootPanel.get().getOffsetHeight() - top, Unit.PX);
            }
          }
        } else {
          // Place popup on left or right side of relative
          if (right > horizontalCenter) {
            // Place popup left of relative's left
            s.setRight(RootPanel.get().getOffsetWidth() - left, Unit.PX);
            if (top < verticalCenter) {
              // Place popup below top of relative
              s.setTop(top + PIXEL_OFFSET, Unit.PX);
            } else {
              // Place popup above bottom of relative
              s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX);
            }
          } else {
            // Place popup right of relative's right
            s.setLeft(right, Unit.PX);
            if (top < verticalCenter) {
              // Place popup below top of relative
              s.setTop(top + PIXEL_OFFSET, Unit.PX);
            } else {
              // Place popup above bottom of relative
              s.setBottom(RootPanel.get().getOffsetHeight() - bottom + PIXEL_OFFSET, Unit.PX);
            }
          }
        }
        p.getStyle().setVisibility(Visibility.VISIBLE);
      }
View Full Code Here

  private void setImageSize() {
    int width = isFullSize?attachmentWidth:thumbnailWidth;
    int height = isFullSize?attachmentHeight:thumbnailHeight;
    image.setPixelSize(width, height);
    //TODO(user,danilatos): Whinge about how declarative UI doesn't let us avoid this hack:
    Style pstyle = image.getElement().getParentElement().getParentElement().getStyle();
    if (width == 0) {
      image.setWidth("");
      pstyle.clearWidth();
    } else {
      pstyle.setWidth(width, Unit.PX);
    }
    if (height == 0) {
      image.setHeight("");
      pstyle.clearHeight();
    } else {
      pstyle.setHeight(height, Unit.PX);
    }

    String url = isFullSize?attachmentUrl:thumbnailUrl;
    if (url != null) {
      if (doubleBufferLoader == null) {
View Full Code Here

    //// Update actual values ////

    // NOTE(danilatos): For these, it might be more efficient to check that the
    // value has changed before changing it. This is not currently  known.

    Style style = implNodelet.getStyle();

    if (fontSize != -1) {
      style.setFontSize(fontSize, Unit.EM);
    } else {
      style.clearFontSize();
    }

    if (fontWeight != null) {
      style.setFontWeight(fontWeight);
    } else {
      style.clearFontWeight();
    }

    if (alignment != null) {
      style.setProperty("textAlign", alignment.cssValue());
    } else {
      style.clearProperty("textAlign");
    }

    if (direction != null) {
      style.setProperty("direction", direction.cssValue());
    } else {
      style.clearProperty("direction");
    }

    if (margin == 0) {
      style.clearMarginLeft();
      style.clearMarginRight();
    } else {
      if (direction == Direction.RTL) {
        style.setMarginRight(margin, Unit.PX);
        style.clearMarginLeft();
      } else {
        style.setMarginLeft(margin, Unit.PX);
        style.clearMarginRight();
      }
    }
  }
View Full Code Here

      int hw = splitterWidth;

      getElement().setY(XElement.as(container.getElement()).getY());
      getElement().setHeight(container.getOffsetHeight());

      Style ss = getElement().getStyle();

      if (x - r.getLeft() <= hw && before != -1 && cm.isResizable(before) && !cm.isFixed(before)) {
        bar.getElement().setVisibility(true);
        getElement().setX(r.getLeft() - (hw / 2));
        ss.setProperty("cursor", GXT.isSafari() ? "e-resize" : "col-resize");
      } else if (r.getRight() - x <= hw && cm.isResizable(activeHdIndex) && !cm.isFixed(activeHdIndex)) {
        bar.getElement().setVisibility(true);
        getElement().setX(r.getRight() - (hw / 2));
        ss.setProperty("cursor", GXT.isSafari() ? "w-resize" : "col-resize");
      } else {
        bar.getElement().setVisibility(false);
        ss.setProperty("cursor", "");
      }
    }
View Full Code Here

    setStyleName(blockingDivStyleName);
  }
 
  private static void expandElementToScreen(Widget widget)
  {
    Style style = widget.getElement().getStyle();
    style.setProperty("position", "absolute");
    style.setPropertyPx("top", 0);
    style.setPropertyPx("left", 0);
    style.setProperty("width", "100%");
    style.setProperty("height", "100%");
  }
View Full Code Here

  }

  protected static DivElement createRuler(Unit widthUnit, Unit heightUnit) {
    DivElement ruler = Document.get().createDivElement();
    ruler.setInnerHTML("&nbsp;");
    Style style = ruler.getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(-32767);
    style.setLeft(-10000, PX);

    // Note that we are making the ruler element 10x10, because some browsers
    // generate non-integral ratios (e.g., 1em == 13.3px), so we need a little
    // extra precision.
    style.setWidth(10, widthUnit);
    style.setHeight(10, heightUnit);
    return ruler;
  }
View Full Code Here

    parent.insertBefore(container, beforeContainer);
    return container;
  }

  public void fillParent(Element elem) {
    Style style = elem.getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setLeft(0, PX);
    style.setTop(0, PX);
    style.setRight(0, PX);
    style.setBottom(0, PX);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.Style

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.