Package DisplayProject.controls

Source Code of DisplayProject.controls.Ellipse$qq_Resolver

/*
Copyright (c) 2003-2008 ITerative Consulting Pty Ltd. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

o Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
 
o Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
   
o This jcTOOL Helper Class software, whether in binary or source form may not be used within,
or to derive, any other product without the specific prior written permission of the copyright holder

 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


*/
package DisplayProject.controls;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;

import DisplayProject.UIutils;
import Framework.CloneHelper;
/**
* The Ellipse class defines ellipses. Ellipses are graphics.  The ellipse position and dimension information is in terms of a rectangle surrounding the ellipse. An ellipse�s height, width, and position reflect the coordinate specifications of the enclosing rectangle.
*/
@SuppressWarnings("serial")
public class Ellipse extends Shape {
    public static class qq_Resolver {
        public static final int cFILLCOLOR_PENCOLOR = 1;
        public static final int cPENCOLOR_FILLCOLOR = 2;
    }

    public Ellipse()
    {
        this(10,10);
    }

    public Ellipse( int x, int y)
    {
        this.setSize( x, y );
        this.setPreferredSize( new Dimension( x, y ) );
      // TF:15/12/2009:DET-141:Set this up to allow inheriting of popup menu
      this.setInheritsPopupMenu(true);
    }

    public Ellipse( int x, int y, Color fcolor, Color bcolor )
    {
        this(x, y);
        this.setForeground(fcolor);
        this.setBackground(bcolor);
    }

    public Ellipse( int color1, int color2, int resolver )
    {
        this();
        switch (resolver){
        case qq_Resolver.cFILLCOLOR_PENCOLOR:
            this.setForeground(UIutils.forteToJavaColor(color2));
            this.setBackground(UIutils.forteToJavaColor(color1));
            break;
        case qq_Resolver.cPENCOLOR_FILLCOLOR:
            this.setForeground(UIutils.forteToJavaColor(color1));
            this.setBackground(UIutils.forteToJavaColor(color2));
            break;
        }
    }

    public void paintComponent(Graphics g) {
//        int lineWidth = 1;
//        switch (this.lineWeight){
//            case Constants.W_DEFAULT:
//                lineWidth = 1;
//                break;
//            case Constants.W_ONEPIXEL:
//                lineWidth = 1;
//                break;
//            case Constants.W_TWOPIXELS:
//                lineWidth = 2;
//                break;
//            case Constants.W_THREEPIXELS:
//                lineWidth = 3;
//                break;
//            case Constants.W_VERYTHIN:
//                lineWidth = 1;
//                break;
//            case Constants.W_THIN:
//                lineWidth = 2;
//                break;
//            case Constants.W_MEDIUM:
//                lineWidth = 3;
//                break;
//            case Constants.W_HEAVY:
//                lineWidth = 4;
//                break;
//            case Constants.W_VERYHEAVY:
//                lineWidth = 5;
//                break;
//        }
        Insets insets = this.getInsets();
        g.setColor( this.getBackground() );
        if (isOpaque())
            g.fillOval(insets.left, insets.top, this.getWidth() - insets.left + insets.right, this.getHeight() - insets.top + insets.bottom );
        else
            g.drawOval(insets.left, insets.top, this.getWidth() - insets.left + insets.right, this.getHeight() - insets.top + insets.bottom );
        g.setColor( this.getForeground() );
        Graphics2D g2d = (Graphics2D)g;
        g2d.setStroke(UIutils.makeStroke(this.lineWeight, this.lineStyle));
        g2d.drawOval(insets.left,
                insets.top,
                this.getWidth() - insets.left + insets.right - 1,
                this.getHeight() - insets.top + insets.bottom - 1);
    }
    public Ellipse cloneComponent(){
        Ellipse clone = new Ellipse();
        CloneHelper.cloneComponent(this, clone, new String[]{"parent"});
        return clone;
    }
}

TOP

Related Classes of DisplayProject.controls.Ellipse$qq_Resolver

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.