~brian-thomason/+junk/jasperreports3.7

« back to all changes in this revision

Viewing changes to src/net/sf/jasperreports/engine/JRTextElement.java

  • Committer: Brian Thomason
  • Date: 2011-12-20 17:51:16 UTC
  • Revision ID: brian.thomason@canonical.com-20111220175116-apwo6unuaedvgzo3
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * JasperReports - Free Java Reporting Library.
 
3
 * Copyright (C) 2001 - 2009 Jaspersoft Corporation. All rights reserved.
 
4
 * http://www.jaspersoft.com
 
5
 *
 
6
 * Unless you have purchased a commercial license agreement from Jaspersoft,
 
7
 * the following license terms apply:
 
8
 *
 
9
 * This program is part of JasperReports.
 
10
 *
 
11
 * JasperReports is free software: you can redistribute it and/or modify
 
12
 * it under the terms of the GNU Lesser General Public License as published by
 
13
 * the Free Software Foundation, either version 3 of the License, or
 
14
 * (at your option) any later version.
 
15
 *
 
16
 * JasperReports is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
19
 * GNU Lesser General Public License for more details.
 
20
 * 
 
21
 * You should have received a copy of the GNU Lesser General Public License
 
22
 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
 
23
 */
 
24
package net.sf.jasperreports.engine;
 
25
 
 
26
import net.sf.jasperreports.engine.type.LineSpacingEnum;
 
27
import net.sf.jasperreports.engine.type.RotationEnum;
 
28
import net.sf.jasperreports.engine.util.JRProperties;
 
29
 
 
30
 
 
31
/**
 
32
 * An abstract representation of a report text element. It provides basic functionality for static texts and text fields.
 
33
 *
 
34
 * @author Teodor Danciu (teodord@users.sourceforge.net)
 
35
 * @version $Id: JRTextElement.java 3585 2010-03-12 12:58:24Z shertage $
 
36
 */
 
37
public interface JRTextElement extends JRElement, JRAlignment, JRBox, JRFont, JRCommonText
 
