示例#1
0
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);
    }
示例#2
0
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);
        }
    }
示例#3
0
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 ();
    }
示例#4
0
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;
        }
    }