~brian-thomason/+junk/jasperreports3.7

« back to all changes in this revision

Viewing changes to src/net/sf/jasperreports/engine/fill/JRFillLine.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.fill;
 
25
 
 
26
import net.sf.jasperreports.engine.JRException;
 
27
import net.sf.jasperreports.engine.JRExpressionCollector;
 
28
import net.sf.jasperreports.engine.JRLine;
 
29
import net.sf.jasperreports.engine.JRPrintElement;
 
30
import net.sf.jasperreports.engine.JRVisitor;
 
31
import net.sf.jasperreports.engine.type.LineDirectionEnum;
 
32
 
 
33
 
 
34
/**
 
35
 * @author Teodor Danciu (teodord@users.sourceforge.net)
 
36
 * @version $Id: JRFillLine.java 3583 2010-03-12 11:35:40Z shertage $
 
37
 */
 
38
public class JRFillLine extends JRFillGraphicElement implements JRLine
 
39
{
 
40
 
 
41
 
 
42
        /**
 
43
         *
 
44
         */
 
45
        protected JRFillLine(
 
46
                JRBaseFiller filler,
 
47
                JRLine line, 
 
48
                JRFillObjectFactory factory
 
49
                )
 
50
        {
 
51
                super(filler, line, factory);
 
52
        }
 
53
 
 
54
 
 
55
        protected JRFillLine(JRFillLine line, JRFillCloneFactory factory)
 
56
        {
 
57
                super(line, factory);
 
58
        }
 
59
 
 
60
 
 
61
        /**
 
62
         * @deprecated Replaced by {@link #getDirectionValue()}.
 
63
         */
 
64
        public byte getDirection()
 
65
        {
 
66
                return ((JRLine)this.parent).getDirection();
 
67
        }
 
68
                
 
69
        /**
 
70
         * @deprecated Replaced by {@link #setDirection(LineDirectionEnum)}.
 
71
         */
 
72
        public void setDirection(byte direction)
 
73
        {
 
74
                throw new UnsupportedOperationException();
 
75
        }
 
76
 
 
77
        /**
 
78
         * 
 
79
         */
 
80
        public LineDirectionEnum getDirectionValue()
 
81
        {
 
82
                return ((JRLine)this.parent).getDirectionValue();
 
83
        }
 
84
                
 
85
        /**
 
86
         * 
 
87
         */
 
88
        public void setDirection(LineDirectionEnum direction)
 
89
        {
 
90
                throw new UnsupportedOperationException();
 
91
        }
 
92
 
 
93
        /**
 
94
         *
 
95
         */
 
96
        protected JRTemplateLine getJRTemplateLine()
 
97
        {
 
98
                return (JRTemplateLine) getElementTemplate();
 
99
        }
 
100
 
 
101
        protected JRTemplateElement createElementTemplate()
 
102
        {
 
103
                return new JRTemplateLine(
 
104
                                getElementOrigin(), 
 
105
                                filler.getJasperPrint().getDefaultStyleProvider(), 
 
106
                                this
 
107
                                );
 
108
        }
 
109
 
 
110
 
 
111
        /**
 
112
         *
 
113
         */
 
114
        protected void evaluate(
 
115
                byte evaluation
 
116
                ) throws JRException
 
117
        {
 
118
                this.reset();
 
119
                
 
120
                this.evaluatePrintWhenExpression(evaluation);
 
121
                evaluateProperties(evaluation);
 
122
                
 
123
                setValueRepeating(true);
 
124
        }
 
125
 
 
126
 
 
127
        /**
 
128
         *
 
129
         */
 
130
        protected JRPrintElement fill()
 
131
        {
 
132
                JRTemplatePrintLine printLine = new JRTemplatePrintLine(this.getJRTemplateLine());
 
133
                printLine.setX(this.getX());
 
134
                printLine.setY(this.getRelativeY());
 
135
                printLine.setWidth(getWidth());
 
136
                printLine.setHeight(this.getStretchHeight());
 
137
                transferProperties(printLine);
 
138
                
 
139
                return printLine;
 
140
        }
 
141
 
 
142
 
 
143
        /**
 
144
         *
 
145
         */
 
146
        public void collectExpressions(JRExpressionCollector collector)
 
147
        {
 
148
                collector.collect(this);
 
149
        }
 
150
 
 
151
        /**
 
152
         *
 
153
         */
 
154
        public void visit(JRVisitor visitor)
 
155
        {
 
156
                visitor.visitLine(this);
 
157
        }
 
158
 
 
159
        /**
 
160
         *
 
161
         */
 
162
        protected void resolveElement (JRPrintElement element, byte evaluation)
 
163
        {
 
164
                // nothing
 
165
        }
 
166
 
 
167
 
 
168
        public JRFillCloneable createClone(JRFillCloneFactory factory)
 
169
        {
 
170
                return new JRFillLine(this, factory);
 
171
        }
 
172
 
 
173
}