// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/DraggableOptions.java
// public interface DragFunction {
//   public void f(DragContext context);
// }
// 
// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/events/DragContext.java
// public class DragContext {
// 
//   static final String VALUE_KEY = "__dragAndDropCellAssociatedValue";
// 
//   private Element draggable;
// 
//   private List<Element> selectedDraggables;
// 
//   private Element initialDraggable;
// 
// 
//   /**
//    * Constructor
//    *
//    * @param draggable the draggable element
//    */
//   public DragContext(Element draggable, Element initialDraggable,
//                      List<Element> selectedDraggable) {
//     this.draggable = draggable;
//     this.selectedDraggables = selectedDraggable;
//     this.initialDraggable = initialDraggable;
//   }
// 
//   public DragContext(DragContext ctx) {
//     this(ctx.getDraggable(), ctx.getInitialDraggable(), ctx
//         .getSelectedDraggables());
//   }
// 
//   /**
//    * @return the draggable DOM element
//    */
//   public Element getDraggable() {
//     return draggable;
//   }
// 
//   /**
//    * This method allows getting the data object linked to the draggable element
//    * (a cell) in the context of CellWidget.It return the data object being
//    * rendered by the dragging cell. Return null if we are not in the context of
//    * an drag and drop cell widget.
//    *
//    * @param <T> the class of the data
//    * @return
//    */
//   @SuppressWarnings("unchecked")
//   public <T> T getDraggableData() {
//     return (T) $(getDraggable()).data(VALUE_KEY);
//   }
// 
//   /**
//    * This method return the widget associated to the draggable DOM element if it
//    * exist. It returns null otherwise.
//    */
//   public DraggableWidget<?> getDraggableWidget() {
//     if (getDraggable() != null) {
//       return DraggableWidget.get(getDraggable());
//     }
//     return null;
//   }
// 
//   /**
//    * @return the DOM element used for dragging display
//    */
//   public Element getHelper() {
//     DraggableHandler handler = DraggableHandler.getInstance(draggable);
// 
//     if (handler.getHelper() != null) {
//       return handler.getHelper().get(0);
//     }
//     return null;
//   }
// 
//   /**
//    * @return the {@link Offset} of the helper element.
//    */
//   public Offset getHelperPosition() {
//     return DraggableHandler.getInstance(draggable).getPosition();
//   }
// 
//   /**
//    * @return the list of selected draggables.
//    */
//   public List<Element> getSelectedDraggables() {
//     return selectedDraggables;
//   }
// 
//   /**
//    * @return the draggable element that initiate the drag operation (i.e. the
//    *         clicked element)
//    */
//   public Element getInitialDraggable() {
//     return initialDraggable;
//   }
// 
// 
// }
// 
// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/Draggable.java
// public static final Class<Draggable> Draggable = Draggable.class;


import com.google.gwt.core.client.EntryPoint;
import gwtquery.plugins.draggable.client.DraggableOptions.DragFunction;
import gwtquery.plugins.draggable.client.events.DragContext;
import static com.google.gwt.query.client.GQuery.$;
import static gwtquery.plugins.draggable.client.Draggable.Draggable;
/*
 * Copyright 2010 The gwtquery plugins team.
 *
 * 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 gwtquery.plugins.draggable.client;



/**
 * Simple sample
 *
 * @author Julien Dramaix (julien.dramaix@gmail.com)
 */
public class DraggableSample1 implements EntryPoint {

  private int startCounter = 0;
  private int dragCounter = 0;
  private int stopCounter = 0;

  public void onModuleLoad() {
    // simpleDraggable div
    DraggableOptions o = createOptionsForSimpleDraggable();
    $("#simpleDraggable").as(Draggable).draggable(o);
  }

