01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: *
19: */
20: package org.safehaus.asyncweb.service.errorReporting;
21:
22: import java.io.UnsupportedEncodingException;
23:
24: import org.apache.mina.common.ByteBuffer;
25:
26: /**
27: * Manages the stylesheet info used for generated pages
28: *
29: * TODO: Should be moved out to a configuration file when we sort out a
30: * standard resource strategy
31: *
32: * @author irvingd
33: *
34: */
35: public class CSS {
36: //525D76
37: private static final String BG = "3300cc";
38:
39: private static final String CSS_STRING = "H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#"
40: + BG
41: + ";font-size:22px;} "
42: + "H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#"
43: + BG
44: + ";font-size:16px;} "
45: + "H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#"
46: + BG
47: + ";font-size:14px;} "
48: + "BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} "
49: + "B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#"
50: + BG
51: + ";} "
52: + "P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}"
53: + "A {color : black;}"
54: + "A.name {color : black;}\n"
55: + "TABLE {cellpadding:20;border-color:black;border-width:1px;border-style:solid;border-collapse:collapse}"
56: + "TD {border-width:1px;border-color:black;border-style:solid;font-family:Tahoma,Arial,sans-serif;color:black;font-size:12px;}"
57: + "TH {border-width:1px;border-color:black;border-style:solid;font-family:Tahoma,Arial,sans-serif;background-color:FF99FF;color:black;font-size:12px;}"
58: + "HR {color : #" + BG + ";}";
59:
60: private static byte[] BYTES;
61:
62: static {
63: try {
64: BYTES = CSS_STRING.getBytes("US-ASCII");
65: } catch (UnsupportedEncodingException e) {
66: throw new RuntimeException("Must support US-ASCII");
67: }
68: }
69:
70: public static void writeTo(ByteBuffer buf) {
71: buf.put(BYTES);
72: }
73:
74: public static StringBuilder appendTo(StringBuilder buff) {
75: buff.append(CSS_STRING);
76: return buff;
77: }
78:
79: }
|