001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * EllipseReportElement.java
028: *
029: * Created on 28 febbraio 2003, 22.42
030: *
031: */
032:
033: package it.businesslogic.ireport;
034:
035: import it.businesslogic.ireport.gui.*;
036: import it.businesslogic.ireport.util.*;
037: import java.awt.*;
038: import java.awt.image.*;
039: import java.awt.geom.*;
040:
041: public class EllipseReportElement extends GraphicReportElement {
042: public EllipseReportElement(int x, int y, int width, int height) {
043: super (x, y, width, height);
044: //graphicElementPen = "Thin";
045: //this.bgcolor = Color.WHITE;
046: //this.fgcolor = Color.BLACK;
047: setKey("ellipse");
048: }
049:
050: public void drawObject(Graphics2D g, double zoom_factor,
051: int x_shift_origin, int y_shift_origin) {
052:
053: position.x -= 10;
054: position.y -= 10;
055: x_shift_origin -= 10;
056: y_shift_origin -= 10;
057:
058: this .zoom_factor = zoom_factor;
059:
060: g.setColor(getBgcolor());
061: if (!getTransparent().equalsIgnoreCase("Transparent"))
062: g.fillOval(getZoomedDim(position.x) - x_shift_origin,
063: getZoomedDim(position.y) - y_shift_origin,
064: getZoomedDim(width), getZoomedDim(height));
065:
066: position.x += 10;
067: position.y += 10;
068: x_shift_origin += 10;
069: y_shift_origin += 10;
070:
071: drawGraphicsElement(g, this .getGraphicElementPen(),
072: zoom_factor, x_shift_origin, y_shift_origin);
073: }
074:
075: public ReportElement cloneMe() {
076: EllipseReportElement newReportElement = new EllipseReportElement(
077: position.x, position.y, width, height);
078: copyBaseReportElement(newReportElement, this );
079:
080: return newReportElement;
081: }
082:
083: public void drawGraphicsElement(Graphics2D g, String pen,
084: double zoom_factor, int x_shift_origin, int y_shift_origin) {
085:
086: Stroke stroke = getPenStroke(pen, zoom_factor);
087: g.setColor(getFgcolor());
088:
089: this .zoom_factor = zoom_factor;
090: if (stroke == null || pen.equalsIgnoreCase("None"))
091: return;
092:
093: position.x -= 10;
094: position.y -= 10;
095: x_shift_origin -= 10;
096: y_shift_origin -= 10;
097:
098: Stroke oldStroke = g.getStroke();
099: g.setStroke(stroke);
100: g.drawOval(getZoomedDim(position.x) - x_shift_origin,
101: getZoomedDim(position.y) - y_shift_origin,
102: getZoomedDim(width), getZoomedDim(height));
103:
104: position.x += 10;
105: position.y += 10;
106:
107: g.setStroke(oldStroke);
108: }
109: }
|