]> source.dussan.org Git - gwtquery.git/commitdiff
Remove @author @param @return. Add javadocs
authorJulien Dramaix <julien.dramaix@gmail.com>
Sun, 16 Jan 2011 21:11:08 +0000 (21:11 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Sun, 16 Jan 2011 21:11:08 +0000 (21:11 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MouseOptions.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/MousePlugin.java

index db8d72eaa25353b678534281621cb5e475ad651d..5b19d4eea628049207feb4ab5f653a8f15a72017 100755 (executable)
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2011 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 package com.google.gwt.query.client.plugins;
 
 import com.google.gwt.core.client.GWT;
@@ -12,13 +27,45 @@ import com.google.gwt.query.client.Plugin;
 import com.google.gwt.query.client.Predicate;
 
 /**
- * GWT clone of jQueryUi-core
- * 
- * @author Julien Dramaix (julien.dramaix@gmail.com, @jdramaix)
+ * GWT clone of jQueryUi-core. This class define some function present in the
+ * jQuery-ui core and not directly in jQuery
  * 
  */
 public class GQueryUi extends GQuery {
 
+  /**
+   * A POJO used to store dimension of an element
+   * 
+   */
+  public static class Dimension {
+    private int height = 0;
+    private int width = 0;
+
+    public Dimension(Element e) {
+      width = e.getOffsetWidth();
+      height = e.getOffsetHeight();
+    }
+
+    public Dimension(int width, int height) {
+      this.width = width;
+      this.height = height;
+    }
+
+    /**
+     * return the height value.
+     */
+    public int getHeight() {
+      return height;
+    }
+
+    /**
+     * return the width value
+     */
+    public int getWidth() {
+      return width;
+    }
+  }
+
   /**
    * 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
@@ -29,13 +76,14 @@ public class GQueryUi extends GQuery {
    * 
    * TOBEFIXED : the method preventDefault() must be called directly on the
    * original event
-   * 
-   * 
-   * @author jdramaix
+   *
    * 
    */
   public static 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);
@@ -53,15 +101,24 @@ public class GQueryUi extends GQuery {
     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;
     }-*/;
 
+    /**
+     * 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
      * 
-     * @param mouseEvent
-     * @return the mouse x-position in the page
      */
     public final int pageX() {
       return getClientX() + document.getScrollLeft();
@@ -70,54 +127,15 @@ public class GQueryUi extends GQuery {
     /**
      * The mouse position relative to the top edge of the document.
      * 
-     * @param mouseEvent
-     * @return the mouse y-position in the page
      */
     public final int pageY() {
       return getClientY() + document.getScrollTop();
     }
 
-    /**
-     * Tell if ctrl or cmd key is pressed
-     * 
-     * @return
-     */
-    public final boolean isMetaKeyPressed() {
-      return getMetaKey() || getCtrlKey();
-    }
-
-  }
-
-  public static class Dimension {
-    private int width = 0;
-    private int height = 0;
-
-    public Dimension(Element e) {
-      width = e.getOffsetWidth();
-      height = e.getOffsetHeight();
-    }
-
-    public Dimension(int width, int height) {
-      this.width = width;
-      this.height = height;
-    }
-
-    public int getHeight() {
-      return height;
-    }
-
-    public int getWidth() {
-      return width;
-    }
   }
 
   private static class GQueryUiImpl {
 
-    private final Element getViewportElement() {
-      return GQuery.document.isCSS1Compat() ? GQuery.document
-          .getDocumentElement() : GQuery.document.getBody();
-    }
-
     public GQuery scrollParent(final GQueryUi gQueryUi) {
       GQuery scrollParent;
 
@@ -150,16 +168,21 @@ public class GQueryUi extends GQuery {
 
     }
 
+    protected boolean scrollParentPositionTest(GQueryUi gQueryUi) {
+      return "absolute".equals(gQueryUi.css("position"));
+    }
+
+    private final Element getViewportElement() {
+      return GQuery.document.isCSS1Compat() ? GQuery.document
+          .getDocumentElement() : GQuery.document.getBody();
+    }
+
     private boolean isOverflowEnabled(GQuery e) {
       String overflow = e.css("overflow", true) + e.css("overflow-x", true)
           + e.css("overflow-y", true);
       return overflow.contains("auto") || overflow.contains("scroll");
     }
 
-    protected boolean scrollParentPositionTest(GQueryUi gQueryUi) {
-      return "absolute".equals(gQueryUi.css("position"));
-    }
-
   }
 
   @SuppressWarnings("unused")
@@ -185,14 +208,27 @@ public class GQueryUi extends GQuery {
     });
   }
 
-  protected HasHandlers eventBus;
-
-  private GQueryUiImpl impl = GWT.create(GQueryUiImpl.class);
-
+  /**
+   * Return true if the <code>descendant</code> is a child of the parent. Return false elsewhere.
+   */
   public static boolean contains(Element parent, Element descendant) {
     return parent != descendant && parent.isOrHasChild(descendant);
   }
 
+  protected static void trigger(GwtEvent<?> e, Function callback,
+      Element element, HasHandlers handlerManager) {
+    if (handlerManager != null && e != null) {
+      handlerManager.fireEvent(e);
+    }
+    if (callback != null) {
+      callback.f(element);
+    }
+  }
+
+  protected HasHandlers eventBus;
+
+  private GQueryUiImpl impl = GWT.create(GQueryUiImpl.class);
+
   public GQueryUi() {
     super();
   }
@@ -214,9 +250,7 @@ public class GQueryUi extends GQuery {
   }
 
   /**
-   * this function returns the immediate scrolling parent.
-   * 
-   * @return the immediate scrolling parent
+   * Return the immediate scrolling parent.
    */
   public GQuery scrollParent() {
     return impl.scrollParent(this);
@@ -225,22 +259,9 @@ public class GQueryUi extends GQuery {
   /**
    * fire event and call callback function.
    * 
-   * @param e
-   * @param callback
-   * @param element
    */
   protected void trigger(GwtEvent<?> e, Function callback, Element element) {
     trigger(e, callback, element, eventBus);
   }
 
-  protected static void trigger(GwtEvent<?> e, Function callback,
-      Element element, HasHandlers handlerManager) {
-    if (handlerManager != null && e != null) {
-      handlerManager.fireEvent(e);
-    }
-    if (callback != null) {
-      callback.f(element);
-    }
-  }
-
 }
index 9487b7e3373560af97af72a9f189de844969ca56..25bd51eecd7f62ec15d1d18b83dad000b8b05c74 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 The gwtquery plugins team.
+ * Copyright 2011 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  */
 package com.google.gwt.query.client.plugins;
 
+/**
+ * Object use to configure a Plugin extending {@link MousePlugin}
+ * 
+ */
 public class MouseOptions {
 
-  /**
-   * Prevents plugin working from starting on specified elements.
-   */
   private String[] cancel;
 
-  /**
-   * Time in milliseconds to define when the plugin should start. It helps
-   * preventing unwanted selections when clicking on an element. Default : 0
-   * 
-   */
   private int delay;
 
-  /**
-   * Tolerance, in pixels, for when plugin should start. If specified, selecting
-   * will not start until after mouse is dragged beyond distance. Default : 1
-   * 
-   */
   private int distance;
 
   public MouseOptions() {
     initDefault();
   }
 
+  /**
+   * Return an array of css selectors. The plugin will not start when the mouse
+   * interacts with the elements selected by the selectors.
+   * 
+   */
   public String[] getCancel() {
     return cancel;
   }
 
+  /**
+   * Return the tolerance, in pixels, for when plugin should start. If
+   * specified, the plugin will not start until after mouse is dragged beyond
+   * distance.
+   * 
+   */
   public int getDelay() {
     return delay;
   }
 
+  /**
+   * return the time in milliseconds that define when the plugin should start.
+   */
   public int getDistance() {
     return distance;
   }
 
   /**
    * Prevents starting of the plugin on specified elements
-   * @param cancel array of css selectors
+   * 
+   * @param cancel
+   *          array of css selectors
    */
   public void setCancel(String... cancel) {
     this.cancel = cancel;
@@ -62,17 +69,18 @@ public class MouseOptions {
 
   /**
    * Time in milliseconds to define when the plugin should start. It helps
-   * preventing unwanted selections when clicking on an element. 
-   * @param delay
+   * preventing unwanted selections when clicking on an element.
+   * 
    */
   public void setDelay(int delay) {
     this.delay = delay;
   }
 
   /**
-   * Tolerance, in pixels, for when plugin should start. If specified, selecting
-   * will not start until after mouse is dragged beyond distance. Default : 1
-   * @param distance
+   * Tolerance, in pixels, for when plugin should start. If specified, the
+   * plugin will not start until after mouse is dragged beyond distance. Default
+   * : 1
+   * 
    */
   public void setDistance(int distance) {
     this.distance = distance;
@@ -80,8 +88,7 @@ public class MouseOptions {
 
   protected void initDefault() {
     delay = 0;
-    distance = 1; //by default, the mouse have to move one pixel !
-    cancel = new String[]{"input", "option"};
+    distance = 1; // by default, the mouse have to move one pixel !
+    cancel = new String[] { "input", "option" };
   }
 }
-
index a5cd2b16d4e9e513a82a609e58a9c8a589805fdc..77258f17d3fc2d7038acec46e9ffb01482db4791 100755 (executable)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2010 The gwtquery plugins team.\r
+ * Copyright 2011 Google Inc.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
  * use this file except in compliance with the License. You may obtain a copy of\r
@@ -27,16 +27,12 @@ import com.google.gwt.query.client.plugins.Events;
 /**\r
  * Base class for all plug-in that need to handle some mouse interactions.\r
  * \r
- * @author Julien Dramaix (julien.dramaix@gmail.com, @jdramaix)\r
- * \r
  */\r
 public abstract class MousePlugin extends GQueryUi {\r
 \r
   private Event mouseDownEvent;\r
   private boolean mouseStarted = false;\r
   private Duration mouseUpDuration;\r
-  // private int mouseDownX;\r
-  // private int mouseDownY;\r
   private MouseOptions options;\r
   private boolean preventClickEvent = false;\r
 \r
@@ -65,14 +61,12 @@ public abstract class MousePlugin extends GQueryUi {
    * Return a String identifying the plugin. This string is used as namespace\r
    * when we bind handlers.\r
    * \r
-   * @return\r
    */\r
   protected abstract String getPluginName();\r
 \r
   /**\r
    * This method initialize all needed handlers\r
    * \r
-   * @param options\r
    */\r
   protected void initMouseHandler(MouseOptions options) {\r
     this.options = options;\r
@@ -110,7 +104,6 @@ public abstract class MousePlugin extends GQueryUi {
   /**\r
    * Test if the mouse down event must be handled by the plugin or not.\r
    * \r
-   * \r
    */\r
   protected boolean mouseCapture(Element draggable, Event event) {\r
     return true;\r
@@ -119,9 +112,6 @@ public abstract class MousePlugin extends GQueryUi {
   /**\r
    * Method called when mouse click\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected boolean mouseClick(Element element, Event event) {\r
     return true;\r
@@ -133,9 +123,6 @@ public abstract class MousePlugin extends GQueryUi {
    * You should not override this method. Instead, override\r
    * {@link #mouseStart(Element, Event)} method\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected boolean mouseDown(Element element, Event event) {\r
 \r
@@ -174,9 +161,6 @@ public abstract class MousePlugin extends GQueryUi {
   /**\r
    * Method called when the mouse is dragging\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected abstract boolean mouseDrag(Element element, Event event);\r
 \r
@@ -186,9 +170,6 @@ public abstract class MousePlugin extends GQueryUi {
    * You should not override this method. Instead, override\r
    * {@link #mouseMove(Element, Event)} method\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected boolean mouseMove(Element element, Event event) {\r
     if (mouseStarted) {\r
@@ -212,18 +193,12 @@ public abstract class MousePlugin extends GQueryUi {
    * Method called when the mouse is clicked and all conditions for starting the\r
    * plugin are met.\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected abstract boolean mouseStart(Element element, Event event);\r
 \r
   /**\r
    * Method called when the mouse button is released\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected abstract boolean mouseStop(Element element, Event event);\r
 \r
@@ -233,9 +208,6 @@ public abstract class MousePlugin extends GQueryUi {
    * You should not override this method. Instead, override\r
    * {@link #mouseStop(Element, Event)} method\r
    * \r
-   * @param element\r
-   * @param event\r
-   * @return\r
    */\r
   protected boolean mouseUp(Element element, Event event) {\r
     unbindOtherMouseEvent();\r