001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.soa.mapper.basicmapper.canvas.jgo;
021:
022: import com.nwoods.jgo.JGoPort;
023: import org.netbeans.modules.soa.mapper.common.basicmapper.canvas.gtk.ICanvasFieldNode;
024: import org.netbeans.modules.soa.mapper.common.basicmapper.canvas.gtk.ICanvasNodeToNodeLink;
025: import org.netbeans.modules.soa.mapper.common.basicmapper.canvas.gtk.ICanvasView;
026: import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IFieldNode;
027: import org.netbeans.modules.soa.mapper.common.IMapperLink;
028:
029: /**
030: * <p>
031: *
032: * Title: </p> BasicCanvasNodeToNodeLink<p>
033: *
034: * Description: </p> BasicCanvasNodeToNodeLink provides basic implemanation of
035: * ICanvasNodeToNodeLink. <p>
036: *
037: * @author Un Seng Leong
038: * @created January 2, 2003
039: */
040: public class BasicCanvasNodeToNodeLink extends AbstractCanvasLink
041: implements ICanvasNodeToNodeLink {
042:
043: /**
044: * the end canvas node
045: */
046: private ICanvasFieldNode mDestCanvasNode;
047:
048: /**
049: * the start canvas node
050: */
051: private ICanvasFieldNode mSourceCanvasNode;
052:
053: /**
054: * Creates a new BasicCanvasNodeToNodeLink object.
055: *
056: * @param link the mapper link
057: */
058: public BasicCanvasNodeToNodeLink(IMapperLink link) {
059: super (link);
060: this .setArrowHeads(false, true);
061: initializeArrowHeads(this );
062: }
063:
064: /**
065: * Return the canvas field node repersetns the start point of this link.
066: *
067: * @return the canvas field node repersetns the start point of this link.
068: */
069: public ICanvasFieldNode getDestFieldNode() {
070: return mDestCanvasNode;
071: }
072:
073: /**
074: * Return the canvas field node repersetns the end point of this link.
075: *
076: * @return the canvas node repersetns the end point of this link.
077: */
078: public ICanvasFieldNode getSourceFieldNode() {
079: return mSourceCanvasNode;
080: }
081:
082: /**
083: * Set the canvas contains this canvas link.
084: *
085: * @param canvas the canvas contains this canvas link.
086: */
087: public void setMapperCanvas(ICanvasView canvas) {
088: super .setMapperCanvas(canvas);
089:
090: mSourceCanvasNode = canvas
091: .findCanvasFieldNode((IFieldNode) getMapperLink()
092: .getStartNode());
093:
094: mDestCanvasNode = canvas
095: .findCanvasFieldNode((IFieldNode) getMapperLink()
096: .getEndNode());
097:
098: if ((mSourceCanvasNode != null) && (mDestCanvasNode != null)) {
099: startPort = (JGoPort) mSourceCanvasNode
100: .getConnectPointObject();
101: endPort = (JGoPort) mDestCanvasNode.getConnectPointObject();
102: this .setFromPort(startPort);
103: this .setToPort(endPort);
104: }
105:
106: if (getMapperCanvas().isPathHighlightingEnabled()) {
107: boolean isHighlighting = new NetworkHighlightDetector(this )
108: .isHighlightDetected();
109: new NetworkHighlightTraverser(isHighlighting).visit(this);
110: }
111: }
112: }
|