public void registerLink(MindMapLink link)
            throws java.lang.IllegalArgumentException {
        if ((link.getSource() == null) || (link.getTarget() == null)
                || (link.getDestinationLabel() == null))
            throw new java.lang.IllegalArgumentException(
                    "Illegal link specification." + link);
        MindMapNode source = link.getSource();
        MindMapNode target = link.getTarget();
        logger.fine("Register link (" + link + ") from source node:" + source
                + " to target " + target);
        String id = _registerLinkTarget(target);
        Vector vec = getAssignedLinksVector(id);
        // already present?
        for (int i = 0; i < vec.size(); ++i) {
            if (vec.get(i) == link)
                return;
        }
        vec.add(link);
        String uniqueId = link.getUniqueId();
        if (uniqueId == null) {
            ((LinkAdapter) link).setUniqueId(generateUniqueLinkId(uniqueId));
            uniqueId = link.getUniqueId();
        }
        if (mIdToLink.containsKey(uniqueId)) {
            if (mIdToLink.get(uniqueId) != link) {
                logger.warning("link with duplicated unique id found:" + link);
                // new id:
                ((LinkAdapter) link)
                        .setUniqueId(generateUniqueLinkId(uniqueId));
            }
        }
        mIdToLink.put(link.getUniqueId(), link);
    }