Package ptolemy.vergil.kernel

Examples of ptolemy.vergil.kernel.Link


            // those we are connected to.
            List portLinkList = new LinkedList();
            Iterator links = _linkSet.iterator();

            while (links.hasNext()) {
                Link link = (Link) links.next();
                Object head = link.getHead();

                if ((head != null) && head.equals(location)) {
                    portLinkList.add(link);
                }
            }
View Full Code Here


            // those we are connected to.
            List portLinkList = new LinkedList();
            Iterator links = _linkSet.iterator();

            while (links.hasNext()) {
                Link link = (Link) links.next();
                Object tail = link.getTail();

                if ((tail != null) && tail.equals(location)) {
                    portLinkList.add(link);
                }
            }
View Full Code Here

        public synchronized void startUpdate() {
            Set<?> linkSet = _getLinkSet();
            Set<Link> linksToRemove = new HashSet<Link>();
            for (Object linkObject : linkSet) {
                Link link = (Link) linkObject;
                boolean headOK = GraphUtilities.isContainedNode(link.getHead(),
                        getRoot(), this);
                boolean tailOK = GraphUtilities.isContainedNode(link.getTail(),
                        getRoot(), this);
                if (!(headOK && tailOK)) {
                    linksToRemove.add(link);
                }
            }
View Full Code Here

     *  If the connector is not known, then return -1.
     @param connector The connector.
     *  @return The order index of the connection.
     */
    public int getOrderIndex(LinkManhattanConnector connector) {
        Link link = connector.getLink();
        ComponentRelation relation = link.getRelation();
        List relations;

        if (_inside) {
            relations = _port.insideRelationList();
        } else {
View Full Code Here

         @param tailSite The tail site.
         *  @param headSite The head site.
         *  @return The Connector that represents the edge.
         */
        public Connector render(Object edge, Site tailSite, Site headSite) {
            Link link = (Link) edge;
            ManhattanConnector connector = new LinkManhattanConnector(tailSite,
                    headSite, link);

            if ((link.getHead() != null) && (link.getTail() != null)) {
                connector.setLineWidth((float) 2.0);
            }

            connector.setUserObject(edge);

            // The default bend radius of 50 is too large...
            // parallel curves look bad.
            connector.setBendRadius(20);

            Relation relation = link.getRelation();

            if (relation != null) {
                String tipText = relation.getName();
                String displayName = relation.getDisplayName();
                if (!tipText.equals(displayName)) {
View Full Code Here

         * @param evt The connector event.
         */
        public void connectorDropped(ConnectorEvent evt) {
            Connector c = evt.getConnector();
            Figure f = evt.getTarget();
            Link link = (Link) c.getUserObject();
            Object node = (f == null) ? null : f.getUserObject();
            ActorGraphModel model = (ActorGraphModel) getController()
                    .getGraphModel();

            switch (evt.getEnd()) {
            case ConnectorEvent.HEAD_END:
                if (node == link.getTail()) {
                    MessageHandler
                            .error("Cannot link both ends to the same object.");
                    // FIXME: The panner needs to repaint.  How to get it to do that?
                    return;
                }
                model.getLinkModel().setHead(link, node);
                break;

            case ConnectorEvent.TAIL_END:
                if (node == link.getHead()) {
                    MessageHandler
                            .error("Cannot link both ends to the same object.");
                    // FIXME: The panner needs to repaint.  How to get it to do that?
                    return;
                }
                model.getLinkModel().setTail(link, node);
                break;

            default:
                throw new IllegalStateException(
                        "Cannot handle both ends of an edge being dragged.");
            }

            // Set the width correctly, so we know whether or not it
            // is connected.  Note that this happens *after* the model
            // is modified.
            if ((link.getHead() != null) && (link.getTail() != null)) {
                ((ManhattanConnector) c).setLineWidth((float) 2.0);
            } else {
                ((ManhattanConnector) c).setLineWidth((float) 1.0);
            }
        }
View Full Code Here

TOP

Related Classes of ptolemy.vergil.kernel.Link

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.