@SuppressWarnings("unchecked") private static Scriptable staticGetPrototype(final Window window, final Class<? extends SimpleScriptable> javaScriptClass) { final Scriptable prototype = window.getPrototype(javaScriptClass); if (prototype == null && javaScriptClass != SimpleScriptable.class) { return staticGetPrototype(window, (Class<? extends SimpleScriptable>) javaScriptClass.getSuperclass()); } return prototype; }
@SuppressWarnings("unchecked") private static Scriptable staticGetPrototype(final Window window, final Class< ? extends SimpleScriptable> javaScriptClass) { final Scriptable prototype = window.getPrototype(javaScriptClass); if (prototype == null && javaScriptClass != SimpleScriptable.class) { return staticGetPrototype(window, (Class< ? extends SimpleScriptable>) javaScriptClass.getSuperclass()); } return prototype; }
@SuppressWarnings("unchecked") private static Scriptable staticGetPrototype(final Window window, final Class< ? extends SimpleScriptable> javaScriptClass) { final Scriptable prototype = window.getPrototype(javaScriptClass); if (prototype == null && javaScriptClass != SimpleScriptable.class) { return staticGetPrototype(window, (Class< ? extends SimpleScriptable>) javaScriptClass.getSuperclass()); } return prototype; }
/** * Gets the prototype object for the given host class. * @param javaScriptClass the host class * @return the prototype */ @SuppressWarnings("unchecked") public Scriptable getPrototype(final Class<? extends SimpleScriptable> javaScriptClass) { final Scriptable prototype = getWindow().getPrototype(javaScriptClass); if (prototype == null && javaScriptClass != SimpleScriptable.class) { return getPrototype((Class<? extends SimpleScriptable>) javaScriptClass.getSuperclass()); } return prototype; }
/** * Constructor. * @param window the parent scope * @param store the storage itself */ public Storage(final Window window, final Map<String, String> store) { store_ = store; setParentScope(window); setPrototype(window.getPrototype(Storage.class)); }
/** * Facility constructor. * @param window the owning window */ public Crypto(final Window window) { setParentScope(window); setPrototype(window.getPrototype(Crypto.class)); }
/** * Facility constructor. * @param window the owning window */ public Promise(final Window window) { setParentScope(window); setPrototype(window.getPrototype(Promise.class)); }
/** * Facility constructor. * @param window the owning window */ public Crypto(final Window window) { setParentScope(window); setPrototype(window.getPrototype(Crypto.class)); }
/** * Returns the current selection. * @return the current selection */ public Selection getSelectionImpl() { if (selection_ == null) { selection_ = new Selection(); selection_.setParentScope(this); selection_.setPrototype(getPrototype(selection_.getClass())); } return selection_; }
/** * Returns the JavaScript property "clipboardData". * @return the ClipboardData */ public ClipboardData jsxGet_clipboardData() { final ClipboardData clipboardData = new ClipboardData(); clipboardData.setParentScope(this); clipboardData.setPrototype(getPrototype(clipboardData.getClass())); return clipboardData; }
/** * Returns the JavaScript property "clipboardData". * @return the ClipboardData */ public ClipboardData jsxGet_clipboardData() { final ClipboardData clipboardData = new ClipboardData(); clipboardData.setParentScope(this); clipboardData.setPrototype(getPrototype(clipboardData.getClass())); return clipboardData; }
/** * Returns the current selection. * @return the current selection */ public Selection getSelection() { if (selection_ == null) { selection_ = new Selection(); selection_.setParentScope(this); selection_.setPrototype(getPrototype(selection_.getClass())); } return selection_; }
/** * Returns the {@code external} property. * @return the {@code external} property */ @JsxGetter public External getExternal() { final External external = new External(); external.setParentScope(this); external.setPrototype(getPrototype(external.getClass())); return external; }
/** * Returns the {@code styleMedia} property. * @return the {@code styleMedia} property */ @JsxGetter({CHROME, IE}) public StyleMedia getStyleMedia() { final StyleMedia styleMedia = new StyleMedia(); styleMedia.setParentScope(this); styleMedia.setPrototype(getPrototype(styleMedia.getClass())); return styleMedia; }
/** * Returns the {@code speechSynthesis} property. * @return the {@code speechSynthesis} property */ @JsxGetter(CHROME) public SpeechSynthesis getSpeechSynthesis() { final SpeechSynthesis speechSynthesis = new SpeechSynthesis(); speechSynthesis.setParentScope(this); speechSynthesis.setPrototype(getPrototype(speechSynthesis.getClass())); return speechSynthesis; }
/** * Returns the JavaScript property {@code clipboardData}. * @return the {@link DataTransfer} */ @JsxGetter(IE) public DataTransfer getClipboardData() { final DataTransfer dataTransfer = new DataTransfer(); dataTransfer.setParentScope(this); dataTransfer.setPrototype(getPrototype(dataTransfer.getClass())); return dataTransfer; }
/** * Returns the {@code performance} property. * @return the {@code performance} property */ @JsxGetter public Performance getPerformance() { final Performance performance = new Performance(); performance.setParentScope(this); performance.setPrototype(getPrototype(performance.getClass())); return performance; }
/** * Returns a new MediaQueryList object representing the parsed results of the specified media query string. * * @param mediaQueryString the media query * @return a new MediaQueryList object */ @JsxFunction public MediaQueryList matchMedia(final String mediaQueryString) { final MediaQueryList mediaQueryList = new MediaQueryList(mediaQueryString); mediaQueryList.setParentScope(this); mediaQueryList.setPrototype(getPrototype(mediaQueryList.getClass())); return mediaQueryList; }
/** * Returns the {@code performance} property. * @return the {@code performance} property */ @JsxGetter public Performance getPerformance() { final Performance performance = new Performance(); performance.setParentScope(this); performance.setPrototype(getPrototype(performance.getClass())); return performance; }
/** * Creates a popup window. * @see <a href="http://msdn.microsoft.com/en-us/library/ms536392.aspx">MSDN documentation</a> * @return the created popup */ public Popup jsxFunction_createPopup() { final Popup popup = new Popup(); popup.setParentScope(this); popup.setPrototype(getPrototype(Popup.class)); popup.init(this); return popup; }