001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.ui.products.ad.diagramengines.sequencediagram;
043:
044: import org.netbeans.modules.uml.common.generics.ETPairT;
045: import org.netbeans.modules.uml.core.metamodel.core.foundation.IPresentationElement;
046: import org.netbeans.modules.uml.core.metamodel.dynamics.IInteractionOperand;
047: import org.netbeans.modules.uml.core.metamodel.dynamics.IMessage;
048: import org.netbeans.modules.uml.core.support.umlutils.ETList;
049: import org.netbeans.modules.uml.ui.products.ad.ADDrawEngines.IADNodeDrawEngine;
050: import org.netbeans.modules.uml.ui.products.ad.compartments.sequencediagram.IADLifelineCompartment;
051: import com.tomsawyer.drawing.TSConnector;
052: import com.tomsawyer.editor.TSEConnector;
053: import com.tomsawyer.editor.TSEEdge;
054: import com.tomsawyer.graph.TSEdge;
055:
056: /**
057: * @author sumitabhk
058: *
059: */
060: public interface ILifelineDrawEngine extends IADNodeDrawEngine {
061: enum InsertMessageEnum {
062: /** Inserts the edge after all other edges on the lifeline. */
063: ADD_END,
064:
065: /** Inserts a new edge after a specified message. */
066: ADD_AFTER,
067:
068: /** Inserts a new edge before a specified message. */
069: ADD_BEFORE
070: };
071:
072: /** Returns a connector for the target end of create message edge */
073: public TSConnector getConnectorForCreateMessage();
074:
075: /** Moves this draw engine so the create message, if it exists, is horizontal */
076: public void makeCreateMessageHorizontal();
077:
078: /** Find 1st message below the logicial vertical location on the draw engine's diagram */
079: public IMessage findFirstMessageBelow(int lY);
080:
081: /** Find 1st message above the logicial vertical location on the draw engine's diagram */
082: public IMessage findFirstMessageAbove(int lY);
083:
084: /** Creates a return message on the bottom of the pieces connected to the input connectors */
085: public void createReturnMessage(TSEEdge synchronousEdge,
086: IMessage synchronousMessage,
087: IInteractionOperand interactionOperand,
088: IMessage beforeMessage);
089:
090: /** Creates a message, type determined by the input message, to the other draw engine */
091: public ETPairT<IMessageEdgeDrawEngine, Integer> createMessage(
092: IMessage pMessage, ILifelineDrawEngine pToEngine,
093: int plVerticalLocation);
094:
095: /** Returns true when there are messages attached to the lifeline */
096: public boolean hasMessagesAttached();
097:
098: /** Returns true when the lifeline is terminated by a destroy element */
099: public boolean isDestroyed();
100:
101: /** Removes any incoming operations, and messages if desired, from this lifeline */
102: public void removeIncomingOperations(
103: boolean bRemoveAssociatedMessages);
104:
105: /** Returns all the message to self edges that are part of this lifeline */
106: public ETList<IPresentationElement> getAllMessageToSelfs();
107:
108: /** Retrieves the lifeline compartment for the draw engine. */
109: public IADLifelineCompartment getLifelineCompartment();
110:
111: /** Returns true when the lifeline is created on this diagram (has a create message attached) */
112: public boolean isCreated();
113:
114: public void insertMessageBefore(ILifelineDrawEngine to,
115: int msgType, IMessageEdgeDrawEngine relativeMessage);
116:
117: public void insertMessageAfter(ILifelineDrawEngine to, int msgType,
118: IMessageEdgeDrawEngine relativeMessage);
119:
120: public void addDestroyMessage();
121:
122: public void addMessageToSelf(IMessageEdgeDrawEngine targetMsg,
123: boolean before);
124:
125: public void addCreateMessage(IMessageEdgeDrawEngine targetMsg,
126: boolean before);
127: }
|