Example #1
0
File: VNode.java Project: AKSW/SAIM
  public void addValue1(VCytoprocess vcypro, String name, Double value) {
    if (LOG) VConsole.log("VNode: addValue1");

    if (label1 == null) {

      if (!name.trim().isEmpty()) {
        label1 =
            vcypro.text(name + ": " + value, shape.getX(), shape.getY() + label.getTextHeight());

        setStyle(label, label1);
        value1 = value;
      }
    } else if (!name.trim().isEmpty()) label1.setText(name + ": " + value);

    bringToFront(vcypro.getCanvas());
  }
Example #2
0
File: VNode.java Project: AKSW/SAIM
  public static VNode createVNode(
      VVisualStyle vs,
      VCytoprocess vcytoprocess,
      int x,
      int y,
      int id,
      String label,
      int nodeViewShape,
      String rgb) {

    // set color
    String tmp = vcytoprocess.getFillStyle();
    if (!rgb.trim().isEmpty()) vcytoprocess.setFill(rgb);
    vcytoprocess.strokeWeight(Integer.valueOf(vs.NODE_LINE_WIDTH));
    vcytoprocess.setStroke(vs.NODE_BORDER_COLOR);
    // draw node
    Shape shape = null;
    switch (nodeViewShape) {
      case RECTANGLE:
        shape = (Shape) vcytoprocess.rectangle(x, y, vs.nodeSize, vs.nodeSize / 2);
        break;
      case DIAMOND:
        shape = (Shape) vcytoprocess.diamond(x, y, vs.nodeSize, vs.nodeSize);
        break;
      case HEXAGON:
        shape = (Shape) vcytoprocess.hexagon(x, y, vs.nodeSize / 2f);
        break;
      case ELLIPSE:
      default:
        shape = (Shape) vcytoprocess.circle(x, y, vs.nodeSize / 2f);
    }

    // reset color
    if (!rgb.trim().isEmpty()) vcytoprocess.setFill(tmp);

    // draw label
    Text text = vcytoprocess.text(label, 0, 0);
    setStyle(text, vs);

    VNode vnode = new VNode(id, shape, text);
    vnode.updatePosition();

    return vnode;
  }
Example #3
0
File: VNode.java Project: AKSW/SAIM
 /** deletes objects from canvas */
 public void delete(VCytoprocess vcypro) {
   vcypro.remove(shape);
   vcypro.remove(label);
   if (label1 != null) vcypro.remove(label1);
   if (label2 != null) vcypro.remove(label2);
 }