001 package com.google.gwt.maps.client.controls; 002 003 import com.google.gwt.core.client.JavaScriptObject; 004 005 /** 006 * Options for the rendering of the scale control. 007 * <br><br> 008 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#ScaleControlOptions">ScaleControlOptions API Doc</a> 009 */ 010 public class ScaleControlOptions extends JavaScriptObject { 011 012 /** 013 * Options for the rendering of the scale control. 014 */ 015 protected ScaleControlOptions() {} 016 017 /** 018 * Options for the rendering of the scale control. 019 * @return ScaleControlOptions 020 */ 021 public final static ScaleControlOptions newInstance() { 022 return JavaScriptObject.createObject().cast(); 023 } 024 025 /** 026 * Position id. Used to specify the position of the control on the map. The default position is TOP_LEFT. 027 */ 028 public final ControlPosition getPosition() { 029 return ControlPosition.fromValue(getPositionImpl()); 030 } 031 032 private final native int getPositionImpl() /*-{ 033 return this.position; 034 }-*/; 035 036 /** 037 * Position id. Used to specify the position of the control on the map. The default position is TOP_LEFT. 038 * @param position {@link ControlPosition} 039 */ 040 public final void setPosition(ControlPosition position) { 041 setPositionImpl(position.value()); 042 } 043 044 private final native void setPositionImpl(int position) /*-{ 045 this.position = position; 046 }-*/; 047 048 /** 049 * set Style id. Used to select what style of scale control to display. 050 * @param style {@link ScaleControlStyle} 051 */ 052 public final void setStyle(ScaleControlStyle style) { 053 setStyle(style.value()); 054 } 055 056 /** 057 * set Style id. Used to select what style of scale control to display. 058 * @param style 059 */ 060 private final native void setStyle(String style) /*-{ 061 this.style = style; 062 }-*/; 063 064 /** 065 * get Style id. Used to select what style of scale control to display. 066 * @return {@link ScaleControlStyle} 067 */ 068 public final ScaleControlStyle getStyle() { 069 return ScaleControlStyle.fromValue(getStyleJs()); 070 } 071 072 /** 073 * get Style id. Used to select what style of scale control to display. 074 * @return String 075 */ 076 private final native String getStyleJs() /*-{ 077 return this.style; 078 }-*/; 079 080 }