*/\r
package com.google.gwt.query.client;\r
\r
-import static com.google.gwt.query.client.plugins.Effects.Effects;\r
-import static com.google.gwt.query.client.plugins.Events.Events;\r
-import static com.google.gwt.query.client.plugins.SimpleNamedQueue.SimpleNamedQueue;\r
-\r
import java.util.ArrayList;\r
import java.util.Arrays;\r
import java.util.List;\r
+import java.util.Map;\r
\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.core.client.JavaScriptObject;\r
import com.google.gwt.query.client.js.JsNodeArray;\r
import com.google.gwt.query.client.js.JsUtils;\r
import com.google.gwt.query.client.plugins.Effects;\r
+import com.google.gwt.query.client.plugins.Events;\r
import com.google.gwt.query.client.plugins.Plugin;\r
+import com.google.gwt.query.client.plugins.SimpleNamedQueue;\r
+import com.google.gwt.query.client.plugins.Widgets;\r
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;\r
import com.google.gwt.query.client.plugins.events.EventsListener;\r
import com.google.gwt.user.client.DOM;\r
*/\r
public static Class<GQuery> GQUERY = GQuery.class;\r
\r
+ /**\r
+ * Static references to GQuery core plugins\r
+ */\r
+ public static Class<Effects> Effects = com.google.gwt.query.client.plugins.Effects.Effects;\r
+ public static Class<Events> Events = com.google.gwt.query.client.plugins.Events.Events;\r
+ public static Class<Widgets> Widgets = com.google.gwt.query.client.plugins.Widgets.Widgets;\r
+ public static Class<SimpleNamedQueue> SimpleNamedQueue = com.google.gwt.query.client.plugins.SimpleNamedQueue.SimpleNamedQueue;\r
+\r
/**\r
* The window object.\r
*/\r
* the License.
*/
package com.google.gwt.query.client;
-import static com.google.gwt.query.client.plugins.Effects.Effects;
-import static com.google.gwt.query.client.plugins.Events.Events;
-import static com.google.gwt.query.client.plugins.SimpleNamedQueue.SimpleNamedQueue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.HasCssName;
import com.google.gwt.dom.client.TextAreaElement;
-import com.google.gwt.event.logical.shared.ResizeEvent;
-import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.query.client.css.CSS;
import com.google.gwt.query.client.css.HasCssValue;
import com.google.gwt.query.client.css.TakesCssValue;
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.query.client.plugins.Effects;
+import com.google.gwt.query.client.plugins.Events;
import com.google.gwt.query.client.plugins.Plugin;
+import com.google.gwt.query.client.plugins.SimpleNamedQueue;
+import com.google.gwt.query.client.plugins.Widgets;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
import com.google.gwt.query.client.plugins.events.EventsListener;
import com.google.gwt.user.client.DOM;
import com.google.gwt.dom.client.NativeEvent;\r
import com.google.gwt.query.client.Function;\r
import com.google.gwt.query.client.GQuery;\r
+import com.google.gwt.query.client.plugins.events.GqEvent;\r
+import com.google.gwt.user.client.Event;\r
\r
/**\r
* Base class for all plug-in that need to handle some mouse interactions.\r
*/\r
public abstract class MousePlugin extends UiPlugin {\r
\r
- private Event mouseDownEvent;\r
+ private GqEvent mouseDownEvent;\r
private boolean mouseStarted = false;\r
private Duration mouseUpDuration;\r
private MouseOptions options;\r
}\r
\r
protected void destroyMouseHandler() {\r
- as(Events.Events)\r
+ as(Events)\r
.unbind(Event.ONMOUSEDOWN | Event.ONCLICK, getPluginName());\r
}\r
\r
\r
for (final Element e : elements()) {\r
\r
- $(e).as(Events.Events).bind(Event.ONMOUSEDOWN, getPluginName(),\r
+ $(e).as(Events).bind(Event.ONMOUSEDOWN, getPluginName(),\r
(Object) null, new Function() {\r
@Override\r
public boolean f(com.google.gwt.user.client.Event event) {\r
- return mouseDown(e, (Event)Event.create(event));\r
+ return mouseDown(e, GqEvent.create(event));\r
\r
}\r
}).bind(Event.ONCLICK, getPluginName(), (Object) null,\r
new Function() {\r
@Override\r
public boolean f(com.google.gwt.user.client.Event event) {\r
- preventClickEvent |= !mouseClick(e, (Event)Event.create(event));\r
+ preventClickEvent |= !mouseClick(e, GqEvent.create(event));\r
\r
if (preventClickEvent) {\r
\r
* Test if the mouse down event must be handled by the plugin or not.\r
* \r
*/\r
- protected boolean mouseCapture(Element draggable, Event event) {\r
+ protected boolean mouseCapture(Element draggable, GqEvent event) {\r
return true;\r
}\r
\r
* Method called when mouse click\r
* \r
*/\r
- protected boolean mouseClick(Element element, Event event) {\r
+ protected boolean mouseClick(Element element, GqEvent event) {\r
return true;\r
}\r
\r
* Method called when mouse down occur on the element.\r
* \r
* You should not override this method. Instead, override\r
- * {@link #mouseStart(Element, Event)} method\r
+ * {@link #mouseStart(Element, GqEvent)} method\r
* \r
*/\r
- protected boolean mouseDown(Element element, Event event) {\r
+ protected boolean mouseDown(Element element, GqEvent event) {\r
\r
// test if an other plugin handle the mouseStart\r
if (isEventAlreadyHandled(event)) {\r
* Method called when the mouse is dragging\r
* \r
*/\r
- protected abstract boolean mouseDrag(Element element, Event event);\r
+ protected abstract boolean mouseDrag(Element element, GqEvent event);\r
\r
/**\r
* Method called on MouseMove event.\r
* \r
* You should not override this method. Instead, override\r
- * {@link #mouseMove(Element, Event)} method\r
+ * {@link #mouseMove(Element, GqEvent)} method\r
* \r
*/\r
- protected boolean mouseMove(Element element, Event event) {\r
+ protected boolean mouseMove(Element element, GqEvent event) {\r
if (mouseStarted) {\r
event.getOriginalEvent().preventDefault();\r
return mouseDrag(element, event);\r
* plugin are met.\r
* \r
*/\r
- protected abstract boolean mouseStart(Element element, Event event);\r
+ protected abstract boolean mouseStart(Element element, GqEvent event);\r
\r
/**\r
* Method called when the mouse button is released\r
* \r
*/\r
- protected abstract boolean mouseStop(Element element, Event event);\r
+ protected abstract boolean mouseStop(Element element, GqEvent event);\r
\r
/**\r
* Method called when mouse is released..\r
* \r
* You should not override this method. Instead, override\r
- * {@link #mouseStop(Element, Event)} method\r
+ * {@link #mouseStop(Element, GqEvent)} method\r
* \r
*/\r
- protected boolean mouseUp(Element element, Event event) {\r
+ protected boolean mouseUp(Element element, GqEvent event) {\r
unbindOtherMouseEvent();\r
if (mouseStarted) {\r
mouseStarted = false;\r
\r
private void bindOtherMouseEvent(final Element element) {\r
\r
- $(document).as(Events.Events).bind(Event.ONMOUSEMOVE, getPluginName(),\r
+ $(document).as(Events).bind(Event.ONMOUSEMOVE, getPluginName(),\r
(Object) null, new Function() {\r
@Override\r
public boolean f(com.google.gwt.user.client.Event e) {\r
- mouseMove(element, (Event) Event.create(e));\r
+ mouseMove(element, (GqEvent) GqEvent.create(e));\r
return false;\r
}\r
}).bind(Event.ONMOUSEUP, getPluginName(), (Object) null,\r
new Function() {\r
@Override\r
public boolean f(com.google.gwt.user.client.Event e) {\r
- mouseUp(element, (Event) Event.create(e));\r
+ mouseUp(element, (GqEvent) GqEvent.create(e));\r
return false;\r
}\r
});\r
return options.getDelay() <= mouseUpDuration.elapsedMillis();\r
}\r
\r
- private boolean distanceConditionMet(Event event) {\r
+ private boolean distanceConditionMet(GqEvent event) {\r
int neededDistance = options.getDistance();\r
int mouseDownX = mouseDownEvent.getClientX();\r
int mouseDownY = mouseDownEvent.getClientY();\r
return mouseDistance >= neededDistance;\r
}\r
\r
- private native boolean isEventAlreadyHandled(Event event)/*-{\r
+ private native boolean isEventAlreadyHandled(GqEvent event)/*-{\r
var result = event.mouseHandled ? event.mouseHandled : false;\r
return result;\r
}-*/;\r
\r
- private native void markEventAsHandled(Event event)/*-{\r
+ private native void markEventAsHandled(GqEvent event)/*-{\r
event.mouseHandled = true;\r
}-*/;\r
\r
- private boolean notHandleMouseDown(Element element, Event mouseDownEvent) {\r
+ private boolean notHandleMouseDown(Element element, GqEvent mouseDownEvent) {\r
boolean isNotBoutonLeft = mouseDownEvent.getButton() != NativeEvent.BUTTON_LEFT;\r
Element eventTarget = mouseDownEvent.getEventTarget().cast();\r
\r
\r
}\r
\r
- private void reset(Event mouseDownEvent) {\r
+ private void reset(GqEvent mouseDownEvent) {\r
this.mouseDownEvent = mouseDownEvent;\r
this.mouseUpDuration = new Duration();\r
}\r
\r
private void unbindOtherMouseEvent() {\r
- $(document).as(Events.Events).unbind((Event.ONMOUSEUP | Event.ONMOUSEMOVE),\r
+ $(document).as(Events).unbind((Event.ONMOUSEUP | Event.ONMOUSEMOVE),\r
getPluginName());\r
}\r
\r
}
}
- /**
- *
- *
- * @deprecated use {@link com.google.gwt.query.client.plugins.events.Event} instead
- */
- public static class Event extends com.google.gwt.query.client.plugins.events.Event {
- protected Event() {
- }
- }
-
-
private static class GQueryUiImpl {
public GQuery scrollParent(final UiPlugin gQueryUi) {
+++ /dev/null
-package com.google.gwt.query.client.plugins.events;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.query.client.GQuery;
-
-/**
- * This object allows you to have a full copy of the original Event and
- * implements some useful method of the jQuery event model.
- *
- * This is also useful in Internet Explorer because it use the same javascript
- * object to fire MouseDownEvent, MouseMoveEvent or MouseStopEvent on the same
- * element. So, we cannot keep a copy of the MouseDownEvent during a dragging
- * for example.
- *
- *
- *
- * TOBEFIXED : the method preventDefault() must be called directly on the
- * original event
- *
- *
- */
-public class Event extends com.google.gwt.user.client.Event {
-
-
- /**
- * Create a new {@link Event} by copying the <code>originalEvent</code>.
- */
- public static Event create(com.google.gwt.user.client.Event originalEvent) {
- Event gQueryEvent = createObject().cast();
- copy(originalEvent, gQueryEvent);
- return gQueryEvent;
- }
-
- private static native void copy(
- com.google.gwt.user.client.Event originalEvent, Event gQueryEvent) /*-{
- for ( var field in originalEvent) {
- gQueryEvent[field] = originalEvent[field];
- }
- gQueryEvent.originalEvent = originalEvent;
- }-*/;
-
- protected Event() {
- }
-
- /**
- * Return the original event (the one created by the browser)
- */
- public final native com.google.gwt.user.client.Event getOriginalEvent()/*-{
- return this.originalEvent;
- }-*/;
-
- public final native void setCurrentElementTarget(Element e)/*-{
-
- this.currentTarget = e;
-
- //ie don't have a currentEventTarget field on event
- try{
- @com.google.gwt.dom.client.DOMImplTrident::currentEventTarget = e;
- }catch(e){}
- }-*/;
-
- /**
- * Tell whether ctrl or cmd key is pressed
- *
- */
- public final boolean isMetaKeyPressed() {
- return getMetaKey() || getCtrlKey();
- }
-
- /**
- * The mouse position relative to the left edge of the document
- *
- */
- public final int pageX() {
- return getClientX() + GQuery.document.getScrollLeft();
- }
-
- /**
- * The mouse position relative to the top edge of the document.
- *
- */
- public final int pageY() {
- return getClientY() + GQuery.document.getScrollTop();
- }
-
-
-
-}
boolean result = true;
- com.google.gwt.query.client.plugins.events.Event gqEvent = com.google.gwt.query.client.plugins.events.Event.create(event);
+ GqEvent gqEvent = GqEvent.create(event);
for (String cssSelector : realCurrentTargetBySelector.keys()) {
JsObjectArray<BindFunction> bindFunctions = bindFunctionBySelector.get(cssSelector);
}
- // Gwt Events class has not this event defined, so we have to select ane available power of 2
- public static int ONSUBMIT = 0x8000000;
- public static int ONRESIZE = 0x4000000;
-
+ public static int ONSUBMIT = GqEvent.ONSUBMIT;
+ public static int ONRESIZE = GqEvent.ONRESIZE;
public static void clean(Element e) {
EventsListener ret = getGQueryEventListener(e);
--- /dev/null
+package com.google.gwt.query.client.plugins.events;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.user.client.Event;
+
+/**
+ * This object allows you to have a full copy of the original Event and
+ * implements some useful method of the jQuery event model.
+ *
+ * This is also useful in Internet Explorer because it use the same javascript
+ * object to fire MouseDownEvent, MouseMoveEvent or MouseStopEvent on the same
+ * element. So, we cannot keep a copy of the MouseDownEvent during a dragging
+ * for example.
+ *
+ *
+ *
+ * TOBEFIXED : the method preventDefault() must be called directly on the
+ * original event
+ *
+ *
+ */
+public class GqEvent extends Event {
+
+ // Gwt Events class has not this event defined,
+ // so we have to select one power of 2 which is unused in Event class
+ public static int ONSUBMIT = 0x8000000;
+ public static int ONRESIZE = 0x4000000;
+
+ /**
+ * Create a new {@link GqEvent} by copying the <code>originalEvent</code>.
+ */
+ public static GqEvent create(Event originalEvent) {
+ GqEvent gQueryEvent = createObject().cast();
+ copy(originalEvent, gQueryEvent);
+ return gQueryEvent;
+ }
+
+ private static native void copy(
+ Event originalEvent, GqEvent gQueryEvent) /*-{
+ for ( var field in originalEvent) {
+ gQueryEvent[field] = originalEvent[field];
+ }
+ gQueryEvent.originalEvent = originalEvent;
+ }-*/;
+
+ protected GqEvent() {
+ }
+
+ /**
+ * Return the original event (the one created by the browser)
+ */
+ public final native Event getOriginalEvent()/*-{
+ return this.originalEvent;
+ }-*/;
+
+ public final native void setCurrentElementTarget(Element e)/*-{
+ this.currentTarget = e;
+
+ //ie don't have a currentEventTarget field on event
+ try{
+ @com.google.gwt.dom.client.DOMImplTrident::currentEventTarget = e;
+ }catch(e){}
+ }-*/;
+
+ /**
+ * Tell whether ctrl or cmd key is pressed
+ *
+ */
+ public final boolean isMetaKeyPressed() {
+ return getMetaKey() || getCtrlKey();
+ }
+
+ /**
+ * The mouse position relative to the left edge of the document
+ *
+ */
+ public final int pageX() {
+ return getClientX() + GQuery.document.getScrollLeft();
+ }
+
+ /**
+ * The mouse position relative to the top edge of the document.
+ *
+ */
+ public final int pageY() {
+ return getClientY() + GQuery.document.getScrollTop();
+ }
+
+}