diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2012-11-26 16:20:48 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2012-11-26 16:20:48 +0100 |
commit | 1313f0c0286cc31edf9874cedeb44f8689e7d0d0 (patch) | |
tree | 2b8f76e39102d96fa813fab5b7dec78765d6bcde /jsquery | |
parent | 305fd24cf14d4592ce0db0409193195ebc686678 (diff) | |
download | gwtquery-1313f0c0286cc31edf9874cedeb44f8689e7d0d0.tar.gz gwtquery-1313f0c0286cc31edf9874cedeb44f8689e7d0d0.zip |
End lines with LF instead of CRLF
Diffstat (limited to 'jsquery')
10 files changed, 88 insertions, 88 deletions
diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/JsQueryApi.gwt.xml b/jsquery/src/main/java/com/google/gwt/query/jsquery/JsQueryApi.gwt.xml index e30aed82..3ed71f16 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/JsQueryApi.gwt.xml +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/JsQueryApi.gwt.xml @@ -1,27 +1,27 @@ <!-- - This Module creates a javascript library able to replace jquery.js + This Module creates a javascript library able to replace jquery.js --> <module rename-to='jsquery'> <inherits name='com.google.gwt.query.jsquery.JsQuery' /> - + <entry-point class="com.google.gwt.query.jsquery.client.JsQueryApi" /> <!-- Minimize JS --> <set-property name="compiler.stackMode" value="strip"/> - <!-- cross-site --> + <!-- cross-site --> <add-linker name="xsiframe"/> - - <!-- + + <!-- Hack to put code into the jsquery.nocache.js so as $ is available early - and we can handle the $().ready method which is widely used in jquery pages. + and we can handle the $().ready method which is widely used in jquery pages. Otherwise $ wont be available until the async loading of the gwt permutation - which happens after the page was ready. + which happens after the page was ready. --> <define-property name="onload" values="default, foo"/> <property-provider name="onload"> <![CDATA[ - $wnd.JsQuery = { + $wnd.JsQuery = { onLoadArray: [], onLoad: function() { for (i in $wnd.JsQuery.onLoadArray) diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/GQueryOverlay.java b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/GQueryOverlay.java index a48266c5..88a7acde 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/GQueryOverlay.java +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/GQueryOverlay.java @@ -27,18 +27,18 @@ import com.google.gwt.user.client.Event; /** * Class used to expose GQuery methods and object to Javascript using * gwt-exporter annotations. - * + * * We prefer to overlay the original GQuery object instead of adding * the gwt-exporter dependency to the project. - * - * Because of the differences between java and js apis, we need to - * override some methods in order to deal with complex cases. + * + * Because of the differences between java and js apis, we need to + * override some methods in order to deal with complex cases. * */ @ExportPackage("JsQuery") @Export(value="fn", all=false) public class GQueryOverlay implements ExportOverlay<GQuery> { - + @ExportPackage("JsQuery") @Export("jFunction") @ExportClosure() @@ -54,7 +54,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public interface PredicateOverlay extends ExportOverlay<Predicate> { public boolean f(Element e, int i); } - + private GQueryOverlay(){} /** @@ -64,7 +64,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { */ @ExportJsInitMethod public NodeList<Element> get() {return null;} - + /** * Customized JS code to execute after GQuery has been exported. */ @@ -74,7 +74,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { window = $wnd; document = $doc; }-*/; - + @ExportStaticMethod("$wnd.$") public static GQuery $(Object o) { return GQuery.$(o); @@ -84,7 +84,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public static GQuery $(String s, Element ctx) { return GQuery.$(s, ctx); } - + @ExportStaticMethod("$wnd.$.extend") public static JavaScriptObject extend(Object...objs) { return JsQueryUtils.extend(objs); @@ -94,17 +94,17 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) { return JsQueryUtils.each(objs, f); } - + @ExportStaticMethod("$wnd.$.inArray") public static int inArray(Object o, Object arr) { return JsQueryUtils.inArray(o, arr); } - + @ExportStaticMethod("$wnd.$.isArray") public static boolean isArray(JavaScriptObject o) { return JsUtils.isArray(o); - } - + } + @ExportInstanceMethod public static GQuery ready(GQuery g, Function f) { f.fe(); @@ -115,11 +115,11 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { // TODO: normally plugins adds new easing functions to jquery.easing array public static GQuery animate(GQuery g, Object stringOrProperties, int duration, String easing, Function... funcs) { return g.animate(stringOrProperties, duration, - "linear".equalsIgnoreCase(easing) + "linear".equalsIgnoreCase(easing) ? PropertiesAnimation.Easing.LINEAR : PropertiesAnimation.Easing.SWING, funcs); } - + @ExportInstanceMethod public static Object css(GQuery g, Object o) { if (o instanceof String) { @@ -133,18 +133,18 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public static GQuery css(GQuery g, String k, Object v) { return g.css(k, String.valueOf(v)); } - + @ExportInstanceMethod public static JavaScriptObject offset(GQuery instance) { Offset o = instance.offset(); return Properties.create("left: " + o.left + ", top:" + o.top); } - + @ExportInstanceMethod public static GQuery unbind(GQuery g, String s, Function o) { return g.unbind(s); } - + public String toString() {return null;} public GQuery add(GQuery previousObject) {return null;} public GQuery add(String selector) {return null;} @@ -153,7 +153,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public GQuery after(Node n) {return null;} public GQuery after(String html) {return null;} public GQuery andSelf() {return null;} - + // public GQuery animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) {return null;} public GQuery animate(Object stringOrProperties, Function... funcs) {return null;} public GQuery animate(Object stringOrProperties, int duration, Function... funcs) {return null;} @@ -184,7 +184,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { public GQuery change(Function... f) {return null;} public GQuery children() {return null;} public GQuery children(String... filters) {return null;} - public GQuery clearQueue() {return null;} + public GQuery clearQueue() {return null;} public GQuery clone() {return null;} public GQuery clearQueue(String queueName) {return null;} public GQuery click(Function... f) {return null;} @@ -204,7 +204,7 @@ public class GQueryOverlay implements ExportOverlay<GQuery> { // public <T> T data(String name, Class<T> clz) {return null;} public GQuery data(String name, Object value) {return null;} public GQuery dblclick(Function... f) {return null;} - + @ExportInstanceMethod public static GQuery delay(GQuery g, int milliseconds) { System.out.println("DDDDD"); diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQuery.java b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQuery.java index 6afe7f55..9211b0f8 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQuery.java +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQuery.java @@ -8,7 +8,7 @@ import com.google.gwt.query.jsquery.client.GQueryOverlay.FunctionOverlay; import com.google.gwt.query.jsquery.client.GQueryOverlay.PredicateOverlay; public class JsQuery implements EntryPoint { - + public void onModuleLoad() { GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { Logger l = Logger.getLogger("JsQuery"); @@ -19,26 +19,26 @@ public class JsQuery implements EntryPoint { } l.info(r); } - }); - // We just export the api, but we do not call GQueryOverlay.onLoad() so as + }); + // We just export the api, but we do not call GQueryOverlay.onLoad() so as // apps and plugins could load their stuff before calling it export(); - + // Un comment for testing stuff below // testJs(); } - + public static void export() { GWT.create(FunctionOverlay.class); GWT.create(PredicateOverlay.class); GWT.create(GQueryOverlay.class); } - + public static native void onLoad() /*-{ $wnd.onJsQueryLoad && $wnd.onJsQueryLoad(); $wnd.JsQuery && $wnd.JsQuery.onLoad && $wnd.JsQuery.onLoad(); }-*/; - + /** * Used to paste jquery code and test it in dev mode */ @@ -47,8 +47,8 @@ public class JsQuery implements EntryPoint { window = $wnd; document = $doc; $ = $wnd.$; - + // Paste jquery code here - + }-*/; } diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryApi.java b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryApi.java index 2e466a93..1b74ebb7 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryApi.java +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryApi.java @@ -3,7 +3,7 @@ package com.google.gwt.query.jsquery.client; import com.google.gwt.core.client.EntryPoint; public class JsQueryApi implements EntryPoint { - + public void onModuleLoad() { JsQuery.onLoad(); } diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryUtils.java b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryUtils.java index b84d86b4..94bf4c3b 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryUtils.java +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/client/JsQueryUtils.java @@ -15,7 +15,7 @@ import com.google.gwt.query.client.js.JsUtils; /** * These are a set of utility methods needed in jsquery because * either they are not in the GQuery core yet, or they are already - * there but we need to modify their behavior. + * there but we need to modify their behavior. * Most of them should be moved to the GQuery core api. * */ @@ -35,7 +35,7 @@ public abstract class JsQueryUtils { public static void ready(Function f) { f.f(); } - + public static int inArray(Object object, Object array) { if (array instanceof List) { return ((List<?>)array).indexOf(object); @@ -75,7 +75,7 @@ public abstract class JsQueryUtils { } private static native JavaScriptObject getDefaultPrototype() /*-{ - return $wnd.JsQuery && $wnd.JsQuery.fn + return $wnd.JsQuery && $wnd.JsQuery.fn ? $wnd.JsQuery.fn.prototype : null; }-*/; @@ -90,7 +90,7 @@ public abstract class JsQueryUtils { } return d; }-*/; - + public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) { ArrayList<Object> ret = new ArrayList<Object>(); for (Object o : objs) { diff --git a/jsquery/src/main/java/com/google/gwt/query/jsquery/public/JsQuery.html b/jsquery/src/main/java/com/google/gwt/query/jsquery/public/JsQuery.html index 59877b4d..21ca8aa1 100644 --- a/jsquery/src/main/java/com/google/gwt/query/jsquery/public/JsQuery.html +++ b/jsquery/src/main/java/com/google/gwt/query/jsquery/public/JsQuery.html @@ -14,7 +14,7 @@ if (window.$) { $(document).ready(onJsQueryLoad); onJsQueryLoad = null; - } + } </script> </body> </html> diff --git a/jsquery/src/main/java/gwtquery/jsplugins/menu/JsQueryMenu.gwt.xml b/jsquery/src/main/java/gwtquery/jsplugins/menu/JsQueryMenu.gwt.xml index 81153c56..a43e6e2c 100644 --- a/jsquery/src/main/java/gwtquery/jsplugins/menu/JsQueryMenu.gwt.xml +++ b/jsquery/src/main/java/gwtquery/jsplugins/menu/JsQueryMenu.gwt.xml @@ -1,7 +1,7 @@ <module rename-to='jsmenu'> <inherits name='com.google.gwt.query.jsquery.JsQuery' /> <entry-point class="gwtquery.jsplugins.menu.client.JsQueryMenu" /> - - + + </module> diff --git a/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsMenu.java b/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsMenu.java index 0977f6ce..5b0fd38d 100644 --- a/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsMenu.java +++ b/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsMenu.java @@ -1,20 +1,20 @@ package gwtquery.jsplugins.menu.client; /** - * + * * This class wraps the jquery menu plugin from: - * + * * http://p.sohei.org/jquery-plugins/menu/ * */ public abstract class JsMenu { - + public static native void loadPlugin() /*-{ var l = @com.google.gwt.query.jsquery.client.JsQueryUtils::log(Ljava/lang/Object;); var window = $wnd; var document = $doc; var jQuery = $wnd.$; - + (function($) { var menus = [], //list of all menus @@ -40,20 +40,20 @@ public abstract class JsMenu { onClick: null, arrowSrc: null, addExpando: false, - + // $.fn.menuFromElement options copyClassAttr: false }; - + $(function(){ $rootDiv.appendTo('body'); }); $.extend({ MenuCollection : function(items) { - + this.menus = []; - + this.init(items); } }); @@ -74,9 +74,9 @@ public abstract class JsMenu { { if ( menu instanceof $.Menu ) this.menus.push(menu); - + menu.menuCollection = this; - + var self = this; $(menu.target).hover(function(){ if ( menu.visible ) @@ -124,7 +124,7 @@ public abstract class JsMenu { //the user clicked on the target of the currenty open menu if ( visibleMenus.length && t == visibleMenus[0].target ) return; - + //get the last node before the #root-menu-div while ( t.parentNode && t.parentNode != $rootDiv[0] ) t = t.parentNode; @@ -332,8 +332,8 @@ public abstract class JsMenu { { if ( !this.visible ) return; - - var i, + + var i, pos = $.inArray(this, visibleMenus); this.$eDIV.hide(); @@ -362,7 +362,7 @@ public abstract class JsMenu { if ( activeMenu == this ) activeMenu = null; - + if ( this.settings.onClose ) this.settings.onClose.call(this); }, @@ -371,7 +371,7 @@ public abstract class JsMenu { if ( this.visible ) return; - var zi, + var zi, pmi = this.parentMenuItem; if ( this.menuItems.length ) //show only when it has items @@ -389,7 +389,7 @@ public abstract class JsMenu { if ( this.$eDIV.width() < this.settings.minWidth ) this.$eDIV.css('width', this.settings.minWidth); } - + this.setPosition(); this.$eDIV.css({display:'none', visibility: ''}).show(); @@ -400,7 +400,7 @@ public abstract class JsMenu { if ( this.settings.onOpen ) this.settings.onOpen.call(this); } - + if ( visibleMenus.length == 0 ) $(document).bind('mousedown', $.Menu.checkMouse).bind('keydown', $.Menu.checkKey); @@ -409,11 +409,11 @@ public abstract class JsMenu { }, setPosition : function() { - var $t, o, posX, posY, + var $t, o, posX, posY, pmo, //parent menu offset wst, //window scroll top wsl, //window scroll left - ww = $(window).width(), + ww = $(window).width(), wh = $(window).height(), pmi = this.parentMenuItem, height = this.$eDIV[0].clientHeight, @@ -432,7 +432,7 @@ public abstract class JsMenu { //position right below the target $t = $(this.target); o = $t.offset(); - + posX = o.left + this.settings.offsetLeft; posY = o.top + $t.height() + this.settings.offsetTop; } @@ -536,7 +536,7 @@ public abstract class JsMenu { var i, pos = 0, mil = this.menuItems.length, o = offset || 1; - + //get current pos for ( i = 0; i < mil; i++ ) { @@ -593,7 +593,7 @@ public abstract class JsMenu { if ( (pos = $.inArray(this, this.menuCollection.menus)) > -1 ) this.menuCollection.menus.splice(pos, 1); } - + this.$eDIV.remove(); } } @@ -620,7 +620,7 @@ public abstract class JsMenu { this.separator = false; this.init(); - + if ( obj.subMenu ) new $.Menu(this, obj.subMenu, options); } @@ -633,14 +633,14 @@ public abstract class JsMenu { var i, isStr, src = this.src, self = this; - + this.$eLI = $(menuItemElement.cloneNode(1)); if ( this.addClass ) this.$eLI[0].setAttribute('class', this.addClass); if ( this.settings.addExpando && this.data ) this.$eLI[0].menuData = this.data; - + if ( src == '' ) { this.$eLI.addClass('menu-separator'); @@ -692,7 +692,7 @@ public abstract class JsMenu { { this.removeTimer(); - var i, + var i, pms = this.parentMenu.subMenus, pmi = this.parentMenu.menuItems, self = this; @@ -703,7 +703,7 @@ public abstract class JsMenu { if ( !this.enabled ) return; - + //deactivate all menuItems on the same level for ( i = 0; i < pmi.length; i++ ) { @@ -737,7 +737,7 @@ public abstract class JsMenu { if ( !this.enabled ) return; - + if ( !this.subMenu || !this.subMenu.visible ) this.setInactive(); }, @@ -809,17 +809,17 @@ public abstract class JsMenu { } } }); - - + + $.extend($.fn, { menuFromElement : function(options, list, bar) { var createItems = function(ul) { - var menuItems = [], + var menuItems = [], subItems, menuItem, - lis, $li, i, subUL, submenu, target, + lis, $li, i, subUL, submenu, target, classNames = null; lis = getAllChilds(ul, 'LI'); @@ -846,17 +846,17 @@ public abstract class JsMenu { target = $li[0].childNodes[0].nodeValue; else target = $li[0].childNodes; - + if ( options && options.copyClassAttr ) classNames = $li.attr('class'); - + //create item menuItem = new $.MenuItem({src: target, addClass: classNames}, options); menuItems.push(menuItem); //add submenu if ( subItems.length ) new $.Menu(menuItem, subItems, options); - + } return menuItems; }; @@ -917,7 +917,7 @@ public abstract class JsMenu { return null; var n = elem.firstChild; - for ( ; n; n = n.nextSibling ) + for ( ; n; n = n.nextSibling ) { if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name ) return n; @@ -932,7 +932,7 @@ public abstract class JsMenu { var r = [], n = elem.firstChild; - for ( ; n; n = n.nextSibling ) + for ( ; n; n = n.nextSibling ) { if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name ) r[r.length] = n; @@ -941,6 +941,6 @@ public abstract class JsMenu { }; })(jQuery); - + }-*/; } diff --git a/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsQueryMenu.java b/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsQueryMenu.java index 438075d2..ef720b65 100644 --- a/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsQueryMenu.java +++ b/jsquery/src/main/java/gwtquery/jsplugins/menu/client/JsQueryMenu.java @@ -4,7 +4,7 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.query.jsquery.client.JsQuery; public class JsQueryMenu implements EntryPoint { - + public void onModuleLoad() { JsMenu.loadPlugin(); JsQuery.onLoad(); diff --git a/jsquery/src/main/java/gwtquery/jsplugins/menu/public/demo.html b/jsquery/src/main/java/gwtquery/jsplugins/menu/public/demo.html index 1e55c326..fe851bef 100644 --- a/jsquery/src/main/java/gwtquery/jsplugins/menu/public/demo.html +++ b/jsquery/src/main/java/gwtquery/jsplugins/menu/public/demo.html @@ -84,7 +84,7 @@ if (window.$) { <h1>Example one:</h1> <ul> <li>create a menubar from an unordered list</li> - <li>used on an unordered list, the plugin takes its direct <li>-children, which will be the root items (File, Edit...), + <li>used on an unordered list, the plugin takes its direct <li>-children, which will be the root items (File, Edit...), and searches each for an <ul>-child, which holds the menu-items (New window, Save, Print...).</li> <li>empty <li>-elements are used as seperators</li> </ul> @@ -188,7 +188,7 @@ if (window.$) { <div class="codeheader">JavaScript code:</div> <pre name="code" class="JScript"> var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'}; - var items = [ {src: 'test', url:'http://www.jquery.com'}, + var items = [ {src: 'test', url:'http://www.jquery.com'}, {src: ''}, /* separator */ {src: 'test2', subMenu: [ {src: 'sub 1'}, {src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'}, @@ -308,7 +308,7 @@ if (window.$) { <div class="codeheader">HTML markup:</div> <pre name="code" class="html"> <p id="menufive">Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /></p> - + <ul id="menufivelist" style="display:none;"> <li>one</li> <li class="red">two</li> |