public void AddChild (CGNode n, CGArrow a) { childs.addElement (n); arrows.addElement (a); Rectangle pos = Bbox(); a.MoveTailTo (pos.x + pos.width - 1, pos.y + pos.height/2); }
public void SetParent (CGNode n, CGArrow a) { parent = n; arrow = a; if (arrow != null) { Rectangle pos = Bbox(); arrow.MoveHeadTo (pos.x, pos.y + pos.height/2); } }
public void Move (int xinc, int yinc) { AutoUpdateOff (); super.Move (xinc, yinc); for (int i = arrows.size()-1; i >= 0; --i) { ((CGArrow)arrows.elementAt(i)).MoveTail (xinc, yinc); } if (arrow != null) arrow.MoveHead (xinc, yinc); AutoUpdateOn (); }
private void Drag (MouseEvent ev) { switch (state) { case stateDrag: curnode.Move (ev.getX() - dragx, ev.getY() - dragy); dragx = ev.getX(); dragy = ev.getY(); break; case stateCreate: curarrow.MoveHeadTo (ev.getX(), ev.getY()); break; } }