001 package com.google.gwt.maps.client.overlays; 002 003 import com.google.gwt.core.client.JavaScriptObject; 004 import com.google.gwt.dom.client.Element; 005 import com.google.gwt.maps.client.base.LatLng; 006 import com.google.gwt.maps.client.base.Size; 007 import com.google.gwt.user.client.ui.Widget; 008 009 /** 010 * InfoWindow Options 011 * <br><br> 012 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#InfoWindowOptions">InfoWindowOptions API Doc</a> 013 */ 014 public class InfoWindowOptions extends JavaScriptObject { 015 016 /** 017 * use newInstance(); 018 */ 019 protected InfoWindowOptions() {} 020 021 /** 022 * InfoWindow Options 023 */ 024 public static final InfoWindowOptions newInstance() { 025 return JavaScriptObject.createObject().cast(); 026 } 027 028 /** 029 * set widget to display in infoWindow 030 * @param widget 031 */ 032 public final void setContent(Widget widget) { 033 setContent(widget.getElement()); 034 } 035 036 /** 037 * set Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size. 038 * @param content 039 */ 040 public final native void setContent(String content) /*-{ 041 this.content = content; 042 }-*/; 043 044 /** 045 * get Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size. 046 */ 047 public final native String getContent_String() /*-{ 048 return this.content; 049 }-*/; 050 051 /** 052 * set Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size. 053 * @param content 054 */ 055 public final native void setContent(Element content) /*-{ 056 this.content = content; 057 }-*/; 058 059 /** 060 * get Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size. 061 */ 062 public final native Element getContent_Element() /*-{ 063 return this.content; 064 }-*/; 065 066 /** 067 * sets Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens. 068 * @param disableAutoPan 069 */ 070 public final native void setDisableAutoPan(boolean disableAutoPan) /*-{ 071 this.disableAutoPan = disableAutoPan; 072 }-*/; 073 074 /** 075 * gets Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens. 076 */ 077 public final native boolean getDisableAutoPan() /*-{ 078 return this.disableAutoPan; 079 }-*/; 080 081 /** 082 * sets Maximum width of the infowindow, regardless of content's width. This value is only considered if it is set before a call to open. To change the maximum width when changing content, call close, setOptions, and then open. 083 * @param width 084 */ 085 public final native void setMaxWidth(int width) /*-{ 086 this.width = width; 087 }-*/; 088 089 /** 090 * gets Maximum width of the infowindow, regardless of content's width. This value is only considered if it is set before a call to open. To change the maximum width when changing content, call close, setOptions, and then open. 091 */ 092 public final native int getMaxWidth() /*-{ 093 return this.width; 094 }-*/; 095 096 /** 097 * sets The offset, in pixels, of the tip of the info window from the point on the map at whose geographical coordinates the info window is anchored. If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the top-center of the anchor's bounds. 098 * @param size 099 */ 100 public final native void setPixelOffet(Size size) /*-{ 101 this.size = size; 102 }-*/; 103 104 /** 105 * gets The offset, in pixels, of the tip of the info window from the point on the map at whose geographical coordinates the info window is anchored. If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the top-center of the anchor's bounds. 106 */ 107 public final native Size getPixelOffset() /*-{ 108 return this.size; 109 }-*/; 110 111 /** 112 * sets The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead. 113 * @param position 114 */ 115 public final native void setPosition(LatLng position) /*-{ 116 this.position = position; 117 }-*/; 118 119 /** 120 * gets The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead. 121 */ 122 public final native LatLng getPosition() /*-{ 123 return this.position; 124 }-*/; 125 126 /** 127 * sets All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWinodws are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers. 128 * @param zIndex 129 */ 130 public final native void setZindex(int zIndex) /*-{ 131 this.zIndex = zIndex; 132 }-*/; 133 134 /** 135 * gets All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWinodws are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers. 136 */ 137 public final native int getZindex() /*-{ 138 return this.zIndex; 139 }-*/; 140 141 }