use of elemental2.dom.HTMLIFrameElement in project gwtproject by treblereel.
the class RichTextAreaImplStandard method hookEvents.
@Override
protected void hookEvents() {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
Window wnd = iframe.contentWindow;
elem.setPropertyObject("__gwt_handler", (DOMImplStandard.Fn) event -> {
DOM.dispatchEvent(event, elem);
});
elem.setPropertyObject("__gwt_focusHandler", (DOMImplStandard.Fn) event -> {
if (((JsPropertyMap) elem).has("__gwt_isFocused")) {
return;
}
((JsPropertyMap) elem).set("__gwt_isFocused", true);
((DOMImplStandard.Fn) ((JsPropertyMap) elem).get("__gwt_handler")).onInvoke(event);
});
elem.setPropertyObject("__gwt_blurHandler", (DOMImplStandard.Fn) event -> {
if (((JsPropertyMap) elem).has("__gwt_isFocused")) {
return;
}
((JsPropertyMap) elem).set("__gwt_isFocused", true);
((DOMImplStandard.Fn) ((JsPropertyMap) elem).get("__gwt_handler")).onInvoke(event);
});
EventListener __gwt_handler = (EventListener) (((JsPropertyMap) elem).get("__gwt_handler"));
EventListener __gwt_focusHandler = (EventListener) (((JsPropertyMap) elem).get("__gwt_focusHandler"));
EventListener __gwt_blurHandler = (EventListener) (((JsPropertyMap) elem).get("__gwt_blurHandler"));
wnd.addEventListener("keydown", __gwt_handler, true);
wnd.addEventListener("keyup", __gwt_handler, true);
wnd.addEventListener("keypress", __gwt_handler, true);
wnd.addEventListener("mousedown", __gwt_handler, true);
wnd.addEventListener("mouseup", __gwt_handler, true);
wnd.addEventListener("mousemove", __gwt_handler, true);
wnd.addEventListener("mouseover", __gwt_handler, true);
wnd.addEventListener("mouseout", __gwt_handler, true);
wnd.addEventListener("click", __gwt_handler, true);
wnd.addEventListener("focus", __gwt_focusHandler, true);
wnd.addEventListener("blur", __gwt_blurHandler, true);
}
use of elemental2.dom.HTMLIFrameElement in project gwtproject by treblereel.
the class RichTextAreaImplStandard method execCommandAssumingFocus.
void execCommandAssumingFocus(String cmd, String param) {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
Document document = Js.uncheckedCast(Js.asPropertyMap(iframe.contentWindow).get("document"));
((ExecCommand) Js.uncheckedCast(Js.asPropertyMap(document).get("execCommand"))).onInvoke(cmd, false, param);
}
use of elemental2.dom.HTMLIFrameElement in project gwtproject by treblereel.
the class RichTextAreaImplStandard method initElement.
@Override
public void initElement() {
// Most browsers don"t like setting designMode until slightly _after_
// the iframe becomes attached to the DOM. Any non-zero timeout will do
// just fine.
RichTextAreaImplStandard _this = this;
_this.onElementInitializing();
DomGlobal.setTimeout((ignore) -> {
if (_this.elem != null) {
HTMLIFrameElement iframe = Js.uncheckedCast(_this.elem);
if (iframe.contentWindow != null) {
((JsPropertyMap) ((JsPropertyMap) iframe.contentWindow).get("document")).set("designMode", "On");
_this.onElementInitialized();
}
}
}, 1.0D, new Object[0]);
}
use of elemental2.dom.HTMLIFrameElement in project gwtproject by treblereel.
the class RichTextAreaImplStandard method queryCommandValueAssumingFocus.
String queryCommandValueAssumingFocus(String cmd) {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
Document document = Js.uncheckedCast(Js.asPropertyMap(iframe.contentWindow).get("document"));
return ((QueryCommandValue) Js.uncheckedCast(Js.asPropertyMap(document).get("queryCommandValue"))).onInvoke(cmd);
}
use of elemental2.dom.HTMLIFrameElement in project gwtproject by treblereel.
the class RichTextAreaImplStandard method unhookEvents.
protected void unhookEvents() {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
Window wnd = iframe.contentWindow;
JsPropertyMap asMap = ((JsPropertyMap) iframe);
wnd.removeEventListener("keydown", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("keyup", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("keypress", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("mousedown", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("mouseup", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("mousemove", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("mouseover", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("mouseout", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("click", (EventListener) asMap.get("__gwt_handler"), true);
wnd.removeEventListener("focus", (EventListener) asMap.get("__gwt_focusHandler"), true);
wnd.removeEventListener("blur", (EventListener) asMap.get("__gwt_blurHandler"), true);
asMap.set("__gwt_handler", null);
asMap.set("__gwt_focusHandler", null);
asMap.set("__gwt_blurHandler", null);
}
Aggregations