  private DraggableOptions createOptionsForSimpleDraggable() {
    DraggableOptions o = new DraggableOptions();
    o.setOnDragStart(new DragFunction() {
      public void f(DragContext context) {
        startCounter++;
        $("#startCounter").html("" + startCounter);

      }
    });

    o.setOnDrag(new DragFunction() {
      public void f(DragContext context) {
        dragCounter++;
        $("#dragCounter").html("" + dragCounter);
      }
    });

// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/DraggableOptions.java
// public interface DragFunction {
//   public void f(DragContext context);
// }
// 
// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/events/DragContext.java
// public class DragContext {
// 
//   static final String VALUE_KEY = "__dragAndDropCellAssociatedValue";
// 
//   private Element draggable;
// 
//   private List<Element> selectedDraggables;
// 
//   private Element initialDraggable;
// 
// 
//   /**
//    * Constructor
//    *
//    * @param draggable the draggable element
//    */
//   public DragContext(Element draggable, Element initialDraggable,
//                      List<Element> selectedDraggable) {
//     this.draggable = draggable;
//     this.selectedDraggables = selectedDraggable;
//     this.initialDraggable = initialDraggable;
//   }
// 
//   public DragContext(DragContext ctx) {
//     this(ctx.getDraggable(), ctx.getInitialDraggable(), ctx
//         .getSelectedDraggables());
//   }
// 
//   /**
//    * @return the draggable DOM element
//    */
//   public Element getDraggable() {
//     return draggable;
//   }
// 
//   /**
//    * This method allows getting the data object linked to the draggable element
//    * (a cell) in the context of CellWidget.It return the data object being
//    * rendered by the dragging cell. Return null if we are not in the context of
//    * an drag and drop cell widget.
//    *
//    * @param <T> the class of the data
//    * @return
//    */
//   @SuppressWarnings("unchecked")
//   public <T> T getDraggableData() {
//     return (T) $(getDraggable()).data(VALUE_KEY);
//   }
// 
//   /**
//    * This method return the widget associated to the draggable DOM element if it
//    * exist. It returns null otherwise.
//    */
//   public DraggableWidget<?> getDraggableWidget() {
//     if (getDraggable() != null) {
//       return DraggableWidget.get(getDraggable());
//     }
//     return null;
//   }
// 
//   /**
//    * @return the DOM element used for dragging display
//    */
//   public Element getHelper() {
//     DraggableHandler handler = DraggableHandler.getInstance(draggable);
// 
//     if (handler.getHelper() != null) {
//       return handler.getHelper().get(0);
//     }
//     return null;
//   }
// 
//   /**
//    * @return the {@link Offset} of the helper element.
//    */
//   public Offset getHelperPosition() {
//     return DraggableHandler.getInstance(draggable).getPosition();
//   }
// 
//   /**
//    * @return the list of selected draggables.
//    */
//   public List<Element> getSelectedDraggables() {
//     return selectedDraggables;
//   }
// 
//   /**
//    * @return the draggable element that initiate the drag operation (i.e. the
//    *         clicked element)
//    */
//   public Element getInitialDraggable() {
//     return initialDraggable;
//   }
// 
// 
// }
// 
// Path: plugin/src/main/java/gwtquery/plugins/draggable/client/Draggable.java
// public static final Class<Draggable> Draggable = Draggable.class;


// Path: sample/src/main/java/gwtquery/plugins/draggable/client/DraggableSample1.java
import com.google.gwt.core.client.EntryPoint;
import gwtquery.plugins.draggable.client.DraggableOptions.DragFunction;
import gwtquery.plugins.draggable.client.events.DragContext;
import static com.google.gwt.query.client.GQuery.$;
import static gwtquery.plugins.draggable.client.Draggable.Draggable;

/*
 * Copyright 2010 The gwtquery plugins team.
 *
 * 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 gwtquery.plugins.draggable.client;



/**
 * Simple sample
 *
 * @author Julien Dramaix (julien.dramaix@gmail.com)
 */
public class DraggableSample1 implements EntryPoint {

  private int startCounter = 0;
  private int dragCounter = 0;
  private int stopCounter = 0;

  public void onModuleLoad() {
    // simpleDraggable div
    DraggableOptions o = createOptionsForSimpleDraggable();
    $("#simpleDraggable").as(Draggable).draggable(o);
  }

  private DraggableOptions createOptionsForSimpleDraggable() {
    DraggableOptions o = new DraggableOptions();
    o.setOnDragStart(new DragFunction() {
      public void f(DragContext context) {
        startCounter++;
        $("#startCounter").html("" + startCounter);

      }
    });

    o.setOnDrag(new DragFunction() {
      public void f(DragContext context) {
        dragCounter++;
        $("#dragCounter").html("" + dragCounter);
      }
    });

    o.setOnDragStop(new DragFunction() {