use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class DOMImplPatcher method dispatchEvent.
@PatchMethod
static void dispatchEvent(Object domImpl, Element target, NativeEvent evt) {
EventListener listener = DOM.getEventListener(target);
if (listener != null && evt instanceof Event) {
listener.onBrowserEvent((Event) evt);
}
// dispatch to parent if needed
boolean propagationStopped = JavaScriptObjects.getBoolean(evt, JsoProperties.EVENT_IS_STOPPED);
if (target.getParentElement() != null && propagationStopped) {
target.getParentElement().dispatchEvent(evt);
}
}
use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class DOMPatcher method getParent.
@PatchMethod
static Element getParent(Element elem) {
com.google.gwt.dom.client.Element parentElem = elem.getParentElement();
if (parentElem == null) {
return null;
}
Element parent = parentElem.cast();
return parent;
}
use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class DocumentPatcher method nativeGet.
@PatchMethod
static Document nativeGet() {
if (DOCUMENT_HOLDER.document == null) {
try {
DOCUMENT_HOLDER.document = JsoUtils.newDocument();
Element e = parseHTMLElement(DOCUMENT_HOLDER.document);
DOCUMENT_HOLDER.document.appendChild(e);
JavaScriptObjects.setProperty(DOCUMENT_HOLDER.document, DOCUMENT_ELEMENT, e);
return DOCUMENT_HOLDER.document;
} catch (Exception e) {
if (GwtTestException.class.isInstance(e)) {
throw (GwtTestException) e;
} else {
throw new GwtTestDomException("Unable to create Document", e);
}
}
}
return DOCUMENT_HOLDER.document;
}
use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class PotentialElementPatcher method build.
@PatchMethod
static PotentialElement build(UIObject o, String tagName) {
PotentialElement e = JsoUtils.newNode(Node.ELEMENT_NODE).cast();
Element wrappedElement = JsoUtils.newElement(tagName, o.getElement().getOwnerDocument());
JavaScriptObjects.setProperty(e, POTENTIALELEMENT_TAG, true);
JavaScriptObjects.setProperty(e, POTENTIALELEMENT_WRAPPED_ELEMENT, wrappedElement);
JavaScriptObjects.setProperty(e, POTENTIALELEMENT_UIOBJECT, o);
return e;
}
use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class TableSectionElementPatcher method deleteRow.
@PatchMethod
static void deleteRow(TableSectionElement e, int index) {
NodeList<TableRowElement> rows = e.getRows();
if (rows.getLength() < 1) {
return;
}
if (index == -1) {
index = rows.getLength() - 1;
}
TableRowElement rowToDelete = rows.getItem(index);
e.removeChild(rowToDelete);
}
Aggregations