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.support.relationshipVerification;
043:
044: import org.netbeans.modules.uml.common.generics.ETPairT;
045: import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
046: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
047: import org.netbeans.modules.uml.core.metamodel.core.foundation.IPresentationElement;
048: import org.netbeans.modules.uml.core.metamodel.diagrams.IDiagram;
049: import org.netbeans.modules.uml.core.support.umlsupport.IETPoint;
050: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IETNode;
051:
052: /**
053: *
054: * @author Trey Spiva
055: */
056: public interface INodeVerification {
057: /**
058: * Creates the appropriate metatype for this node.
059: *
060: * @param pDiagram The current diagram
061: * @param pCreatedNode The node that just got created
062: * @param pNamespace The namespace the new node should be in
063: * @param metaTypeString The metatype string of the new element
064: * @param sInitializationString The initialization string of the node that was just created.
065: * @return A pair that contains that conitains the IElement and a
066: * presentation reference relationship is created between the
067: * referencing presentation element and the PresentationElement to
068: * be created. If no referencing presentation element exist then
069: * <code>null</code> will be returned.
070: */
071: public ETPairT<IElement, IPresentationElement> createAndVerify(
072: IDiagram pDiagram, IETNode pCreatedNode,
073: INamespace pNamespace, String metaTypeString,
074: String sInitializationString);
075:
076: /**
077: * Creates the appropriate metatype for this node.
078: *
079: * @param pDiagram The current diagram
080: * @param pCreatedNode The node that just got created
081: * @param pNamespace The namespace the new node should be in, can be null.
082: * @return A pair that contains that conitains the IElement and a
083: * presentation reference relationship is created between the
084: * referencing presentation element and the PresentationElement to
085: * be created. If no referencing presentation element exist then
086: * <code>null</code> will be returned.
087: */
088: public ETPairT<IElement, IPresentationElement> createAndVerify(
089: IDiagram pDiagram, IETNode pCreatedNode,
090: INamespace pNamespace);
091:
092: /**
093: * Verifies that this node is valid at this point. Fired by the diagram
094: * add node tool. If the node requires a node to node relationship the
095: * actual location will be different then the location passed into the method.
096: *
097: * @param pDiagram The diagram to verify the location.
098: * @param location The location to verify.
099: * @return <code>true</code> if the location if valid, <code>false</code>
100: * otherwise.
101: */
102: public boolean verifyCreationLocation(IDiagram pDiagram,
103: IETPoint location);
104:
105: /**
106: * During the creation process this is fired when the node is dragged around.
107: * Fired by the diagram add node tool.
108: */
109: public boolean verifyDragDuringCreation(IDiagram pDiagram,
110: IETNode pCreatedNode, IETPoint location);
111: }
|