comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 2048:3157a78e6494

Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings. flys-artifacts/trunk@3538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 23 Dec 2011 14:24:57 +0000
parents 0318fa6f0844
children 2d5f2bc68cc6
comparison
equal deleted inserted replaced
2047:0318fa6f0844 2048:3157a78e6494
123 this.inverted = inverted; 123 this.inverted = inverted;
124 } 124 }
125 125
126 126
127 /** 127 /**
128 * Returns a title for the chart from ChartSettings object 128 * Returns the default title for this chart.
129 * if this object is not null or creates a default title.
130 * 129 *
131 * @return a title. 130 * @return the default title for this chart.
132 */ 131 */
133 @Override 132 @Override
134 public String getChartTitle() { 133 public String getDefaultChartTitle() {
135 ChartSettings chartSettings = getChartSettings();
136 if (chartSettings != null) {
137 return getChartTitle(chartSettings);
138 }
139
140 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); 134 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
141 } 135 }
142 136
143 137
144 /** 138 /**
145 * Returns a subtitle for the chart from ChartSettings object 139 * Returns the default subtitle for this chart.
146 * if this object is not null or creates a default title.
147 * 140 *
148 * @return a title. 141 * @return the default subtitle for this chart.
149 */ 142 */
150 @Override 143 @Override
151 protected String getChartSubtitle() { 144 protected String getDefaultChartSubtitle() {
152 ChartSettings chartSettings = getChartSettings();
153 if (chartSettings != null) {
154 return getChartSubtitle(chartSettings);
155 }
156
157 double[] dist = getRange(); 145 double[] dist = getRange();
158 146
159 Object[] args = new Object[] { 147 Object[] args = new Object[] {
160 getRiverName(), 148 getRiverName(),
161 149
182 * @see getChartSubtitleKey 170 * @see getChartSubtitleKey
183 */ 171 */
184 @Override 172 @Override
185 protected void addSubtitles(JFreeChart chart) { 173 protected void addSubtitles(JFreeChart chart) {
186 String subtitle = getChartSubtitle(); 174 String subtitle = getChartSubtitle();
187 chart.addSubtitle(new TextTitle(subtitle)); 175
176 if (subtitle != null && subtitle.length() > 0) {
177 chart.addSubtitle(new TextTitle(subtitle));
178 }
188 } 179 }
189 180
190 181
191 /** 182 /**
192 * Get internationalized label for the x axis. 183 * Get internationalized label for the x axis.

http://dive4elements.wald.intevation.org