package gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.util.SC;
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.ClickHandler;
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.setNoDoubleClicks(true);
    drawPane.addDrawHandler(new DrawHandler() {
      public void onDraw(DrawEvent event) {
        DrawLine line = new DrawLine();
        line.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            SC.logWarn("Got a click");
          }
        });
        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();
  }
}
