package gwt.client;

import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.drawing.DrawLabel;
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.events.DrawEvent;

public class DrawHandler implements com.smartgwt.client.widgets.events.DrawHandler {
  DrawPane drawPane;
  
  public DrawHandler(DrawPane drawPane) {
    super();
    this.drawPane = drawPane;
  }

  public void onDraw(DrawEvent event) {
    SC.logInfo("In DrawHandler.onDraw");
    DrawLine drawLine = new DrawLine();
    drawLine.setDrawPane(drawPane);
    drawLine.addClickHandler(new ClickHandler());
    drawLine.setEndArrow(null);
    drawLine.setStartPoint(new Point(0,0));
    drawLine.setStartArrow(null);
    drawLine.setEndPoint(new Point(750,750));
    drawLine.setLineWidth(10);
    drawLine.draw();
    
    DrawLabel label = new DrawLabel();
    label.setDrawPane(drawPane);
    label.setEventOpaque(false);
    label.setContents("Test");
    label.setFontSize(75);
    label.setCenterPoint(375, 375);
    label.setLineColor("black");
    label.draw();
  }
}
