package gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.JavaScriptObject;
import com.smartgwt.client.widgets.drawing.DrawLine;
import com.smartgwt.client.widgets.drawing.DrawPane;
import com.smartgwt.client.widgets.drawing.Point;
import com.smartgwt.client.widgets.drawing.events.ClickEvent;
import com.smartgwt.client.widgets.drawing.events.DoubleClickEvent;
import com.smartgwt.client.widgets.drawing.events.DoubleClickHandler;
import com.smartgwt.client.widgets.events.DrawEvent;
import com.smartgwt.client.widgets.events.DrawHandler;

public class DoubleClickTest implements EntryPoint {
  private DrawPane drawPane;

  public void onModuleLoad() {
    drawPane = new DrawPane();
    drawPane.addDrawHandler(new DrawHandler() {
      public void onDraw(DrawEvent event) {
        DrawLine line = new DrawLine();
        line.addDoubleClickHandler(new DoubleClickHandler() {
          public void onDoubleClick(DoubleClickEvent event) {
            Object source = event.getSource();
            new ClickEvent((JavaScriptObject)source);
          }
        });
        line.setDrawPane(drawPane);
        line.setStartPoint(new Point(0,0));
        line.setEndPoint(new Point(750,750));
        line.setLineWidth(10);
        line.setFillColor("#ff0000");
        line.setLineColor("#ff0000");
        line.draw();
      }     
    });
    drawPane.setWidth(1200);
    drawPane.setHeight(750);
    drawPane.draw();
  }
}
