pertdependency.java

来自「JHotDraw学习过程中对数组的测试程序haha 学习过程中对数组的测试程序」· Java 代码 · 共 63 行

JAVA
63
字号
/* * @(#)PertDependency.java 5.1 * */package CH.ifa.draw.samples.pert;import java.awt.*;import java.util.*;import java.io.IOException;import CH.ifa.draw.framework.*;import CH.ifa.draw.figures.*;import CH.ifa.draw.standard.*;public class PertDependency extends LineConnection {    /*     * Serialization support.     */    private static final long serialVersionUID = -7959500008698525009L;    private int pertDependencySerializedDataVersion = 1;    public PertDependency() {        setEndDecoration(new ArrowTip());        setStartDecoration(null);    }    public void handleConnect(Figure start, Figure end) {        PertFigure source = (PertFigure)start;        PertFigure target = (PertFigure)end;        if (source.hasCycle(target)) {            setAttribute("FrameColor", Color.red);        } else {            target.addPreTask(source);            source.addPostTask(target);            source.notifyPostTasks();        }    }    public void handleDisconnect(Figure start, Figure end) {        PertFigure source = (PertFigure)start;        PertFigure target = (PertFigure)end;        if (target != null) {            target.removePreTask(source);            target.updateDurations();        }        if (source != null)            source.removePostTask(target);   }    public boolean canConnect(Figure start, Figure end) {        return (start instanceof PertFigure && end instanceof PertFigure);    }    public Vector handles() {        Vector handles = super.handles();        // don't allow to reconnect the starting figure        handles.setElementAt(            new NullHandle(this, PolyLineFigure.locator(0)), 0);        return handles;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?