}
private static native void scrollIntoViewImpl(Node n) /*-{
- if (n)
- n.scrollIntoView()
+ if (n)
+ n.scrollIntoView()
}-*/;
private static native void setElementValue(Element e, String value) /*-{
- e.value = value;
+ e.value = value;
}-*/;
protected Node currentContext;
}
private native Element getPreviousSiblingElement(Element elem) /*-{
- var sib = elem.previousSibling;
- while (sib && sib.nodeType != 1)
- sib = sib.previousSibling;
- return sib;
+ var sib = elem.previousSibling;
+ while (sib && sib.nodeType != 1)
+ sib = sib.previousSibling;
+ return sib;
}-*/;
/**
* http://code.google.com/p/google-web-toolkit/issues/detail?id=5548
*/
private native String getZIndex(Style s) /*-{
- //force to return a string
- return "" + s["zIndex"];
+ //force to return a string
+ return "" + s["zIndex"];
}-*/;
}
}
private static native String getAttributeNode(Element e, String name)/*-{
- var attrNode = e.getAttributeNode(name);
- if (attrNode && attrNode.nodeValue !== "") {
- return attrNode.nodeValue;
- }
- return null;
+ var attrNode = e.getAttributeNode(name);
+ if (attrNode && attrNode.nodeValue !== "") {
+ return attrNode.nodeValue;
+ }
+ return null;
}-*/;
private static native boolean setAttributeNode(Element e, String name,
Object value)/*-{
- var attrNode = e.getAttributeNode(name);
- if (attrNode) {
- attrNode.nodeValue = value;
- return true;
- }
- return false;
+ var attrNode = e.getAttributeNode(name);
+ if (attrNode) {
+ attrNode.nodeValue = value;
+ return true;
+ }
+ return false;
}-*/;
@Override
protected native void init()/*-{
try {
- [ "log", "info", "warn", "error", "dir", "clear", "profile", "profileEnd" ]
- .forEach(function(method) {
- $wnd.console[method] = this.call($wnd.console[method], $wnd.console);
- }, Function.prototype.bind);
+ [ "log", "info", "warn", "error", "dir", "clear", "profile", "profileEnd" ]
+ .forEach(function(method) {
+ $wnd.console[method] = this.call($wnd.console[method], $wnd.console);
+ }, Function.prototype.bind);
this.@com.google.gwt.query.client.impl.ConsoleBrowser.ConsoleIe9::initialized = true;
} catch(e) {
}
Element toDetach = null;
if (JsUtils.isDetached(elem)) {
- // If the element is detached to the DOM we attach temporary to it
- toDetach = attachTemporary(elem);
+ // If the element is detached to the DOM we attach temporary to it
+ toDetach = attachTemporary(elem);
}
if (sizeRegex.test(name)) {
// If the element was previously attached, detached it.
if (toDetach != null) {
- toDetach.removeFromParent();
+ toDetach.removeFromParent();
}
}
}
private Element attachTemporary(Element elem) {
- Element lastParent = $(elem).parents().last().get(0);
-
- if (lastParent == null){
- //the element itself is detached
- lastParent = elem;
- }
-
- Document.get().getBody().appendChild(lastParent);
-
- return lastParent;
-}
+ Element lastParent = $(elem).parents().last().get(0);
+
+ if (lastParent == null){
+ //the element itself is detached
+ lastParent = elem;
+ }
+
+ Document.get().getBody().appendChild(lastParent);
+
+ return lastParent;
+ }
/**
* Fix style property names.
return prefix + "[position() mod 2=0 and position()>=0]" + (noPrefix ? "" : "/self::" + s1);
}
if ("odd".equals(s2)) {
- prefix = afterAttr ? prefix : noPrefix ? "" : s1;
+ prefix = afterAttr ? prefix : noPrefix ? "" : s1;
return prefix + "[(count(preceding-sibling::*) + 1) mod 2=1]";
}
if (!s2.contains("n")){
- return prefix + "[position() = "+s2+"]" + (noPrefix ? "" : "/self::" + s1);
+ return prefix + "[position() = "+s2+"]" + (noPrefix ? "" : "/self::" + s1);
}
String[] t = s2.replaceAll("^([0-9]*)n.*?([0-9]*)?$", "$1+$2").split("\\+");
public class SelectorEngineJSIE extends SelectorEngineJS {
public native String getAttr(Element elm, String attr) /*-{
- switch (attr) {
- case "id":
- return elm.id;
- case "for":
- return elm.htmlFor;
- case "class":
- return elm.className;
- }
- return elm.getAttribute(attr, 2);
+ switch (attr) {
+ case "id":
+ return elm.id;
+ case "for":
+ return elm.htmlFor;
+ case "class":
+ return elm.className;
+ }
+ return elm.getAttribute(attr, 2);
}-*/;
}
}
private native boolean isEventAlreadyHandled(GqEvent event)/*-{
- var result = event.mouseHandled ? event.mouseHandled : false;
- return result;
+ var result = event.mouseHandled ? event.mouseHandled : false;
+ return result;
}-*/;
private native void markEventAsHandled(GqEvent event)/*-{
- event.mouseHandled = true;
+ event.mouseHandled = true;
}-*/;
private boolean notHandleMouseDown(Element element, GqEvent mouseDownEvent) {
}
private static native void cleanGQListeners(Element elem) /*-{
- if (elem.__gwtlistener) {
+ if (elem.__gwtlistener) {
@com.google.gwt.user.client.DOM::setEventListener(*)(elem, elem.__gwtlistener);
- }
- elem.__gwtlistener = elem.__gqueryevent = elem.__gquery = null;
+ }
+ elem.__gwtlistener = elem.__gqueryevent = elem.__gquery = null;
}-*/;
private static native EventsListener getGQueryEventListener(Element elem) /*-{
- return elem.__gqueryevent;
+ return elem.__gqueryevent;
}-*/;
private static native EventListener getGwtEventListener(Element elem) /*-{
- return elem.__gwtlistener;
+ return elem.__gwtlistener;
}-*/;
private static native void init(Element elem, EventsListener gqevent)/*-{
- elem.__gwtlistener = @com.google.gwt.user.client.DOM::getEventListener(*)(elem);
+ elem.__gwtlistener = @com.google.gwt.user.client.DOM::getEventListener(*)(elem);
elem.__gqueryevent = gqevent;
// Someone has reported that in IE the init can be called multiple times
// causing a loop. We need some test to demonstrate this behaviour though.
// Anyway we check this condition to avoid looping
- if (elem.__gwtlistener == gqevent) elem.__gwtlistener = null;
+ if (elem.__gwtlistener == gqevent) elem.__gwtlistener = null;
}-*/;
private static native void sinkBitlessEvent(Element elem, String name) /*-{
- if (!elem.__gquery)
- elem.__gquery = [];
- if (elem.__gquery[name])
- return;
- elem.__gquery[name] = true;
-
- var handle = function(event) {
- elem.__gqueryevent.@com.google.gwt.query.client.plugins.events.EventsListener::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(event);
- };
-
- if (elem.addEventListener)
- elem.addEventListener(name, handle, true);
- else
- elem.attachEvent("on" + name, handle);
+ if (!elem.__gquery)
+ elem.__gquery = [];
+ if (elem.__gquery[name])
+ return;
+ elem.__gquery[name] = true;
+
+ var handle = function(event) {
+ elem.__gqueryevent.@com.google.gwt.query.client.plugins.events.EventsListener::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(event);
+ };
+
+ if (elem.addEventListener)
+ elem.addEventListener(name, handle, true);
+ else
+ elem.attachEvent("on" + name, handle);
}-*/;
int eventBits = 0;
private static native void copy(
Event originalEvent, GqEvent gQueryEvent) /*-{
- for ( var field in originalEvent) {
- gQueryEvent[field] = originalEvent[field];
- }
- gQueryEvent.originalEvent = originalEvent;
+ for ( var field in originalEvent) {
+ gQueryEvent[field] = originalEvent[field];
+ }
+ gQueryEvent.originalEvent = originalEvent;
}-*/;
* Return the original event (the one created by the browser)
*/
public final native Event getOriginalEvent()/*-{
- return this.originalEvent;
+ return this.originalEvent;
}-*/;
public final native void setCurrentElementTarget(Element e)/*-{
writer.println("protected boolean isIe10() {return " + "ie10".equals(ua) + ";}");
writer.println("protected boolean isIe11() {return " + "gecko1_8".equals(ua) + ";}");
writer.println("public String toString() {return \"Browser:\"" +
- " + \" webkit=\" + webkit" +
+ " + \" webkit=\" + webkit" +
" + \" mozilla=\" + mozilla" +
" + \" opera=\" + opera" +
" + \" msie=\" + msie" +
} else if (retType.equals("java.lang.Byte")) {
sw.println("return (byte) p.getFloat(\"" + name + "\");");
} else if (retType.equals("java.lang.Integer")) {
- sw.println("return (int) p.getFloat(\"" + name + "\");");
+ sw.println("return (int) p.getFloat(\"" + name + "\");");
} else if (retType.equals("java.lang.Float")) {
- sw.println("return p.getFloat(\"" + name + "\");");
+ sw.println("return p.getFloat(\"" + name + "\");");
} else if (retType.equals("java.lang.Double")) {
- sw.println("return (double) p.getFloat(\"" + name + "\");");
+ sw.println("return (double) p.getFloat(\"" + name + "\");");
} else if (retType.equals("java.lang.Long")) {
- sw.println("return (long) p.getFloat(\"" + name + "\");");
+ sw.println("return (long) p.getFloat(\"" + name + "\");");
} else if (retType.equals("java.lang.Byte")) {
- sw.println("return (byte) p.getFloat(\"" + name + "\");");
+ sw.println("return (byte) p.getFloat(\"" + name + "\");");
} else if (isTypeAssignableTo(method.getReturnType(), stringType)) {
sw.println("return p.getStr(\"" + name + "\");");
} else if (isTypeAssignableTo(method.getReturnType(), jsonBuilderType)) {
sw.println("return Arrays.asList(" + ret + ");");
}
} else if (method.getReturnType().isEnum() != null){
- sw.println("return "+ method.getReturnType().getQualifiedSourceName() + ".valueOf(p.getStr(\"" + name + "\"));");
+ sw.println("return "+ method.getReturnType().getQualifiedSourceName() + ".valueOf(p.getStr(\"" + name + "\"));");
} else {
sw.println("System.err.println(\"JsonBuilderGenerator WARN: unknown return type "
+ retType + " " + ifaceName + "." + name + "()\"); ");
t[1], requestedClass);
if (sw != null) {
for (JMethod method : clazz.getInheritableMethods()) {
- //skip method from JsonBuilder
+ //skip method from JsonBuilder
if(xmlBuilderType.findMethod(method.getName(), method.getParameterTypes()) != null){
- continue;
+ continue;
}
generateMethod(sw, method, treeLogger);
}