Clover coverage report - Maven Clover report
Coverage timestamp: Thu Oct 11 2007 08:41:48 CEST
file stats: LOC: 88   Methods: 5
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UMLStateDiagramEndStatePanel.java - 0% 0% 0%
coverage
 1    /*
 2    * Copyright (C) 2007 Eric MIGNOT - mignots.eric@free.fr
 3    *
 4    * This library is free software; you can redistribute it and/or
 5    * modify it under the terms of the GNU Lesser General Public
 6    * License as published by the Free Software Foundation; either
 7    * version 2.1 of the License, or (at your option) any later version.
 8    *
 9    * This library is distributed in the hope that it will be useful,
 10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12    * Lesser General Public License for more details.
 13    *
 14    * You should have received a copy of the GNU Lesser General Public
 15    * License along with this library; if not, write to the Free Software
 16    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18   
 19    package org.ericmignot.modeler.util.graphic;
 20   
 21    import java.awt.*;
 22   
 23    import javax.swing.JPanel;
 24   
 25    public class UMLStateDiagramEndStatePanel extends JPanel
 26    {
 27    private int fixedSize;
 28    private Color fillColor;
 29    private Color drawColor;
 30    private Color ringBackgroundColor;
 31    private int internalGap;
 32   
 33  0 public UMLStateDiagramEndStatePanel(
 34    Color ringBackgroundColor,
 35    Color fillColor,
 36    Color drawColor,
 37    int size,
 38    int internalGap)
 39    {
 40  0 this.ringBackgroundColor = ringBackgroundColor;
 41  0 this.fillColor = fillColor;
 42  0 this.drawColor = drawColor;
 43  0 this.fixedSize = size;
 44  0 this.internalGap = internalGap;
 45    }
 46   
 47  0 public Color getBackground()
 48    {
 49  0 return this.fillColor;
 50    }
 51   
 52  0 public Color getForeground()
 53    {
 54  0 return this.drawColor;
 55    }
 56   
 57  0 public Dimension getPreferredSize()
 58    {
 59  0 return new Dimension(fixedSize, fixedSize);
 60    }
 61   
 62  0 public void paintComponent(Graphics g)
 63    {
 64  0 int width = this.getSize().width;
 65  0 int x = (width - this.fixedSize ) / 2;
 66  0 int height = this.getSize().height;
 67  0 int y = (height - this.fixedSize) / 2;
 68   
 69  0 Color oldColor = g.getColor();
 70   
 71  0 Graphics2D g2d = (Graphics2D) g;
 72  0 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 73   
 74  0 g.setColor(this.ringBackgroundColor);
 75  0 g.fillOval(x, y, this.fixedSize-1, this.fixedSize-1);
 76  0 g.setColor(this.drawColor);
 77  0 g.drawOval(x, y, this.fixedSize-1, this.fixedSize-1);
 78  0 g.setColor(this.fillColor);
 79  0 g.fillOval(x + this.internalGap, y + this.internalGap, this.fixedSize-1 - 2*this.internalGap , this.fixedSize-1 - 2*this.internalGap);
 80  0 g.setColor(this.drawColor);
 81  0 g.drawOval(x + this.internalGap, y + this.internalGap, this.fixedSize-1 - 2*this.internalGap, this.fixedSize-1 - 2*this.internalGap);
 82   
 83  0 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
 84  0 g.setColor(oldColor);
 85   
 86    }
 87   
 88    }