本文整理汇总了Java中com.google.gwt.maps.client.MapWidget.addClickHandler方法的典型用法代码示例。如果您正苦于以下问题:Java MapWidget.addClickHandler方法的具体用法?Java MapWidget.addClickHandler怎么用?Java MapWidget.addClickHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.maps.client.MapWidget
的用法示例。
在下文中一共展示了MapWidget.addClickHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadMap
import com.google.gwt.maps.client.MapWidget; //导入方法依赖的package包/类
/**
* Once the API has been loaded, the MapWidget can be initialized. This
* method will initialize the MapWidget and place it inside the wrapper from
* the composite root.
*/
private void loadMap() {
mapOpt = MapOptions.newInstance();
map = new MapWidget(mapOpt);
wrapperPanel.add(map);
map.addDragEndHandler(dragEndMapHandler);
map.addClickHandler(clickMapHanler);
map.addIdleHandler(idleMapHandler);
// This method call of the Paintable interface sets the component
// style name in DOM tree
setStyleName(CLASSNAME);
// Update all the uidl requests that have been made
if (stack != null) {
for(UIDL uidl : stack) {
updateFromUIDL(uidl, client);
}
}
stack = null;
}
示例2: buildUi
import com.google.gwt.maps.client.MapWidget; //导入方法依赖的package包/类
/**
* Initialize the UI
*/
private void buildUi() {
// Create textboxes and set default hostname and port
_hostname = new TextBox();
_hostname.setText(DEFAULT_HOST);
_hostname.getElement().setPropertyString("placeholder", "hostname");
_port = new TextBox();
_port.setText(String.valueOf(DEFAULT_PORT));
_port.getElement().setPropertyString("placeholder", "port");
// Create button to connect
_button = new Button("Connect");
// Create the info/status label, initially not visible
_info = new InlineLabel();
_info.setVisible(false);
// register the button action
_button.addClickHandler(new ClickHandler() {
public void onClick(final ClickEvent event) {
final String hostname = _hostname.getText();
final int port = Integer.valueOf(_port.getText());
new PortAsyncCallback(hostname, port).execute();
}
});
// Create panel for textbox, button and info label
final FlowPanel div = new FlowPanel();
div.setStylePrimaryName("emulator-controls");
_hostname.setStyleName("emulator-hostname");
_port.setStyleName("emulator-port");
_button.setStyleName("emulator-connect");
_info.setStyleName("emulator-info");
div.add(_hostname);
div.add(_port);
div.add(_button);
div.add(_info);
// Create a map centered on Cawker City, KS USA
final MapOptions opts = MapOptions.newInstance();
final LatLng cawkerCity = LatLng.newInstance(39.509, -98.434);
opts.setCenter(cawkerCity);
opts.setZoom(4);
_map = new MapWidget(opts);
// Register map click handler
_map.addClickHandler(this);
// add the controls before the map so that the div doesn't cover the map
RootLayoutPanel.get().add(div);
RootLayoutPanel.get().add(_map);
}