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.events.DrawEvent;
import com.smartgwt.client.widgets.events.DrawHandler;
import com.smartgwt.client.widgets.events.ScrolledEvent;
import com.smartgwt.client.widgets.events.ScrolledHandler;

public class ScrollTest implements EntryPoint {
  private DrawPane drawPane;
  
  public void onModuleLoad() {
    drawPane = new DrawPane();
    drawPane.addDrawHandler(new DrawHandler() {
      public void onDraw(DrawEvent event) {
        DrawLine drawLine = new DrawLine();
        drawLine.setDrawPane(drawPane);
        drawLine.setStartPoint(new Point(500,0));
        drawLine.setEndPoint(new Point(500,1000));
        drawLine.setLineColor("#ff0000");
        drawLine.setLineWidth(20);
        drawLine.draw();

        drawLine = new DrawLine();
        drawLine.setDrawPane(drawPane);
        drawLine.setStartPoint(new Point(0,500));
        drawLine.setEndPoint(new Point(1000,500));
        drawLine.setLineColor("#00ff00");
        drawLine.setLineWidth(20);
        drawLine.draw();
      }
    });
    drawPane.addScrolledHandler(new ScrolledHandler() {
      public void onScrolled(ScrolledEvent event) {
        SC.logWarn("Got a scrolled event");
      }
    });
    drawPane.setCanDragScroll(true);
    drawPane.setEdgeSize(5);
    drawPane.setEdgeOpacity(25);
    drawPane.setShowEdges(true);
    drawPane.setZoomLevel(2.0);
    drawPane.setWidth(500);
    drawPane.setHeight(500);
    drawPane.draw();    
  }
}
