KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > JRImage


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;
29
30
31 /**
32  * An abstract representation of a graphic element representing an image. Images can be aligned and scaled. They can
33  * also contain hyperlinks or be anchors for other hyperlinks.
34  *
35  * @author Teodor Danciu (teodord@users.sourceforge.net)
36  * @version $Id: JRImage.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
37  */

38 public interface JRImage extends JRGraphicElement, JRAnchor, JRHyperlink, JRAlignment, JRBox
39 {
40
41
42     /**
43      * A constant value specifying that if the actual image is larger than the image element size, it will be cut off so
44      * that it keeps its original resolution, and only the region that fits the specified size will be displayed.
45      */

46     public static final byte SCALE_IMAGE_CLIP = 1;
47
48     /**
49      * A constant value specifying that if the dimensions of the actual image do not fit those specified for the
50      * image element that displays it, the image can be forced to obey them and stretch itself so that it fits
51      * in the designated output area.
52      */

53     public static final byte SCALE_IMAGE_FILL_FRAME = 2;
54
55     /**
56      * A constant value specifying that if the actual image does not fit into the image element, it can be adapted
57      * to those dimensions without needing to change its original proportions.
58      */

59     public static final byte SCALE_IMAGE_RETAIN_SHAPE = 3;
60
61
62     /**
63      * A constant used for specifying that the engine should raise an exception if the image is not found.
64      */

65     public static final byte ON_ERROR_TYPE_ERROR = 1;
66
67     /**
68      * A constant used for specifying that the engine should display blank space if the image is not found.
69      */

70     public static final byte ON_ERROR_TYPE_BLANK = 2;
71
72     /**
73      * A constant used for specifying that the engine should display a replacement icon if the image is not found.
74      */

75     public static final byte ON_ERROR_TYPE_ICON = 3;
76     
77
78     /**
79      * Gets the image scale type.
80      * @return one of the scale constants in this class
81      */

82     public byte getScaleImage();
83
84     public Byte JavaDoc getOwnScaleImage();
85
86     /**
87      * Sets the image scale type.
88      * @param scaleImage one of the scale constants in this class
89      */

90     public void setScaleImage(byte scaleImage);
91
92     public void setScaleImage(Byte JavaDoc scaleImage);
93
94     /**
95      * Indicates if the engine is loading the current image from cache.
96      * Implementations of this method rely on default values that depend on the type of the image expression
97      * if a value was not explicitly set of this flag.
98      * @return true if the image should be loaded from cache, false otherwise
99      */

100     public boolean isUsingCache();
101
102     /**
103      * Indicates if the engine is loading the current image from cache.
104      * Implementations of this method return the actual value for the internal flag that was explicitly
105      * set on this image element.
106      * @return Boolean.TRUE if the image should be loaded from cache, Boolean.FALSE otherwise
107      * or null in case the flag was never explicitly set on this image element
108      */

109     public Boolean JavaDoc isOwnUsingCache();
110
111     /**
112      * Specifies if the engine should be loading the current image from cache. If set to true, the reporting engine
113      * will try to recognize previously loaded images using their specified source. For example, it will recognize
114      * an image if the image source is a file name that it has already loaded, or if it is the same URL.
115      * <p>
116      * For image elements that have expressions returning <tt>java.lang.String</tt> objects as the image source,
117      * representing file names, URLs or classpath resources, the default value for this flag is true.
118      */

119     public void setUsingCache(boolean isUsingCache);
120
121     /**
122      * Specifies if the engine should be loading the current image from cache. If set to Boolean.TRUE, the reporting engine
123      * will try to recognize previously loaded images using their specified source. For example, it will recognize
124      * an image if the image source is a file name that it has already loaded, or if it is the same URL.
125      * <p>
126      * If set to null, the engine will rely on some default value which depends on the type of the image expression.
127      * The cache is turned on by default only for images that have <tt>java.lang.String</tt> objects in their expressions.
128      */

129     public void setUsingCache(Boolean JavaDoc isUsingCache);
130
131     /**
132      * Indicates if the images will be loaded lazily or not.
133      */

134     public boolean isLazy();
135
136     /**
137      * Gives control over when the images are retrieved from their specified location. If set to true, the image is
138      * loaded from the specified location only when the document is viewed or exported to other formats. Otherwise
139      * it is loaded during the report filling process and stored in the resulting document.
140      * @param isLazy specifies whether
141      */

142     public void setLazy(boolean isLazy);
143
144     /**
145      * Indicates how the engine will treat a missing image.
146      * @return one of the constants for missing image error types
147      */

148     public byte getOnErrorType();
149
150     /**
151      * Specifies how the engine should treat a missing image.
152      * @param onErrorType one of the constants for missing image error types
153      */

154     public void setOnErrorType(byte onErrorType);
155
156     /**
157      * Indicates the evaluation time for this image.
158      * @return one of the evaluation time constants in {@link JRExpression}
159      */

160     public byte getEvaluationTime();
161         
162     /**
163      * Indicates the evaluation time for this image.
164      * @return one of the evaluation time constants in {@link JRExpression}
165      */

166     public JRGroup getEvaluationGroup();
167         
168     /**
169      * Gets the evaluation group for this text field. Used only when evaluation time is group.
170      * @see JRExpression#EVALUATION_TIME_GROUP
171      */

172     public JRExpression getExpression();
173     
174     /**
175      * Returns an object containing all border and padding properties for this text element
176      * @deprecated
177      */

178     public JRBox getBox();
179
180
181 }
182
Popular Tags