de.swm.gwt.client.responsive.JsMatchMedia Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swm-gwt-client Show documentation
Show all versions of swm-gwt-client Show documentation
Plain GWT Swm erweiterungen, auch zur benutzung in mobilen Geraeten
package de.swm.gwt.client.responsive;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.shared.HandlerRegistration;
/**
* @author Ed Bras
*/
class JsMatchMedia extends JavaScriptObject implements IMatchMedia {
// Required by GWT.
protected JsMatchMedia() {
}
public final HandlerRegistration addMatchMediaChangeHandler(IMatchMediaChangeHandler handler) {
return (handler == null) ? null : addHandler(handler);
}
// @formatter:off
public final native boolean hasMatch() /*-{
return this.matches;
}-*/;
public final native String getMedia() /*-{
return this.media;
}-*/;
private void forward(IMatchMediaChangeHandler handler) {
handler.onMatchMediaChange(this);
}
private native JsHandlerRegistration addHandler(IMatchMediaChangeHandler handler) /*-{
func = function (matchMedia) {
[email protected]::onMatchMediaChange(Lde/swm/gwt/client/responsive/IMatchMedia;)(matchMedia);
}
this.addListener(func);
return {callback: func, match: this};
}-*/;
// @formatter:on
}