Coverage Report - org.argouml.uml.diagram.static_structure.ui.FigSignal
 
Classes in this File Line Coverage Branch Coverage Complexity
FigSignal
0%
0/28
0%
0/2
1.25
 
 1  
 /* $Id: FigSignal.java 17753 2010-01-11 19:49:55Z linus $
 2  
  *******************************************************************************
 3  
  * Copyright (c) 2010 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  
  *    Tom Morris
 11  
  *    Bob Tarling
 12  
  *******************************************************************************
 13  
  *
 14  
  * Some portions of this file was previously release using the BSD License:
 15  
  */
 16  
 // $Id: FigSignal.java 17753 2010-01-11 19:49:55Z linus $
 17  
 // Copyright (c) 2007-2009 The Regents of the University of California. All
 18  
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 19  
 // software and its documentation without fee, and without a written
 20  
 // agreement is hereby granted, provided that the above copyright notice
 21  
 // and this paragraph appear in all copies.  This software program and
 22  
 // documentation are copyrighted by The Regents of the University of
 23  
 // California. The software program and documentation are supplied "AS
 24  
 // IS", without any accompanying services from The Regents. The Regents
 25  
 // does not warrant that the operation of the program will be
 26  
 // uninterrupted or error-free. The end-user understands that the program
 27  
 // was developed for research purposes and is advised not to rely
 28  
 // exclusively on the program for any reason.  IN NO EVENT SHALL THE
 29  
 // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 30  
 // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
 31  
 // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 32  
 // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 33  
 // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
 34  
 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 35  
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 36  
 // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 37  
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 38  
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 39  
 
 40  
 package org.argouml.uml.diagram.static_structure.ui;
 41  
 
 42  
 import java.awt.Rectangle;
 43  
 import java.awt.event.MouseEvent;
 44  
 import java.util.Vector;
 45  
 
 46  
 import org.argouml.uml.diagram.DiagramSettings;
 47  
 import org.argouml.uml.diagram.ui.FigAttributesCompartment;
 48  
 import org.tigris.gef.base.Selection;
 49  
 
 50  
 /**
 51  
  * Class to display graphics for a UML Signal in a diagram.
 52  
  * <p>
 53  
  * A Signal has a keyword "signal", possibly some stereotypes, and a name. 
 54  
  * It may also have attributes - the UML standard document 
 55  
  * contains an example diagram showing this.
 56  
  * A Signal may have operations.
 57  
  * 
 58  
  * @author Tom Morris
 59  
  */
 60  
 public class FigSignal extends FigClassifierBox {
 61  
 
 62  
     /**
 63  
      * Construct a Fig representing a Signal.
 64  
      * 
 65  
      * @param owner owning Signal
 66  
      * @param bounds position and size
 67  
      * @param settings render settings
 68  
      */
 69  
     public FigSignal(Object owner, Rectangle bounds, DiagramSettings settings) {
 70  0
         super(owner, bounds, settings);
 71  0
         constructFigs(bounds);
 72  0
     }
 73  
 
 74  
     private void constructFigs(Rectangle bounds) {
 75  0
         enableSizeChecking(false);
 76  0
         setSuppressCalcBounds(true);
 77  
 
 78  0
         getStereotypeFig().setKeyword("signal");
 79  0
         getStereotypeFig().setVisible(true);
 80  
         /* The next line is needed so that we have the right dimension 
 81  
          * when drawing this Fig on the diagram by pressing down 
 82  
          * the mouse button, even before releasing the mouse button: */
 83  0
         getNameFig().setTopMargin(
 84  
                 getStereotypeFig().getMinimumSize().height);
 85  
 
 86  0
         addFig(getBigPort());
 87  0
         addFig(getNameFig());
 88  
         /* Stereotype covers NameFig: */
 89  0
         addFig(getStereotypeFig());
 90  
         /* Compartments from top to bottom: */
 91  0
         addFig(new FigAttributesCompartment(
 92  
                 getOwner(),
 93  
                 DEFAULT_COMPARTMENT_BOUNDS, 
 94  
                 getSettings()));
 95  0
         addFig(getOperationsFig());
 96  
 
 97  
         // Make all the parts match the main fig
 98  0
         setFilled(true);
 99  0
         setFillColor(FILL_COLOR);
 100  0
         setLineColor(LINE_COLOR);
 101  0
         setLineWidth(LINE_WIDTH);
 102  
         
 103  
         // by default, do not show operations nor attributes:
 104  0
         setOperationsVisible(false);
 105  0
         setAttributesVisible(false);
 106  
 
 107  
         /* Set the drop location in the case of D&D: */
 108  0
         if (bounds != null) {
 109  0
             setLocation(bounds.x, bounds.y);
 110  
         }
 111  
 
 112  0
         setSuppressCalcBounds(false);
 113  0
         setBounds(getBounds());
 114  0
         enableSizeChecking(true);
 115  0
     }
 116  
     
 117  
     @Override
 118  
     public Selection makeSelection() {
 119  0
         return new SelectionSignal(this);
 120  
     }
 121  
 
 122  
     @Override
 123  
     public Vector getPopUpActions(MouseEvent me) {
 124  0
         Vector popUpActions = super.getPopUpActions(me);
 125  
         
 126  
         // TODO: Do we have anything to add here?
 127  
 
 128  0
         return popUpActions;
 129  
     }
 130  
 
 131  
 }