Coverage Report - org.argouml.uml.diagram.state.ui.FigJoinState
 
Classes in this File Line Coverage Branch Coverage Complexity
FigJoinState
0%
0/37
0%
0/2
1.071
 
 1  
 /* $Id: FigJoinState.java 18728 2010-09-10 09:29:47Z mvw $
 2  
  *****************************************************************************
 3  
  * Copyright (c) 2009-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  
  *    Michiel van der Wulp
 11  
  *****************************************************************************
 12  
  *
 13  
  * Some portions of this file was previously release using the BSD License:
 14  
  */
 15  
 
 16  
 // Copyright (c) 1996-2009 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.state.ui;
 40  
 
 41  
 import java.awt.Color;
 42  
 import java.awt.Rectangle;
 43  
 import java.awt.event.MouseEvent;
 44  
 import java.util.Iterator;
 45  
 
 46  
 import org.argouml.uml.diagram.DiagramSettings;
 47  
 import org.tigris.gef.presentation.Fig;
 48  
 import org.tigris.gef.presentation.FigRect;
 49  
 
 50  
 /**
 51  
  * Class to display graphics for a UML Join State in a diagram.
 52  
  *
 53  
  * @author jrobbins
 54  
  */
 55  
 public class FigJoinState extends FigStateVertex {
 56  
 
 57  
     private static final int X = X0;
 58  
     private static final int Y = Y0;
 59  
     private static final int STATE_WIDTH = 80;
 60  
     private static final int HEIGHT = 7;
 61  
 
 62  
     private FigRect head;
 63  
 
 64  
 
 65  
     /**
 66  
      * Construct a new FigJoinState.
 67  
      * 
 68  
      * @param owner owning UML element
 69  
      * @param bounds position and size
 70  
      * @param settings rendering settings
 71  
      */
 72  
     public FigJoinState(Object owner, Rectangle bounds,
 73  
             DiagramSettings settings) {
 74  0
         super(owner, bounds, settings);
 75  0
         initFigs();
 76  0
     }
 77  
 
 78  
     @Override
 79  
     protected Fig createBigPortFig() {
 80  0
         return new FigRect(X, Y, STATE_WIDTH, HEIGHT, DEBUG_COLOR,
 81  
                 DEBUG_COLOR);
 82  
     }
 83  
 
 84  
     private void initFigs() {
 85  0
         setEditable(false);
 86  0
         head = new FigRect(X, Y, STATE_WIDTH, HEIGHT, LINE_COLOR,
 87  
                 SOLID_FILL_COLOR);
 88  
         // add Figs to the FigNode in back-to-front order
 89  0
         addFig(getBigPort());
 90  0
         addFig(head);
 91  
 
 92  0
         setBlinkPorts(false); //make port invisible unless mouse enters
 93  0
     }
 94  
 
 95  
     /*
 96  
      * @see java.lang.Object#clone()
 97  
      */
 98  
     @Override
 99  
     public Object clone() {
 100  0
         FigJoinState figClone = (FigJoinState) super.clone();
 101  0
         Iterator it = figClone.getFigs().iterator();
 102  0
         figClone.setBigPort((FigRect) it.next());
 103  0
         figClone.head = (FigRect) it.next();
 104  0
         return figClone;
 105  
     }
 106  
 
 107  
     /*
 108  
      * @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
 109  
      */
 110  
     @Override
 111  
     protected void setStandardBounds(int x, int y, int w, int h) {
 112  0
         Rectangle oldBounds = getBounds();
 113  0
         if (w > h) {
 114  0
             h = HEIGHT;
 115  
         } else {
 116  0
             w = HEIGHT;
 117  
         }
 118  0
         getBigPort().setBounds(x, y, w, h);
 119  0
         head.setBounds(x, y, w, h);
 120  
 
 121  0
         calcBounds();
 122  0
         updateEdges();
 123  0
         firePropChange("bounds", oldBounds, getBounds());
 124  0
     }
 125  
 
 126  
     /*
 127  
      * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)
 128  
      */
 129  
     @Override
 130  
     public void setLineColor(Color col) {
 131  0
         head.setLineColor(col);
 132  0
     }
 133  
 
 134  
     /*
 135  
      * @see org.tigris.gef.presentation.Fig#getLineColor()
 136  
      */
 137  
     @Override
 138  
     public Color getLineColor() {
 139  0
         return head.getLineColor();
 140  
     }
 141  
 
 142  
     /*
 143  
      * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)
 144  
      */
 145  
     @Override
 146  
     public void setFillColor(Color col) {
 147  0
         head.setFillColor(col);
 148  0
     }
 149  
 
 150  
     /*
 151  
      * @see org.tigris.gef.presentation.Fig#getFillColor()
 152  
      */
 153  
     @Override
 154  
     public Color getFillColor() {
 155  0
         return head.getFillColor();
 156  
     }
 157  
 
 158  
     /**
 159  
      * Ignored - figure has fixed rendering
 160  
      * @param f ignored
 161  
      */
 162  
     @Override
 163  
     public void setFilled(boolean f) {
 164  
         // ignored
 165  0
     }
 166  
 
 167  
 
 168  
     @Override
 169  
     public boolean isFilled() {
 170  0
         return true;
 171  
     }
 172  
 
 173  
     /*
 174  
      * @see org.tigris.gef.presentation.Fig#setLineWidth(int)
 175  
      */
 176  
     @Override
 177  
     public void setLineWidth(int w) {
 178  0
         head.setLineWidth(w);
 179  0
     }
 180  
 
 181  
     /*
 182  
      * @see org.tigris.gef.presentation.Fig#getLineWidth()
 183  
      */
 184  
     @Override
 185  
     public int getLineWidth() {
 186  0
         return head.getLineWidth();
 187  
     }
 188  
 
 189  
     /*
 190  
      * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
 191  
      */
 192  
     @Override
 193  
     public void mouseClicked(MouseEvent me) {
 194  
         // ignored
 195  0
     }
 196  
 
 197  
     /**
 198  
      * The UID.
 199  
      */
 200  
     static final long serialVersionUID = 2075803883819230367L;
 201  
 
 202  
 }