Package com.google.gwt.user.client

Examples of com.google.gwt.user.client.Element


   * @param style
   *            A styling object to be passed along with the image. Can be null.
   */
  public void drawImage(Object parent, String name, String href, Bbox bounds, PictureStyle style) {
    if (isAttached()) {
      Element image = helper.createOrUpdateElement(parent, name, "image", style);
      applyAbsolutePosition(image, bounds.getOrigin());
      applyElementSize(image, (int) bounds.getWidth(), (int) bounds.getHeight(), true);
      DOM.setElementAttribute(image, "src", href);
    }
  }
View Full Code Here


   *            The styling object for the LineString. Watch out for fill colors! If the fill opacity is not 0, then
   *            the LineString will have a fill surface.
   */
  public void drawLine(Object parent, String name, LineString line, ShapeStyle style) {
    if (isAttached()) {
      Element element = helper.createOrUpdateElement(parent, name, "shape", style);
      if (line != null) {
        DOM.setElementAttribute(element, "path", VmlPathDecoder.decode(line));
        DOM.setStyleAttribute(element, "position", "absolute");
        applyElementSize(element, width, height, false);
      }
View Full Code Here

   * @param style
   *            The styling object for the Polygon.
   */
  public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) {
    if (isAttached()) {
      Element element = helper.createOrUpdateElement(parent, name, "shape", style);
      if (polygon != null) {
        DOM.setStyleAttribute(element, "position", "absolute");
        DOM.setElementAttribute(element, "fill-rule", "evenodd");
        DOM.setElementAttribute(element, "path", VmlPathDecoder.decode(polygon));
        applyElementSize(element, getWidth(), getHeight(), false);
View Full Code Here

   * @param style
   *            The styling object for the rectangle.
   */
  public void drawRectangle(Object parent, String name, Bbox rectangle, ShapeStyle style) {
    if (isAttached()) {
      Element element = helper.createOrUpdateElement(parent, name, "rect", style);
      applyAbsolutePosition(element, rectangle.getOrigin());
      applyElementSize(element, (int) rectangle.getWidth(), (int) rectangle.getHeight(), false);
    }
  }
View Full Code Here

      if (style == null) {
        style = definition.getStyle();
      }
      SymbolInfo symbol = definition.getSymbol();
      if (symbol.getRect() != null) {
        Element rect = helper.createOrUpdateElement(parent, name, "rect", style);

        // Real position is the upper left corner of the rectangle:
        float w = symbol.getRect().getW();
        float h = symbol.getRect().getH();
        applyAbsolutePosition(rect, new Coordinate(position.getX() - 0.5 * w, position.getY() - 0.5 * h));

        // width and height
        applyElementSize(rect, (int) w, (int) h, false);

      } else if (symbol.getCircle() != null) {
        Element circle = helper.createOrUpdateElement(parent, name, "oval", style);

        // Real position is the upper left corner of the circle:
        float radius = symbol.getCircle().getR();
        applyAbsolutePosition(circle, new Coordinate(position.getX() - radius, position.getY() - radius));

        // width and height are both radius*2
        int size = (int) (2 * radius);
        applyElementSize(circle, size, size, false);
      } else if (symbol.getImage() != null) {
        // Creating an image; ignoring style....
        Element image = helper.createOrUpdateElement(parent, name, "image", null);
        DOM.setElementAttribute(image, "src", symbol.getImage().getHref());
        int width = symbol.getImage().getWidth();
        int height = symbol.getImage().getHeight();
        applyElementSize(image, width, height, false);
        applyAbsolutePosition(image, new Coordinate(position.getX() - Math.round(width / 2), position.getY()
View Full Code Here

   * @param style
   *            The styling object for the text.
   */
  public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) {
    if (isAttached()) {
      Element element = helper.createOrUpdateElement(parent, name, "textbox", style);
      if (element != null) {
        // Set position, style and content:
        applyAbsolutePosition(element, position);
        VmlStyleUtil.applyStyle(element, style);

        // Set width, because this may change otherwise...
        int textWidth = width - (int) position.getX();
        if (textWidth <= 0) {
          textWidth = 10;
        }
        DOM.setStyleAttribute(element, "width", textWidth + "px");
        element.setInnerText(text);
      }
    }
  }
View Full Code Here

   * @param group
   *            The group object.
   */
  public void hide(Object group) {
    if (isAttached()) {
      Element element = helper.getGroup(group);
      if (element != null) {
        DOM.setStyleAttribute(element, "visibility", "hidden");
      }
    }
  }
View Full Code Here

   * @param group
   *            The group object.
   */
  public void unhide(Object group) {
    if (isAttached()) {
      Element element = helper.getGroup(group);
      if (element != null) {
        DOM.setStyleAttribute(element, "visibility", "inherit");
      }
    }
  }
View Full Code Here

   *            The parent element, onto whom to attach the initial DOM structure.
   */
  public DefaultImageContext(Widget parent) {
    this.parent = parent;
    // root node
    Element rootNode = DOM.createElementNS(DOM.NS_HTML, "div");
    id = DOM.createUniqueId();
    rootNode.setId(id);
    DOM.setStyleAttribute(rootNode, "position", "absolute");
    DOM.setStyleAttribute(rootNode, "width", "100%");
    DOM.setStyleAttribute(rootNode, "height", "100%");
    // prevents overflowing of images in IE
    DOM.setStyleAttribute(rootNode, "overflow", "hidden");
View Full Code Here

    }
  }

  public void drawData(Object parent, Object object, String data, Matrix transformation) {
    if (isAttached()) {
      Element group = helper.getGroup(object);
      if (group == null) {
        group = helper.createOrUpdateGroup(parent, object, transformation, null);
        DOM.setInnerHTML(group, data);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.Element

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.