com.emitrom.touch4j.client.ui.GoogleMap Maven / Gradle / Ivy
The newest version!
/************************************************************************
GoogleMap.java is part of Touch4j 4.2.2.1 Copyright 2013 Emitrom LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**************************************************************************/
package com.emitrom.touch4j.client.ui;
import com.emitrom.touch4j.client.core.Component;
import com.emitrom.touch4j.client.core.config.XType;
import com.emitrom.touch4j.client.core.handlers.CallbackRegistration;
import com.emitrom.touch4j.client.core.handlers.map.MapCenterChangeHandler;
import com.emitrom.touch4j.client.core.handlers.map.MapTypeChangeHandler;
import com.emitrom.touch4j.client.core.handlers.map.MapZoomChangeHandler;
import com.google.gwt.core.client.JavaScriptObject;
/**
* Wraps a Google Map in a Component
* http://code.google.com/apis/maps/documentation/v3/introduction.html
* To use this component you must include an additional JavaScript file from
* Google:
* {@code
*
* }
*
* @see Ext.Map
*/
public class GoogleMap extends Component implements MapElement {
private static final String CENTER_CHANGE = "centerchange";
private static final String MAP_RENDER = "maprender";
private static final String TYPE_CHANGE = "typechange";
private static final String ZOOM_CHANGE = "zoomchange";
private GoogleMap(JavaScriptObject config) {
super(config);
}
@Override
protected native void init()/*-{
var c = new $wnd.Ext.Map();
[email protected]::configPrototype = c.initialConfig;
}-*/;
@Override
protected native JavaScriptObject create(JavaScriptObject config) /*-{
return new $wnd.Ext.Map(config);
}-*/;
public String getXType() {
return XType.MAP.getValue();
}
/**
* Constructor.
*/
public GoogleMap() {
}
/**
* Constructor.
*
* @param useCurrentLocation
*/
public GoogleMap(boolean useCurrentLocation) {
setUseCurrentLocation(useCurrentLocation);
}
/**
* Returns the value of baseCls.
*
* @return String
*/
@Override
public native String getBaseCls() /*-{
var map = [email protected]::getOrCreateJsObj()();
return map.getBaseCls();
}-*/;
/**
* Returns the value of map.
*
* @return Map
*/
public native JavaScriptObject getMap() /*-{
var map = [email protected]::getOrCreateJsObj()();
return map.getMap();
}-*/;
/**
* Returns the value of mapOptions.
*
* @return T
*/
public native T getMapOptions() /*-{
var map = [email protected]::getOrCreateJsObj()();
return map.getMapOptions();
}-*/;
/*
* (non-Javadoc)
*
* @see com.emitrom.touch4j.client.widgets.MapElement#isUseCurrentLocation()
*/
@Override
public native boolean isUseCurrentLocation() /*-{
var map = [email protected]::getOrCreateJsObj()();
return map.getUseCurrentLocation();
}-*/;
/**
* Sets the value of baseCls.
*
* @param value
*/
@Override
public native void setBaseCls(String value) /*-{
var map = [email protected]::getOrCreateJsObj()();
map.setBaseCls(value);
}-*/;
/**
* Sets the value of mapOptions.
*
* @param value
*/
public native void setMapOptions(Object value) /*-{
var map = [email protected]::getOrCreateJsObj()();
map.setMapOptions(value);
}-*/;
/**
* Sets the value of useCurrentLocation
*/
@Override
public native void setUseCurrentLocation(boolean value) /*-{
var map = [email protected]::getOrCreateJsObj()();
map.setUseCurrentLocation(value);
}-*/;
/*
* (non-Javadoc)
*
* @see com.emitrom.touch4j.client.widgets.MapElement#addCenterChangeHandler
* (com.emitrom.touch4j.client.core.handlers.map.MapCenterChangeHandler)
*/
@Override
public CallbackRegistration addCenterChangeHandler(MapCenterChangeHandler handler) {
return addWidgetListener(CENTER_CHANGE, handler.getJsoPeer());
}
/*
* (non-Javadoc)
*
* @see com.emitrom.touch4j.client.ui.MapElement#addTypeChangeHandler
* (com.emitrom.touch4j.client.core.handlers.map.MapTypeChangeHandler)
*/
@Override
public CallbackRegistration addTypeChangeHandler(MapTypeChangeHandler handler) {
return addWidgetListener(TYPE_CHANGE, handler.getJsoPeer());
}
/*
* (non-Javadoc)
*
* @see com.emitrom.touch4j.client.widgets.MapElement#addZoomChangeHandler
* (com.emitrom.touch4j.client.core.handlers.map.MapZoomChangeHandler)
*/
@Override
public CallbackRegistration addZoomChangeHandler(MapZoomChangeHandler handler) {
return addWidgetListener(ZOOM_CHANGE, handler.getJsoPeer());
}
@Override
public String getText() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setText(String text) {
// TODO Auto-generated method stub
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy