KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > base > JRBaseGraphicElement


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.base;
29
30 import net.sf.jasperreports.engine.JRConstants;
31 import net.sf.jasperreports.engine.JRGraphicElement;
32 import net.sf.jasperreports.engine.util.JRStyleResolver;
33
34
35 /**
36  * This class provides functionality common to graphic elements. It provides implementation for the methods described
37  * in <tt>JRTextElement</tt>.
38  * @author Teodor Danciu (teodord@users.sourceforge.net)
39  * @version $Id: JRBaseGraphicElement.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
40  */

41 public abstract class JRBaseGraphicElement extends JRBaseElement implements JRGraphicElement
42 {
43
44
45     /**
46      *
47      */

48     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
49
50     /**
51      *
52      */

53     protected Byte JavaDoc pen;
54     protected Byte JavaDoc fill;
55
56
57     /**
58      * Constructs an empty graphic element. By default graphic elements are opaque.
59      *
60     protected JRBaseGraphicElement()
61     {
62         super();
63     }
64         
65
66     /**
67      * Initializes properties that are specific to graphic elements. Common properties are initialized by its
68      * parent constructor.
69      * @param graphicElement an element whose properties are copied to this element. Usually it is a
70      * {@link net.sf.jasperreports.engine.design.JRDesignGraphicElement} that must be transformed into an
71      * <tt>JRBaseGraphicElement</tt> at compile time.
72      * @param factory a factory used in the compile process
73      */

74     protected JRBaseGraphicElement(JRGraphicElement graphicElement, JRBaseObjectFactory factory)
75     {
76         super(graphicElement, factory);
77         
78         pen = graphicElement.getOwnPen();
79         fill = graphicElement.getOwnFill();
80     }
81         
82
83     /**
84      *
85      */

86     public byte getPen()
87     {
88         return JRStyleResolver.getPen(this, PEN_1_POINT);
89     }
90         
91     public Byte JavaDoc getOwnPen()
92     {
93         return this.pen;
94     }
95
96     /**
97      *
98      */

99     public void setPen(byte pen)
100     {
101         this.pen = new Byte JavaDoc(pen);
102     }
103         
104     /**
105      *
106      */

107     public void setPen(Byte JavaDoc pen)
108     {
109         this.pen = pen;
110     }
111         
112     /**
113      *
114      */

115     public byte getFill()
116     {
117         return JRStyleResolver.getFill(this, FILL_SOLID);
118     }
119
120     public Byte JavaDoc getOwnFill()
121     {
122         return this.fill;
123     }
124     
125     /**
126      *
127      */

128     public void setFill(byte fill)
129     {
130         this.fill = new Byte JavaDoc(fill);
131     }
132     
133     /**
134      *
135      */

136     public void setFill(Byte JavaDoc fill)
137     {
138         this.fill = fill;
139     }
140     
141
142 }
143
Popular Tags