All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.maps.gwt.client.adsense.AdUnit Maven / Gradle / Ivy

/*
 * Copyright 2011 The Google Web Toolkit Authors.
 *
 * 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.google.maps.gwt.client.adsense;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Node;
import com.google.maps.gwt.client.ControlPosition;
import com.google.maps.gwt.client.GoogleMap;
import com.google.maps.gwt.client.MVCObject;

/**
 * Implements AdSense for Content advertising on an associated map. To use an 
 * AdUnit
 * 
 * , you must obtain and specify an AdSense for Content publisher ID within the 
 * AdUnit
 * 
 * 's constructor options.
 *
 * THIS SOURCE CODE IS GENERATED, DO NOT MODIFY
 */
public class AdUnit extends MVCObject {

  /**
   * This event is fired when the 
   * AdUnit
   * 
   * 's 
   * channelNumber
   * 
   * property changes.
   */
  public interface ChannelNumberChangedHandler  {

    /**
     * Override to handle event.
     */ 
    void handle();
  }

  /**
   * This event is fired when the 
   * AdUnit
   * 
   * 's 
   * format
   * 
   * property changes.
   */
  public interface FormatChangedHandler  {

    /**
     * Override to handle event.
     */ 
    void handle();
  }

  /**
   * This event is fired when the 
   * AdUnit
   * 
   * 's 
   * map
   * 
   * property changes.
   */
  public interface MapChangedHandler  {

    /**
     * Override to handle event.
     */ 
    void handle();
  }

  /**
   * This event is fired when the 
   * AdUnit
   * 
   * 's 
   * position
   * 
   * property changes.
   */
  public interface PositionChangedHandler  {

    /**
     * Override to handle event.
     */ 
    void handle();
  }

  /**
   * Creates an AdSense for Content display ad on the associated map.
   */ 
  public static native AdUnit create(Node container, AdUnitOptions opts)/*-{
    var _opts;
    if(@com.google.gwt.core.client.GWT::isScript()()) {
      _opts = opts;
    } else {
      _opts = {};
      for(k in opts) {
        if(k != "__gwt_ObjectId") {
          _opts[k] = opts[k];
        }
      }
    } 
    return new $wnd.google.maps.adsense.AdUnit(container, _opts);
  }-*/;


  /**
   * Protected constructor avoids default public constructor.
   */
  protected AdUnit() {
    /* Java constructor is protected, */
  }

  /**
   * Adds the given listener function to the given event name for the
   * given object instance. Returns an identifier for this listener that
   * can be used with removeListener().
   */ 
  public final native void addChannelNumberChangedListener(ChannelNumberChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.ChannelNumberChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListener(this, "channelnumber_changed", _handler);
  }-*/;

  /**
   * Like addListener, but the handler removes itself after handling the first event.
   */ 
  public final native void addChannelNumberChangedListenerOnce(ChannelNumberChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.ChannelNumberChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListenerOnce(this, "channelnumber_changed", _handler);
  }-*/;

  /**
   * Adds the given listener function to the given event name for the
   * given object instance. Returns an identifier for this listener that
   * can be used with removeListener().
   */ 
  public final native void addFormatChangedListener(FormatChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.FormatChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListener(this, "format_changed", _handler);
  }-*/;

  /**
   * Like addListener, but the handler removes itself after handling the first event.
   */ 
  public final native void addFormatChangedListenerOnce(FormatChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.FormatChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListenerOnce(this, "format_changed", _handler);
  }-*/;

  /**
   * Adds the given listener function to the given event name for the
   * given object instance. Returns an identifier for this listener that
   * can be used with removeListener().
   */ 
  public final native void addMapChangedListener(MapChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.MapChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListener(this, "map_changed", _handler);
  }-*/;

  /**
   * Like addListener, but the handler removes itself after handling the first event.
   */ 
  public final native void addMapChangedListenerOnce(MapChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.MapChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListenerOnce(this, "map_changed", _handler);
  }-*/;

  /**
   * Adds the given listener function to the given event name for the
   * given object instance. Returns an identifier for this listener that
   * can be used with removeListener().
   */ 
  public final native void addPositionChangedListener(PositionChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.PositionChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListener(this, "position_changed", _handler);
  }-*/;

  /**
   * Like addListener, but the handler removes itself after handling the first event.
   */ 
  public final native void addPositionChangedListenerOnce(PositionChangedHandler handler)/*-{
    var _handler = $entry(function() {
      handler.@com.google.maps.gwt.client.adsense.AdUnit.PositionChangedHandler::handle()();

    }); 
    $wnd.google.maps.event.addListenerOnce(this, "position_changed", _handler);
  }-*/;

  /**
   * Removes all listeners for the given event for the given instance.
   */ 
  public final native void clearChannelNumberChangedListeners()/*-{
    $wnd.google.maps.event.clearListeners(this, "channelnumber_changed");
  }-*/;

  /**
   * Removes all listeners for the given event for the given instance.
   */ 
  public final native void clearFormatChangedListeners()/*-{
    $wnd.google.maps.event.clearListeners(this, "format_changed");
  }-*/;

