1
2
3
4
5 package net.mlw.vlh.web.tag.support;
6
7 import net.mlw.vlh.ValueListInfo;
8
9 /***
10 * AbstractHTMLDisplayProvider implement common parts for display providers.
11 * @author Andrej Zachar
12 * @version $Revision: 1.2 $ $Date: 2005/11/23 14:37:14 $
13 */
14 public abstract class AbstractHTMLDisplayProvider implements DisplayProvider
15 {
16
17 public boolean doesIncludeBodyContent()
18 {
19 return true;
20 }
21
22 /***
23 * @param String text
24 * @param String emphasisPattern
25 * @return Emphase text with emphasesis prefix and postfix. example: <a
26 * class='emphase'> emphasisPattern </a>
27 */
28 public String emphase(String text, String emphasisPattern, String style)
29 {
30 if (emphasisPattern == null)
31 return text;
32
33 StringBuffer replacement = new StringBuffer("<span class='" + style + "Emphase'>");
34 replacement.append(emphasisPattern);
35 replacement.append("</span>");
36 return text.replaceAll(emphasisPattern, replacement.toString());
37 }
38
39 /***
40 * Get the HTML that comes before the column text.
41 *
42 * @return The HTML that comes before the column text.
43 */
44 public String getHeaderRowPostProcess()
45 {
46 return "</tr>";
47 }
48
49 /***
50 * Get the HTML that comes before the column text.
51 *
52 * @return The HTML that comes before the column text.
53 */
54 public String getHeaderRowPreProcess()
55 {
56 return "\n<tr>";
57 }
58
59 public String getMimeType()
60 {
61 return null;
62 }
63
64 public String getRowPostProcess()
65 {
66 return "</tr>";
67 }
68
69 public String getRowPreProcess(Attributes attributes)
70 {
71 return (attributes == null) ? "\n<tr>" : "\n<tr " + attributes.getCellAttributesAsString() + ">";
72 }
73
74 public String getNestedHeaderPreProcess(ColumnInfo columnInfo, ValueListInfo info)
75 {
76 return (columnInfo.getAttributes() == null) ? "<table width=\"100%\">" : "<table width=\"100%\" " + columnInfo.getAttributes() + ">";
77 }
78
79 public String getNestedHeaderPostProcess()
80 {
81 return "</table>";
82 }
83 }