Thanks Eric. In the issue I linked, I also came out with similar code
working.
--
Mehdi

On Sat, Aug 30, 2008 at 3:09 PM, Eric B <[EMAIL PROTECTED]> wrote:

>
> I've gotten it to work.  Here's the Java class I've created to access
> the fields from within Java (using GWT).  Remember, you have to load
> the Maps API using the new Google AJAX API loader,
> http://code.google.com/apis/maps/documentation/#AJAX_Loader, to gain
> access to the ClientLocation object.
>
> /**
>  * A javascript overlay class for the google.loader.ClientLocation
> javascript
>  * object
>  *
>  * @author Eric B <[EMAIL PROTECTED]>
>  */
> public class ClientLocation extends JavaScriptObject {
>
>        /**
>         * Overlay types always have protected, zero argument constructors
>         */
>        protected ClientLocation() {}
>
>        /**
>         * Get the client's geographic location
>         *
>         * @return The client's geographic location
>         */
>        public static native ClientLocation getInstance() /*-{
>                return $wnd.google.loader.ClientLocation;
>        }-*/;
>
>        /**
>         * Supplies the low resolution latitude associated with the client's
> IP
>         * address
>         *
>         * @return
>         */
>        public final native double getLatitude() /*-{
>                if ( this.latitude ) {
>                        return this.latitude;
>                }
>                else {
>                        return 0;
>                }
>        }-*/;
>
>        /**
>         * Supplies the low resolution longitude associated with the
> client's
> IP
>         * address
>         *
>         * @return
>         */
>        public final native double getLongitude() /*-{
>                if ( this.longitude ) {
>                        return this.longitude;
>                }
>                else {
>                        return 0;
>                }
>        }-*/;
>
>        /**
>         * Supplies the name of the city associated with the client's IP
> address
>         *
>         * @return
>         */
>        public final native String getCity() /*-{
>                if ( this.city ) {
>                        return this.city;
>                }
>                else {
>                        return null;
>                }
>        }-*/;
>
>        /**
>         * Supplies the name of the country associated with the client's IP
> address
>         *
>         * @return
>         */
>        public final native String getCountryName() /*-{
>                if ( this.country ) {
>                        return this.country;
>                }
>                else {
>                        return null;
>                }
>        }-*/;
>
>        /**
>         * Supplies the name of the ISO 3166-1 country code associated with
> the
>         * client's IP address
>         *
>         * @return
>         */
>        public final native String getCountryCode() /*-{
>                if ( this.country_code ) {
>                        return this.country_code;
>                }
>                else {
>                        return null;
>                }
>        }-*/;
>
>        /**
>         * Supplies the country specific region name associated with the
> client's IP
>         * address
>         *
>         * @return
>         */
>        public final native String getRegion() /*-{
>                if ( this.region ) {
>                        return this.region;
>                }
>                else {
>                        return null;
>                }
>        }-*/;
> }
>
>
> Thanks,
> Eric
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to