<commit_before>package org.pentaho.ui.xul.gwt.util;

import com.allen_sauer.gwt.dnd.client.DragContext;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.allen_sauer.gwt.dnd.client.VetoDragException;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import org.pentaho.gwt.widgets.client.dialogs.GlassPane;
import org.pentaho.gwt.widgets.client.dialogs.GlassPaneListener;
import org.pentaho.gwt.widgets.client.ui.Draggable;

/**
 * User: nbaker
 * Date: Aug 5, 2010
 */
public class XulDragController extends PickupDragController {

  private Widget proxy;
  private static XulDragController instance;

  public Widget getProxy() {
    return proxy;
  }

  public void setProxy(Widget proxy) {
    this.proxy = proxy;
  }

  private XulDragController(AbsolutePanel panel) {
    super(panel, false);
    setBehaviorDragProxy(true);
    setBehaviorDragStartSensitivity(5);
  }

  public static XulDragController getInstance(){
    if(instance == null){
      final AbsolutePanel panel = new AbsolutePanel();
      panel.setHeight("100%");
      panel.setWidth("100%");
      panel.getElement().getStyle().setProperty("position", "absolute");
      panel.getElement().getStyle().setProperty("top", "0px");
      panel.getElement().getStyle().setProperty("left", "0px");
      panel.getElement().getStyle().setProperty("display", "none");
      RootPanel.get().add(panel);
      instance = new XulDragController(panel);
      GlassPane.getInstance().addGlassPaneListener(new GlassPaneListener(){
        public void glassPaneShown() throws Exception {
          panel.setVisible(true);
        }

        public void glassPaneHidden() throws Exception {
          panel.setVisible(false);
        }
      });

    }
    return instance;
  }

  @Override
  protected void restoreSelectedWidgetsStyle() {
  }

  @Override
  protected void saveSelectedWidgetsLocationAndStyle() {
  }

  @Override
  protected void restoreSelectedWidgetsLocation() {
  }

  @Override
  public void dragEnd() {
    proxy.removeFromParent();
    proxy = null;
    super.dragEnd();
  }


  @Override
  protected Widget newDragProxy(DragContext context) {
    proxy = ((Draggable) context.draggable).makeProxy(context.draggable);
    return proxy;
  }


  @Override
  public void previewDragEnd() throws VetoDragException {
    super.previewDragEnd();
    
  }

  public Object getDragObject(){
    return ((Draggable) context.draggable).getDragObject();
  }

}<commit_msg>[BISERVER-4679] Backing out Drag Controller again<commit_after>package org.pentaho.ui.xul.gwt.util;

import com.allen_sauer.gwt.dnd.client.DragContext;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.allen_sauer.gwt.dnd.client.VetoDragException;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import org.pentaho.gwt.widgets.client.ui.Draggable;

/**
 * User: nbaker
 * Date: Aug 5, 2010
 */
public class XulDragController extends PickupDragController {

  private Widget proxy;
  private static XulDragController instance = new XulDragController();

  public Widget getProxy() {
    return proxy;
  }

  public void setProxy(Widget proxy) {
    this.proxy = proxy;
  }

  private XulDragController() {
    super(RootPanel.get(), false);
    setBehaviorDragProxy(true);
    setBehaviorDragStartSensitivity(5);
  }

  public static XulDragController getInstance(){
    return instance;
  }

  @Override
  protected void restoreSelectedWidgetsStyle() {
  }

  @Override
  protected void saveSelectedWidgetsLocationAndStyle() {
  }

  @Override
  protected void restoreSelectedWidgetsLocation() {
  }

  @Override
  public void dragEnd() {
    proxy.removeFromParent();
    proxy = null;
    super.dragEnd();
  }


  @Override
  protected Widget newDragProxy(DragContext context) {
    proxy = ((Draggable) context.draggable).makeProxy(context.draggable);
    return proxy;
  }


  @Override
  public void previewDragEnd() throws VetoDragException {
    super.previewDragEnd();

  }

  public Object getDragObject(){
    return ((Draggable) context.draggable).getDragObject();
  }

}
{'fraction_non_alphanumeric': 0.1140027637033625, 'fraction_numerical': 0.0055274067250115156, 'mean_word_length': 3.9919540229885055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '830510', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1336, 'n_words': 251}