38
{
 
39
 
 
40
        /**
 
41
         * Property used to determine whether the fill process must preserve the original text
 
42
         * for text elements that are not able to fit their entire contents.
 
43
         * 
 
44
         * <p>
 
45
         * When this property is set, the engine saves the original text in the
 
46
         * {@link JRPrintText print text object} along with the index at which the
 
47
         * text is to be truncated by the print object.
 
48
         * </p>
 
49
         * 
 
50
         * <p>
 
51
         * This property can be set at the following levels (listed in the order of precedence):
 
52
         * <ul>
 
53
         *      <li>at {@link JRTextElement text element} level</li>
 
54
         *      <li>at {@link JRReport report} level</li>
 
55
         *      <li>globally in jasperreports.properties or via {@link JRProperties}</li>
 
56
         * </ul> 
 
57
         * </p>
 
58
         * 
 
59
         * @see JRPrintText#getFullText()
 
60
         * @see JRPrintText#getText()
 
61
         * @see JRPrintText#getTextTruncateIndex()
 
62
         */
 
63
        public static final String PROPERTY_PRINT_KEEP_FULL_TEXT = JRProperties.PROPERTY_PREFIX + "print.keep.full.text";
 
64
        
 
65
        /**
 
66
         * Boolean property that determines whether text elements are to be truncated
 
67
         * at the last character that fits.
 
68
         * 
 
69
         * <p>
 
70
         * By default, when the entire text of a text element does not fit the element's area,
 
71
         * the text is truncated at the last word that fits the area.
 
72
         * This property can instruct the engine to truncate the text at the last character
 
73
         * that fits.
 
74
         * </p>
 
75
         * 
 
76
         * <p>
 
77
         * The property can be set at the same levels as {@link #PROPERTY_PRINT_KEEP_FULL_TEXT}.
 
78
         * </p>
 
79
         */
 
80
        public static final String PROPERTY_TRUNCATE_AT_CHAR = JRProperties.PROPERTY_PREFIX + "text.truncate.at.char";
 
81
 
 
82
        /**
 
83
         * Property whose value is used as a suffix for the truncated text.
 
84
         * 
 
85
         * <p>
 
86
         * The suffix is appended to the text when truncation occurs.
 
87
         * If the property is not defined or empty (which is the case by default),
 
88
         * no suffix will be used when the text is truncated.
 
89
         * </p>
 
90
         * 
 
91
         * <p>
 
92
         * The property can be set at the same levels as {@link #PROPERTY_PRINT_KEEP_FULL_TEXT}.
 
93
         * </p>
 
94
         */
 
95
        public static final String PROPERTY_TRUNCATE_SUFFIX = JRProperties.PROPERTY_PREFIX + "text.truncate.suffix";
 
96
        
 
97
        /**
 
98
         * Boolean property that determines whether the positions where text line
 
99
         * break occurs are to be saved during report fill in oder to be used at
 
100
         * export time.
 
101
         * 
 
102
         * <p>
 
103
         * At report fill time, each text element is measured in order to determine
 
104
         * how long it needs to stretch or where it needs to be truncated.
 
105
         * During this measurement, the text wraps at certain positions in order to
 
106
         * fit the text element defined width.
 
107
         * 
 
108
         * <p>
 
109
         * Setting this property to true instructs the engine to save the positions
 
110
         * at which line breaks occur in the generated print element.
 
111
         * The positions can be used by report exporters that want to enforce line
 
112
         * breaks to occur at exactly the same position as they did during text
 
113
         * measurement at fill time.
 
114
         * 
 
115
         * <p>
 
116
         * Currently, the HTML exporter will make use of the saved line break
 
117
         * positions by introducing explicit line breaks.
 
118
         * 
 
119
         * <p>
 
120
         * The property can be set globally, at report level or at text element level.
 
121
         * 
 
122
         * @see JRPrintText#getLineBreakOffsets()
 
123
         */
 
124
        public static final String PROPERTY_SAVE_LINE_BREAKS = JRProperties.PROPERTY_PREFIX 
 
125
                        + "text.save.line.breaks";
 
126
        
 
127
        /**
 
128
         * @deprecated Replaced by {@link JRAlignment#HORIZONTAL_ALIGN_LEFT}.
 
129
         */
 
130
        public static final byte TEXT_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT;
 
131
        /**
 
132
         * @deprecated Replaced by {@link JRAlignment#HORIZONTAL_ALIGN_CENTER}.
 
133
         */
 
134
        public static final byte TEXT_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER;
 
135
        /**
 
136
         * @deprecated Replaced by {@link JRAlignment#HORIZONTAL_ALIGN_RIGHT}.
 
137
         */
 
138
        public static final byte TEXT_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT;
 
139
        /**
 
140
         * @deprecated Replaced by {@link JRAlignment#HORIZONTAL_ALIGN_JUSTIFIED}.
 
141
         */
 
142
        public static final byte TEXT_ALIGN_JUSTIFIED = HORIZONTAL_ALIGN_JUSTIFIED;
 
143
 
 
144
        /**
 
145
         * @deprecated Replaced by {@link RotationEnum#NONE}.
 
146
         */
 
147
        public static final byte ROTATION_NONE = 0;
 
148
 
 
149
        /**
 
150
         * @deprecated Replaced by {@link RotationEnum#LEFT}.
 
151
         */
 
152
        public static final byte ROTATION_LEFT = 1;
 
153
 
 
154
        /**
 
155
         * @deprecated Replaced by {@link RotationEnum#RIGHT}.
 
156
         */
 
157
        public static final byte ROTATION_RIGHT = 2;
 
158
 
 
159
        /**
 
160
         * @deprecated Replaced by {@link RotationEnum#UPSIDE_DOWN}.
 
161
         */
 
162
        public static final byte ROTATION_UPSIDE_DOWN = 3;
 
163
 
 
164
        /**
 
165
         * @deprecated Replaced by {@link LineSpacingEnum#SINGLE}.
 
166
         */
 
167
        public static final byte LINE_SPACING_SINGLE = 0;
 
168
 
 
169
        /**
 
170
         * @deprecated Replaced by {@link LineSpacingEnum#ONE_AND_HALF}.
 
171
         */
 
172
        public static final byte LINE_SPACING_1_1_2 = 1;
 
173
 
 
174
        /**
 
175
         * @deprecated Replaced by {@link LineSpacingEnum#DOUBLE}.
 
176
         */
 
177
        public static final byte LINE_SPACING_DOUBLE = 2;
 
178
 
 
179
 
 
180
        /**
 
181
         * Gets the text horizontal alignment.
 
182
         * @return a value representing one of the horizontal alignment constants in {@link JRAlignment}
 
183
         * @deprecated Replaced by {@link #getHorizontalAlignment()}.
 
184
         */
 
185
        public byte getTextAlignment();
 
186
 
 
187
        /**
 
188
         * Sets the text horizontal alignment.
 
189
         * @param horizontalAlignment a value representing one of the horizontal alignment constants in {@link JRAlignment}
 
190
         * @deprecated Replaced by {@link #setHorizontalAlignment(byte)}.
 
191
         */
 
192
        public void setTextAlignment(byte horizontalAlignment);
 
193
 
 
194
        /**
 
195
         * Specifies whether the text can contain style tags.
 
196
         * @deprecated Replaced by {@link #setMarkup(String)}.
 
197
         */
 
198
        public void setStyledText(boolean isStyledText);
 
199
                
 
200
        /**
 
201
         * @deprecated Replaced by {@link #setMarkup(String)}.
 
202
         */
 
203
        public void setStyledText(Boolean isStyledText);
 
204
        
 
205
        /**
 
206
         * Returns an object containing all border and padding properties for this text element
 
207
         * @deprecated Replaced by {@link JRBoxContainer#getLineBox()}
 
208
         */
 
209
        public JRBox getBox();
 
210
 
 
211
        /**
 
212
         * Returns an object containing all font properties for this text element
 
213
         * @deprecated
 
214
         */
 
215
        public JRFont getFont();
 
216
 
 
217
        
 
218
}