コード例 #1
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
  /** Called whenever an update is received from the server */
  @Override
  public void updateFromUIDL(final UIDL uidl, final ApplicationConnection client) {
    if (client.updateComponent(this, uidl, true)) {
      return;
    }
    this.client = client;
    paintableId = uidl.getId();
    currentKeyModifiers = new HashSet<Integer>();
    final String operation = uidl.getStringAttribute("operation");

    if ("REPAINT".equals(operation)) {
      repaint(uidl);
    } else if ("SET_NODE_SIZE".equals(operation)) {
      style.setNodeSize(uidl.getIntAttribute("ns") / 2);
      graph.updateGraphProperties(style);
      paintGraph();
    } else if ("SET_VISUAL_STYLE".equals(operation)) {
      graph.updateGraphProperties(style);
      paintGraph();
    } else if ("SET_TEXT_VISIBILITY".equals(operation)) {
      style.setTextsVisible(uidl.getBooleanAttribute("texts"));
      graph.updateGraphProperties(style);
      paintGraph();
    } else if ("SET_OPTIMIZED_STYLES".equals(operation)) {
      graph.paintGraph();
    } else if ("UPDATE_NODE".equals(operation)) {
      graph.updateNode(uidl, uidl.getStringAttribute("node"));
    } else if ("SET_ZOOM".equals(operation)) {
      setZoom(uidl.getIntAttribute("zoom"));
    } else if ("REFRESH".equals(operation)) {
      refresh(uidl);
    } else {
      repaint(uidl);
    }
  }
コード例 #2
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
 private void repaint(final UIDL uidl) {
   graphWidth = uidl.getIntAttribute("gwidth");
   graphHeight = uidl.getIntAttribute("gheight");
   centerX = graphWidth / 2f;
   centerY = graphHeight / 2f;
   zoomFactor = 0;
   style.parseGeneralStyleAttributesFromUidl(uidl);
   initializeCanvas();
   graph.repaintGraph(uidl);
 }
コード例 #3
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
  private VectorObject getInfo() {
    final NumberFormat df = NumberFormat.getDecimalFormat();
    final String zoom = df.format(zoomFactor);
    final String angl = df.format(angle);
    final String fpss = df.format(fps);

    final Text info =
        new Text(canvas.getWidth() - 130, 10, "Zoom: " + zoom + " Rot.: " + angl + " Fps " + fpss);
    info.setStrokeOpacity(0);
    info.setFillColor(style.getEdgeColor());
    info.setFontSize(8);
    return info;
  }
コード例 #4
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
 private Line getLinkLine(final int x, final int y) {
   final Line linkLine = new Line((int) startX, (int) startY, x, y);
   linkLine.setStrokeColor(style.getEdgeColor());
   linkLine.setStrokeOpacity(0.55);
   return linkLine;
 }
コード例 #5
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
 private void refresh(final UIDL uidl) {
   style.parseGeneralStyleAttributesFromUidl(uidl);
   graph.refreshGraphFromUIDL(uidl);
 }