Coverage Report - org.argouml.uml.diagram.deployment.ui.UMLDeploymentDiagram
 
Classes in this File Line Coverage Branch Coverage Complexity
UMLDeploymentDiagram
50%
76/152
19%
20/102
2.969
 
 1  
 /* $Id: UMLDeploymentDiagram.java 17857 2010-01-12 19:59:07Z linus $
 2  
  *****************************************************************************
 3  
  * Copyright (c) 2009 Contributors - see below
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    bobtarling
 11  
  *****************************************************************************
 12  
  *
 13  
  * Some portions of this file was previously release using the BSD License:
 14  
  */
 15  
 
 16  
 // Copyright (c) 2003-2008 The Regents of the University of California. All
 17  
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 18  
 // software and its documentation without fee, and without a written
 19  
 // agreement is hereby granted, provided that the above copyright notice
 20  
 // and this paragraph appear in all copies.  This software program and
 21  
 // documentation are copyrighted by The Regents of the University of
 22  
 // California. The software program and documentation are supplied "AS
 23  
 // IS", without any accompanying services from The Regents. The Regents
 24  
 // does not warrant that the operation of the program will be
 25  
 // uninterrupted or error-free. The end-user understands that the program
 26  
 // was developed for research purposes and is advised not to rely
 27  
 // exclusively on the program for any reason.  IN NO EVENT SHALL THE
 28  
 // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 29  
 // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
 30  
 // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 31  
 // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 32  
 // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
 33  
 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 34  
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 35  
 // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 36  
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 37  
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 38  
 
 39  
 package org.argouml.uml.diagram.deployment.ui;
 40  
 
 41  
 import java.awt.Point;
 42  
 import java.awt.Rectangle;
 43  
 import java.beans.PropertyVetoException;
 44  
 import java.util.ArrayList;
 45  
 import java.util.Collection;
 46  
 
 47  
 import javax.swing.Action;
 48  
 
 49  
 import org.apache.log4j.Logger;
 50  
 import org.argouml.i18n.Translator;
 51  
 import org.argouml.model.Facade;
 52  
 import org.argouml.model.Model;
 53  
 import org.argouml.ui.CmdCreateNode;
 54  
 import org.argouml.uml.diagram.DiagramElement;
 55  
 import org.argouml.uml.diagram.DiagramSettings;
 56  
 import org.argouml.uml.diagram.deployment.DeploymentDiagramGraphModel;
 57  
 import org.argouml.uml.diagram.static_structure.ui.FigClass;
 58  
 import org.argouml.uml.diagram.static_structure.ui.FigComment;
 59  
 import org.argouml.uml.diagram.static_structure.ui.FigInterface;
 60  
 import org.argouml.uml.diagram.static_structure.ui.FigPackage;
 61  
 import org.argouml.uml.diagram.ui.ActionSetAddAssociationMode;
 62  
 import org.argouml.uml.diagram.ui.ActionSetMode;
 63  
 import org.argouml.uml.diagram.ui.FigNodeAssociation;
 64  
 import org.argouml.uml.diagram.ui.FigNodeModelElement;
 65  
 import org.argouml.uml.diagram.ui.RadioAction;
 66  
 import org.argouml.uml.diagram.ui.UMLDiagram;
 67  
 import org.argouml.uml.diagram.use_case.ui.FigActor;
 68  
 import org.argouml.uml.diagram.use_case.ui.FigUseCase;
 69  
 import org.argouml.util.ToolBarUtility;
 70  
 import org.tigris.gef.base.LayerPerspective;
 71  
 import org.tigris.gef.base.LayerPerspectiveMutable;
 72  
 import org.tigris.gef.base.ModeCreatePolyEdge;
 73  
 import org.tigris.gef.presentation.FigNode;
 74  
 
 75  
 /**
 76  
  * The base class of the deployment diagram.<p>
 77  
  *
 78  
  * Defines the toolbar, provides for its initialization and provides
 79  
  * constructors for a top level diagram and one within a defined
 80  
  * namespace.<p>
 81  
  *
 82  
  * @author Clemens Eichler
 83  
  */
 84  
 public class UMLDeploymentDiagram extends UMLDiagram {
 85  
     /**
 86  
      * Logger.
 87  
      */
 88  19
     private static final Logger LOG =
 89  
         Logger.getLogger(UMLDeploymentDiagram.class);
 90  
 
 91  
     ////////////////
 92  
     // actions for toolbar
 93  
 
 94  
     private Action actionMNode;
 95  
     private Action actionMNodeInstance;
 96  
     private Action actionMComponent;
 97  
     private Action actionMComponentInstance;
 98  
     private Action actionMClass;
 99  
     private Action actionMInterface;
 100  
     private Action actionMObject;
 101  
     private Action actionMDependency;
 102  
     private Action actionMAssociation;
 103  
     private Action actionMLink;
 104  
     private Action actionAssociation;
 105  
     private Action actionAggregation;
 106  
     private Action actionComposition;
 107  
     private Action actionUniAssociation;
 108  
     private Action actionUniAggregation;
 109  
     private Action actionUniComposition;
 110  
     private Action actionMGeneralization;
 111  
     private Action actionMAbstraction;
 112  
 
 113  
     
 114  
     /**
 115  
      * Constructor.
 116  
      * @deprecated for 0.28 by tfmorris.  Use 
 117  
      * {@link #UMLActivityDiagram(String, Object, GraphModel)}.
 118  
      */
 119  
     @Deprecated
 120  19
     public UMLDeploymentDiagram() {
 121  
         try {
 122  19
             setName(getNewDiagramName());
 123  19
         } catch (PropertyVetoException pve) { }
 124  
         // TODO: All super constrcutors should take a GraphModel
 125  19
         setGraphModel(createGraphModel());
 126  19
     }
 127  
 
 128  
     /**
 129  
      * @param namespace the namespace for the new diagram
 130  
      * @deprecated for 0.28 by tfmorris.  Use 
 131  
      * {@link #UMLActivityDiagram(String, Object, GraphModel)}.
 132  
      */
 133  
     @Deprecated
 134  
     public UMLDeploymentDiagram(Object namespace) {
 135  19
         this();
 136  19
         setNamespace(namespace);
 137  19
     }
 138  
 
 139  
     /**
 140  
      * Method to perform a number of important initializations of a
 141  
      * <em>Deployment Diagram</em>.<p>
 142  
      *
 143  
      * Each diagram type has a similar <em>UMLxxxDiagram</em> class.<p>
 144  
      *
 145  
      * Changed <em>lay</em> from <em>LayerPerspective</em> to
 146  
      * <em>LayerPerspectiveMutable</em>.  This class is a child of
 147  
      * <em>LayerPerspective</em> and was implemented to correct some
 148  
      * difficulties in changing the model. <em>lay</em> is used mainly
 149  
      * in <em>LayerManager</em>(GEF) to control the adding, changing and
 150  
      * deleting layers on the diagram...<p>
 151  
      *
 152  
      * @param handle package from the model
 153  
      * @author psager@tigris.org Jan. 24, 2002
 154  
      */
 155  
     public void setNamespace(Object handle) {
 156  19
         if (!Model.getFacade().isANamespace(handle)) {
 157  0
             LOG.error(
 158  
                 "Illegal argument. Object " + handle + " is not a namespace");
 159  0
             throw new IllegalArgumentException(
 160  
                 "Illegal argument. Object " + handle + " is not a namespace");
 161  
         }
 162  19
         Object m = handle;
 163  19
         boolean init = (null == getNamespace());
 164  19
         super.setNamespace(m);
 165  19
         DeploymentDiagramGraphModel gm = createGraphModel();
 166  19
         gm.setHomeModel(m);
 167  19
         if (init) {
 168  19
             LayerPerspective lay =
 169  
                 new LayerPerspectiveMutable(Model.getFacade().getName(m), gm);
 170  19
             DeploymentDiagramRenderer rend = new DeploymentDiagramRenderer();
 171  19
             lay.setGraphNodeRenderer(rend);
 172  19
             lay.setGraphEdgeRenderer(rend);
 173  19
             setLayer(lay);
 174  
         }
 175  19
     }
 176  
     
 177  
     // TODO: Needs to be tidied up after stable release. Graph model
 178  
     // should be created in constructor
 179  
     private DeploymentDiagramGraphModel createGraphModel() {
 180  38
         if ((getGraphModel() instanceof DeploymentDiagramGraphModel)) {
 181  19
             return (DeploymentDiagramGraphModel) getGraphModel();
 182  
         } else {
 183  19
             return new DeploymentDiagramGraphModel();
 184  
         }
 185  
     }
 186  
 
 187  
     /*
 188  
      * @see org.argouml.uml.diagram.ui.UMLDiagram#getUmlActions()
 189  
      */
 190  
     protected Object[] getUmlActions() {
 191  19
         Object[] actions = {
 192  
             getActionMNode(),
 193  
             getActionMNodeInstance(),
 194  
             getActionMComponent(),
 195  
             getActionMComponentInstance(),
 196  
             getActionMGeneralization(),
 197  
             getActionMAbstraction(),
 198  
             getActionMDependency(),
 199  
             getAssociationActions(),
 200  
             getActionMObject(),
 201  
             getActionMLink(),
 202  
         };
 203  19
         return actions;
 204  
     }
 205  
 
 206  
     private Object[] getAssociationActions() {
 207  19
         Object[][] actions = {
 208  
             {getActionAssociation(), getActionUniAssociation() },
 209  
             {getActionAggregation(), getActionUniAggregation() },
 210  
             {getActionComposition(), getActionUniComposition() },
 211  
         };
 212  19
         ToolBarUtility.manageDefault(actions, "diagram.deployment.association");
 213  19
         return actions;
 214  
     }
 215  
 
 216  
     /**
 217  
      * The UID.
 218  
      */
 219  
     static final long serialVersionUID = -375918274062198744L;
 220  
 
 221  
     /*
 222  
      * @see org.argouml.uml.diagram.ui.UMLDiagram#getLabelName()
 223  
      */
 224  
     public String getLabelName() {
 225  19
         return Translator.localize("label.deployment-diagram");
 226  
     }
 227  
 
 228  
     //////////////////////////////
 229  
     // Getters for plugin modules:
 230  
     //////////////////////////////
 231  
 
 232  
     /**
 233  
      * @return Returns the actionAggregation.
 234  
      */
 235  
     protected Action getActionAggregation() {
 236  19
         if (actionAggregation == null) {
 237  19
             actionAggregation =
 238  
                 new RadioAction(
 239  
                     new ActionSetAddAssociationMode(
 240  
                         Model.getAggregationKind().getAggregate(),
 241  
                         false,
 242  
                         "button.new-aggregation"));
 243  
         }
 244  19
         return actionAggregation;
 245  
     }
 246  
 
 247  
     /**
 248  
      * @return Returns the actionAssociation.
 249  
      */
 250  
     protected Action getActionAssociation() {
 251  19
         if (actionAssociation == null) {
 252  19
             actionAssociation =
 253  
                 new RadioAction(
 254  
                     new ActionSetAddAssociationMode(
 255  
                         Model.getAggregationKind().getNone(),
 256  
                         false,
 257  
                         "button.new-association"));
 258  
         }
 259  19
         return actionAssociation;
 260  
     }
 261  
 
 262  
     /**
 263  
      * @return Returns the actionComposition.
 264  
      */
 265  
     protected Action getActionComposition() {
 266  19
         if (actionComposition == null) {
 267  19
             actionComposition =
 268  
                 new RadioAction(
 269  
                     new ActionSetAddAssociationMode(
 270  
                         Model.getAggregationKind().getComposite(),
 271  
                         false,
 272  
                         "button.new-composition"));
 273  
         }
 274  19
         return actionComposition;
 275  
     }
 276  
 
 277  
     /**
 278  
      * @return Returns the actionMAssociation.
 279  
      */
 280  
     protected Action getActionMAssociation() {
 281  0
         if (actionMAssociation == null) {
 282  0
             actionMAssociation =
 283  
                 new RadioAction(new ActionSetMode(
 284  
                         ModeCreatePolyEdge.class,
 285  
                         "edgeClass",
 286  
                         Model.getMetaTypes().getAssociation(),
 287  
                         "button.new-association"));
 288  
         }
 289  0
         return actionMAssociation;
 290  
     }
 291  
 
 292  
     /**
 293  
      * @return Returns the actionMClass.
 294  
      */
 295  
     protected Action getActionMClass() {
 296  0
         if (actionMClass == null) {
 297  0
             actionMClass =
 298  
                 new RadioAction(
 299  
                         new CmdCreateNode(Model.getMetaTypes().getUMLClass(),
 300  
                                 "button.new-class"));
 301  
         }
 302  0
         return actionMClass;
 303  
     }
 304  
 
 305  
     /**
 306  
      * @return Returns the actionMComponent.
 307  
      */
 308  
     protected Action getActionMComponent() {
 309  19
         if (actionMComponent == null) {
 310  19
             actionMComponent =
 311  
                 new RadioAction(
 312  
                         new CmdCreateNode(
 313  
                                 Model.getMetaTypes().getComponent(),
 314  
                                 "button.new-component"));
 315  
         }
 316  19
         return actionMComponent;
 317  
     }
 318  
 
 319  
     /**
 320  
      * @return Returns the actionMComponentInstance.
 321  
      */
 322  
     protected Action getActionMComponentInstance() {
 323  19
         if (actionMComponentInstance == null) {
 324  19
             actionMComponentInstance =
 325  
                 new RadioAction(new CmdCreateNode(
 326  
                         Model.getMetaTypes().getComponentInstance(),
 327  
                         "button.new-componentinstance"));
 328  
         }
 329  19
         return actionMComponentInstance;
 330  
     }
 331  
 
 332  
     /**
 333  
      * @return Returns the actionMDependency.
 334  
      */
 335  
     protected Action getActionMDependency() {
 336  19
         if (actionMDependency == null) {
 337  19
             actionMDependency =
 338  
                 new RadioAction(new ActionSetMode(
 339  
                         ModeCreatePolyEdge.class,
 340  
                         "edgeClass",
 341  
                         Model.getMetaTypes().getDependency(),
 342  
                         "button.new-dependency"));
 343  
         }
 344  19
         return actionMDependency;
 345  
     }
 346  
 
 347  
     /**
 348  
      * @return Returns the actionMGeneralization.
 349  
      */
 350  
     protected Action getActionMGeneralization() {
 351  19
         if (actionMGeneralization == null) {
 352  19
             actionMGeneralization =
 353  
                 new RadioAction(new ActionSetMode(
 354  
                         ModeCreatePolyEdge.class,
 355  
                         "edgeClass",
 356  
                         Model.getMetaTypes().getGeneralization(),
 357  
                         "button.new-generalization"));
 358  
         }
 359  19
         return actionMGeneralization;
 360  
     }
 361  
 
 362  
     /**
 363  
      * @return Returns the actionMAbstraction.
 364  
      */
 365  
     protected Action getActionMAbstraction() {
 366  19
         if (actionMAbstraction == null) {
 367  19
             actionMAbstraction =
 368  
                 new RadioAction(new ActionSetMode(
 369  
                         ModeCreatePolyEdge.class,
 370  
                         "edgeClass",
 371  
                         Model.getMetaTypes().getAbstraction(),
 372  
                         "button.new-realization"));
 373  
         }
 374  19
         return actionMAbstraction;
 375  
     }
 376  
 
 377  
     /**
 378  
      * @return Returns the actionMInterface.
 379  
      */
 380  
     protected Action getActionMInterface() {
 381  0
         if (actionMInterface == null) {
 382  0
             actionMInterface =
 383  
                 new RadioAction(
 384  
                         new CmdCreateNode(
 385  
                                 Model.getMetaTypes().getInterface(),
 386  
                                 "button.new-interface"));
 387  
         }
 388  0
         return actionMInterface;
 389  
     }
 390  
 
 391  
     /**
 392  
      * @return Returns the actionMLink.
 393  
      */
 394  
     protected Action getActionMLink() {
 395  19
         if (actionMLink == null) {
 396  19
             actionMLink =
 397  
                 new RadioAction(new ActionSetMode(
 398  
                         ModeCreatePolyEdge.class,
 399  
                         "edgeClass",
 400  
                         Model.getMetaTypes().getLink(),
 401  
                         "button.new-link"));
 402  
         }
 403  19
         return actionMLink;
 404  
     }
 405  
 
 406  
     /**
 407  
      * @return Returns the actionMNode.
 408  
      */
 409  
     protected Action getActionMNode() {
 410  19
         if (actionMNode == null) {
 411  19
             actionMNode =
 412  
                 new RadioAction(new CmdCreateNode(
 413  
                     Model.getMetaTypes().getNode(),
 414  
                     "button.new-node"));
 415  
         }
 416  19
         return actionMNode;
 417  
     }
 418  
 
 419  
     /**
 420  
      * @return Returns the actionMNodeInstance.
 421  
      */
 422  
     protected Action getActionMNodeInstance() {
 423  19
         if (actionMNodeInstance == null) {
 424  19
             actionMNodeInstance =
 425  
                 new RadioAction(new CmdCreateNode(
 426  
                     Model.getMetaTypes().getNodeInstance(),
 427  
                     "button.new-nodeinstance"));
 428  
         }
 429  19
         return actionMNodeInstance;
 430  
     }
 431  
 
 432  
     /**
 433  
      * @return Returns the actionMObject.
 434  
      */
 435  
     protected Action getActionMObject() {
 436  19
         if (actionMObject == null) {
 437  19
             actionMObject =
 438  
                 new RadioAction(
 439  
                         new CmdCreateNode(Model.getMetaTypes().getObject(),
 440  
                                 "button.new-object"));
 441  
         }
 442  19
         return actionMObject;
 443  
     }
 444  
 
 445  
     /**
 446  
      * @return Returns the actionUniAggregation.
 447  
      */
 448  
     protected Action getActionUniAggregation() {
 449  19
         if (actionUniAggregation == null) {
 450  19
             actionUniAggregation =
 451  
                 new RadioAction(
 452  
                     new ActionSetAddAssociationMode(
 453  
                         Model.getAggregationKind().getAggregate(),
 454  
                         true, "button.new-uniaggregation"));
 455  
         }
 456  19
         return actionUniAggregation;
 457  
     }
 458  
 
 459  
     /**
 460  
      * @return Returns the actionUniAssociation.
 461  
      */
 462  
     protected Action getActionUniAssociation() {
 463  19
         if (actionUniAssociation == null) {
 464  19
             actionUniAssociation =
 465  
                 new RadioAction(
 466  
                     new ActionSetAddAssociationMode(
 467  
                         Model.getAggregationKind().getNone(),
 468  
                         true, "button.new-uniassociation"));
 469  
         }
 470  19
         return actionUniAssociation;
 471  
     }
 472  
 
 473  
     /**
 474  
      * @return Returns the actionUniComposition.
 475  
      */
 476  
     protected Action getActionUniComposition() {
 477  19
         if (actionUniComposition == null) {
 478  19
             actionUniComposition =
 479  
                 new RadioAction(
 480  
                     new ActionSetAddAssociationMode(
 481  
                         Model.getAggregationKind().getComposite(),
 482  
                         true, "button.new-unicomposition"));
 483  
         }
 484  19
         return actionUniComposition;
 485  
     }
 486  
 
 487  
     /*
 488  
      * @see org.argouml.uml.diagram.ui.UMLDiagram#isRelocationAllowed(java.lang.Object)
 489  
      */
 490  
     public boolean isRelocationAllowed(Object base)  {
 491  0
         return Model.getFacade().isAPackage(base);
 492  
     }
 493  
 
 494  
     @SuppressWarnings("unchecked")
 495  
     public Collection getRelocationCandidates(Object root) {
 496  0
         return 
 497  
         Model.getModelManagementHelper().getAllModelElementsOfKindWithModel(
 498  
             root, Model.getMetaTypes().getPackage());
 499  
     }
 500  
 
 501  
     /*
 502  
      * @see org.argouml.uml.diagram.ui.UMLDiagram#relocate(java.lang.Object)
 503  
      */
 504  
     public boolean relocate(Object base) {
 505  0
         setNamespace(base);
 506  0
         damage();
 507  0
         return true;
 508  
     }
 509  
     
 510  
     /**
 511  
      * Provides the standard functionality of the superclass only for
 512  
      * deployment diagram specific model elements
 513  
      * @param modelElement the model element
 514  
      * @param namespace the namespace (or null for diagram)
 515  
      * @see org.argouml.uml.diagram.ui.UMLDiagram#setModelElementNamespace(java.lang.Object, Object)
 516  
      */
 517  
     public void setModelElementNamespace(
 518  
             Object modelElement, 
 519  
             Object namespace) {
 520  0
         Facade facade = Model.getFacade();
 521  0
         if (facade.isANode(modelElement)
 522  
                 || facade.isANodeInstance(modelElement)
 523  
                 || facade.isAComponent(modelElement)
 524  
                 || facade.isAComponentInstance(modelElement)) {
 525  0
             LOG.info("Setting namespace of " + modelElement);
 526  0
             super.setModelElementNamespace(modelElement, namespace);
 527  
         }
 528  0
     }
 529  
 
 530  
     /*
 531  
      * If the new encloser is null, and the old one is a Component, 
 532  
      * then the "enclosed" Fig has been moved on the diagram.
 533  
      * This causes the model to be adapted as follows:
 534  
      * remove the elementResidence 
 535  
      * between the "enclosed" and the oldEncloser.
 536  
      * 
 537  
      * @see org.argouml.ui.ArgoDiagram#changeFigEncloser(org.tigris.gef.presentation.FigNode, org.tigris.gef.presentation.FigNode, org.tigris.gef.presentation.FigNode)
 538  
      */
 539  
     public void encloserChanged(FigNode enclosed, FigNode oldEncloser, 
 540  
             FigNode newEncloser) {
 541  0
         if (oldEncloser != null && newEncloser == null
 542  
                 && Model.getFacade().isAComponent(oldEncloser.getOwner())) {
 543  0
             Collection<Object> er1 = Model.getFacade().getElementResidences(
 544  
                     enclosed.getOwner());
 545  0
             Collection er2 = Model.getFacade().getResidentElements(
 546  
                     oldEncloser.getOwner());
 547  0
             Collection<Object> common = new ArrayList<Object>(er1);
 548  0
             common.retainAll(er2);
 549  0
             for (Object elementResidence : common) {
 550  0
                 Model.getUmlFactory().delete(elementResidence);
 551  
             }
 552  
         }
 553  0
     }
 554  
     
 555  
     @Override
 556  
     public boolean doesAccept(Object objectToAccept) {
 557  0
         if (Model.getFacade().isANode(objectToAccept)) {
 558  0
             return true;
 559  0
         } else if (Model.getFacade().isAAssociation(objectToAccept)) {
 560  0
             return true;
 561  0
         } else if (Model.getFacade().isANodeInstance(objectToAccept)) {
 562  0
             return true;
 563  0
         } else if (Model.getFacade().isAComponent(objectToAccept)) {
 564  0
             return true;
 565  0
         } else if (Model.getFacade().isAComponentInstance(objectToAccept)) {
 566  0
             return true;
 567  0
         } else if (Model.getFacade().isAClass(objectToAccept)) {
 568  0
             return true;
 569  0
         } else if (Model.getFacade().isAInterface(objectToAccept)) {
 570  0
             return true;
 571  0
         } else if (Model.getFacade().isAObject(objectToAccept)) {
 572  0
             return true;
 573  0
         } else if (Model.getFacade().isAComment(objectToAccept)) {
 574  0
             return true;
 575  0
         } else if (Model.getFacade().isAActor(objectToAccept)) {
 576  0
             return true;
 577  
         }
 578  0
         return false;
 579  
     }
 580  
     
 581  
 
 582  
     public DiagramElement createDiagramElement(
 583  
             final Object modelElement,
 584  
             final Rectangle bounds) {
 585  
         
 586  0
         FigNodeModelElement figNode = null;
 587  
         
 588  0
         DiagramSettings settings = getDiagramSettings();
 589  
         
 590  0
         if (Model.getFacade().isANode(modelElement)) {
 591  0
             figNode = new FigMNode(modelElement, bounds, settings);
 592  0
         } else if (Model.getFacade().isAAssociation(modelElement)) {
 593  0
             figNode =
 594  
                 createNaryAssociationNode(modelElement, bounds, settings);
 595  0
         } else if (Model.getFacade().isANodeInstance(modelElement)) {
 596  0
             figNode = new FigNodeInstance(modelElement, bounds, settings);
 597  0
         } else if (Model.getFacade().isAComponent(modelElement)) {
 598  0
             figNode = new FigComponent(modelElement, bounds, settings);
 599  0
         } else if (Model.getFacade().isAComponentInstance(modelElement)) {
 600  0
             figNode = new FigComponentInstance(modelElement, bounds, settings);
 601  0
         } else if (Model.getFacade().isAClass(modelElement)) {
 602  0
             figNode = new FigClass(modelElement, bounds, settings);
 603  0
         } else if (Model.getFacade().isAInterface(modelElement)) {
 604  0
             figNode = new FigInterface(modelElement, bounds, settings);
 605  0
         } else if (Model.getFacade().isAObject(modelElement)) {
 606  0
             figNode = new FigObject(modelElement, bounds, settings);
 607  0
         } else if (Model.getFacade().isAActor(modelElement)) {
 608  0
             figNode = new FigActor(modelElement, bounds, settings);
 609  0
         } else if (Model.getFacade().isAComment(modelElement)) {
 610  0
             figNode = new FigComment(modelElement, bounds, settings);
 611  
         }
 612  
         
 613  0
         if (figNode != null) {
 614  0
             LOG.debug("Model element " + modelElement + " converted to " 
 615  
                     + figNode);
 616  
         } else {
 617  0
             LOG.debug("Dropped object NOT added " + figNode);
 618  
         }
 619  0
         return figNode;
 620  
     }
 621  
 }