Exemple #1
0
 private void initializeCanvas() {
   panel.setSize(50 + 1 + graphWidth + "px", 25 + graphHeight + "px");
   canvas.setWidth(graphWidth);
   canvas.setHeight(graphHeight);
   canvas.getElement().getStyle().setPropertyPx("width", graphWidth);
   canvas.getElement().getStyle().setPropertyPx("height", graphHeight);
 }
Exemple #2
0
 /**
  * The constructor should first call super() to initialize the component and then handle any
  * initialization relevant to Vaadin.
  */
 public VCytographer() {
   panel = new FocusPanel();
   panel.setSize(graphWidth + "px", graphHeight + "px");
   panel.addKeyDownHandler(this);
   panel.addKeyUpHandler(this);
   canvas = new VFocusDrawingArea(this, graphWidth, graphHeight);
   canvas.addKeyDownHandler(this);
   canvas.addKeyUpHandler(this);
   canvas.addMouseMoveHandler(this);
   canvas.addDoubleClickHandler(this);
   canvas.addMouseUpHandler(this);
   canvas.addMouseDownHandler(this);
   canvas.addClickHandler(this);
   canvas.addMouseWheelHandler(this);
   graph = new VGraph(this, style, canvas, graphWidth, graphHeight);
   panel.add(canvas);
   canvas.add(graph);
   initWidget(panel);
   setStyleName(CLASSNAME);
   DOM.setStyleAttribute(canvas.getElement(), "border", "1px solid black");
   disableContextMenu(canvas.getElement());
 }