连线问题(2)--多个组件连接一个组件

      开发Bug库 2005-8-16 8:40
在以前实现了一个组件连接多个组件,但是现在还需要多个个组件连接一个组件。
主要思想:在组件中,是否能连接多条连线应该在ConnectionCommand中设置,主要对canExecute方法进行处理。
    public boolean canExecute() {
//        if (target != null) {
//            Vector conns = target.getConnections();
//            Iterator i = conns.iterator();
//            while (i.hasNext()) {
//                Wire conn = (Wire) i.next();
//                if (targetTerminal != null && conn.getTargetTerminal() != null)
//                    if (conn.getTarget().equals(target) && conn.getSource().equals(source))
//                        return false;
//            }
//        }
        return true;
    }

在注释掉的部分,进行修改。
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}