1 /***
2 * Copyright (c) 2003 held jointly by the individual authors.
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; with out even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * > http://www.gnu.org/copyleft/lesser.html
19 * > http://www.opensource.org/licenses/lgpl-license.php
20 */
21 package net.mlw.vlh.web.tag.support;
22
23 import java.util.Map;
24
25 import net.mlw.vlh.ValueListInfo;
26 import net.mlw.vlh.web.tag.TableInfo;
27
28 /***
29 * @author Matthew L. Wilson, Andrej Zachar
30 * @version $Revision: 1.4 $ $Date: 2005/11/23 14:37:14 $
31 */
32 public class CsvDisplayProvider implements DisplayProvider
33 {
34
35 /***
36 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getMimeType()
37 */
38 public String getMimeType()
39 {
40 return "text/csv";
41 }
42
43 /***
44 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getHeaderRowPreProcess()
45 */
46 public String getHeaderRowPreProcess()
47 {
48 return "";
49 }
50
51 public String getHeaderCellPreProcess(ColumnInfo columnInfo, ValueListInfo info)
52 {
53 return "";
54 }
55
56 /***
57 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getHeaderLabel(net.mlw.vlh.web.tag.ColumnInfo,
58 * net.mlw.vlh.web.tag.TableInfo, net.mlw.vlh.ValueListInfo)
59 */
60 public String getHeaderLabel(ColumnInfo columnInfo, TableInfo tableInfo, ValueListInfo info, Map includeParameters)
61 {
62 return columnInfo.getTitle();
63 }
64
65 /***
66 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getHeaderCellPostProcess()
67 */
68 public String getHeaderCellPostProcess()
69 {
70 return ",";
71 }
72
73 /***
74 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getHeaderRowPostProcess()
75 */
76 public String getHeaderRowPostProcess()
77 {
78 return "\n";
79 }
80
81 /***
82 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getRowPreProcess(net.mlw.util.web.tag.Attributes)
83 */
84 public String getRowPreProcess(Attributes attributes)
85 {
86 return "";
87 }
88
89 /***
90 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getCellPreProcess(net.mlw.util.web.tag.Attributes)
91 */
92 public String getCellPreProcess(Attributes attributes)
93 {
94 return "\"";
95 }
96
97 /***
98 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getCellPostProcess()
99 */
100 public String getCellPostProcess()
101 {
102 return "\",";
103 }
104
105 /***
106 * @see net.mlw.vlh.web.tag.support.HtmlDisplayProvider#getRowPostProcess()
107 */
108 public String getRowPostProcess()
109 {
110 return "\n";
111 }
112
113 public boolean doesIncludeBodyContent()
114 {
115 return false;
116 }
117
118
119
120
121
122
123
124 public String emphase(String text, String emphasisPattern, String style)
125 {
126
127 return text;
128 }
129
130 public String getNestedHeaderPreProcess(ColumnInfo columnInfo, ValueListInfo info)
131 {
132 return "";
133 }
134
135 public String getNestedHeaderPostProcess()
136 {
137 return "";
138 }
139 }