  /**
   * Removes all listeners for all events for the given instance.
   */ 
  public final native void clearInstanceListeners()/*-{
    $wnd.google.maps.event.clearInstanceListeners(this);
  }-*/;

  /**
   * Removes all listeners for the given event for the given instance.
   */ 
  public final native void clearMapChangedListeners()/*-{
    $wnd.google.maps.event.clearListeners(this, "map_changed");
  }-*/;

  /**
   * Removes all listeners for the given event for the given instance.
   */ 
  public final native void clearPositionChangedListeners()/*-{
    $wnd.google.maps.event.clearListeners(this, "position_changed");
  }-*/;

  /**
   * Returns the channel number in use by this 
   * AdUnit
   * 
   * .
   */ 
  public final native String getChannelNumber()/*-{
    return this.getChannelNumber();

  }-*/;

  /**
   * Returns the containing element of the AdUnit.
   */ 
  public final native Node getContainer()/*-{
    return this.getContainer();

  }-*/;

  /**
   * Returns the format in use by this 
   * AdUnit
   * 
   * .
   */ 
  public final native AdFormat getFormat()/*-{
    var _retval = this.getFormat();
    var retval = (_retval == undefined) ?
        null : @com.google.maps.gwt.client.adsense.AdFormat::fromValue(Ljava/lang/String;)(_retval);
    return retval;
  }-*/;

  /**
   * Returns the map to which this 
   * AdUnit
   * 
   * 's ads are targeted.
   */ 
  public final native GoogleMap getMap()/*-{
    return this.getMap();

  }-*/;

  /**
   * Returns the 
   * ControlPosition
   * 
   *  at which this 
   * AdUnit
   * 
   * is displayed on the map.
   */ 
  public final native ControlPosition getPosition()/*-{
    var _retval = this.getPosition();
    var retval = (_retval == undefined) ?
        null : @com.google.maps.gwt.client.ControlPosition::fromValue(D)(_retval);
    return retval;
  }-*/;

  /**
   * Returns the specified AdSense For Content publisher ID.
   */ 
  public final native String getPublisherId()/*-{
    return this.getPublisherId();

  }-*/;

  /**
   * Specifies the channel number for this 
   * AdUnit
   * 
   * .  Channel numbers are optional and can be created for Google AdSense tracking.
   */ 
  public final native void setChannelNumber(String channelNumber)/*-{
    this.setChannelNumber(channelNumber);

  }-*/;

  /**
   * Specifies the display format for this 
   * AdUnit
   * 
   * .
   */ 
  public final native void setFormat(AdFormat format)/*-{
    var _format = format == undefined ? null : format.value; 
    this.setFormat(_format);

  }-*/;

  /**
   * Associates this 
   * AdUnit
   * 
   * with the specified map.  Ads will be targeted to the map's viewport. 
   * The map must be specified in order to display ads.
   */ 
  public final native void setMap(GoogleMap map)/*-{
    this.setMap(map);

  }-*/;

  /**
   * Sets the 
   * ControlPosition
   * 
   * at which to display the
   * AdUnit
   * 
   * on the map.  If the position is set to null, the
   * AdUnit
   * 
   * is removed from the map.
   */ 
  public final native void setPosition(ControlPosition position)/*-{
    var _position = position == undefined ? null : position.value; 
    this.setPosition(_position);

  }-*/;

  /**
   * Triggers the given event. All arguments after eventName are passed as
   * arguments to the listeners.
   */ 
  public final native void triggerChannelNumberChanged(JavaScriptObject... varargs)/*-{
    var _varargs =
        @com.google.maps.gwt.client.ArrayHelper::toJsArray([Lcom/google/gwt/core/client/JavaScriptObject;)(varargs); 
    $wnd.google.maps.event.trigger(this, "channelnumber_changed", _varargs);
  }-*/;

  /**
   * Triggers the given event. All arguments after eventName are passed as
   * arguments to the listeners.
   */ 
  public final native void triggerFormatChanged(JavaScriptObject... varargs)/*-{
    var _varargs =
        @com.google.maps.gwt.client.ArrayHelper::toJsArray([Lcom/google/gwt/core/client/JavaScriptObject;)(varargs); 
    $wnd.google.maps.event.trigger(this, "format_changed", _varargs);
  }-*/;

  /**
   * Triggers the given event. All arguments after eventName are passed as
   * arguments to the listeners.
   */ 
  public final native void triggerMapChanged(JavaScriptObject... varargs)/*-{
    var _varargs =
        @com.google.maps.gwt.client.ArrayHelper::toJsArray([Lcom/google/gwt/core/client/JavaScriptObject;)(varargs); 
    $wnd.google.maps.event.trigger(this, "map_changed", _varargs);
  }-*/;

  /**
   * Triggers the given event. All arguments after eventName are passed as
   * arguments to the listeners.
   */ 
  public final native void triggerPositionChanged(JavaScriptObject... varargs)/*-{
    var _varargs =
        @com.google.maps.gwt.client.ArrayHelper::toJsArray([Lcom/google/gwt/core/client/JavaScriptObject;)(varargs); 
    $wnd.google.maps.event.trigger(this, "position_changed", _varargs);
  }-*/;

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy