From 1313f0c0286cc31edf9874cedeb44f8689e7d0d0 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco MoƱino Date: Mon, 26 Nov 2012 16:20:48 +0100 Subject: End lines with LF instead of CRLF --- .../google/gwt/query/jsquery/JsQueryApi.gwt.xml | 16 ++--- .../gwt/query/jsquery/client/GQueryOverlay.java | 42 ++++++------ .../google/gwt/query/jsquery/client/JsQuery.java | 18 ++--- .../gwt/query/jsquery/client/JsQueryApi.java | 2 +- .../gwt/query/jsquery/client/JsQueryUtils.java | 8 +-- .../google/gwt/query/jsquery/public/JsQuery.html | 2 +- .../gwtquery/jsplugins/menu/JsQueryMenu.gwt.xml | 4 +- .../gwtquery/jsplugins/menu/client/JsMenu.java | 76 +++++++++++----------- .../jsplugins/menu/client/JsQueryMenu.java | 2 +- .../java/gwtquery/jsplugins/menu/public/demo.html | 6 +- 10 files changed, 88 insertions(+), 88 deletions(-) (limited to 'jsquery') 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 @@ - + - + - - { - + @ExportPackage("JsQuery") @Export("jFunction") @ExportClosure() @@ -54,7 +54,7 @@ public class GQueryOverlay implements ExportOverlay { public interface PredicateOverlay extends ExportOverlay { public boolean f(Element e, int i); } - + private GQueryOverlay(){} /** @@ -64,7 +64,7 @@ public class GQueryOverlay implements ExportOverlay { */ @ExportJsInitMethod public NodeList get() {return null;} - + /** * Customized JS code to execute after GQuery has been exported. */ @@ -74,7 +74,7 @@ public class GQueryOverlay implements ExportOverlay { window = $wnd; document = $doc; }-*/; - + @ExportStaticMethod("$wnd.$") public static GQuery $(Object o) { return GQuery.$(o); @@ -84,7 +84,7 @@ public class GQueryOverlay implements ExportOverlay { 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 { 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 { // 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 { 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 { 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 { 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 { // public T data(String name, Class 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 ret = new ArrayList(); 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; - } + } 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 @@ - - + + 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.$) {

Example one:

  • create a menubar from an unordered list
  • -
  • used on an unordered list, the plugin takes its direct <li>-children, which will be the root items (File, Edit...), +
  • 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...).
  • empty <li>-elements are used as seperators
@@ -188,7 +188,7 @@ if (window.$) {
JavaScript code:
 	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.$) {
 	
HTML markup:
 	<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>
-- 
cgit v1.2.3