01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.render;
19:
20: import java.awt.Color;
21: import java.io.IOException;
22: import java.io.Writer;
23: import java.util.Collection;
24: import java.util.Map;
25:
26: import de.finix.contelligent.CallData;
27: import de.finix.contelligent.content.ColorContent;
28: import de.finix.contelligent.logging.LoggingService;
29:
30: public class ColorRenderer implements Renderer {
31: final static org.apache.log4j.Logger log = LoggingService
32: .getLogger(ColorRenderer.class);
33:
34: private ColorContent content;
35:
36: private Collection sensitiveCategories;
37:
38: public ColorRenderer(ColorContent content) {
39: this .content = content;
40: this .sensitiveCategories = content.getSensitiveCategories();
41: }
42:
43: public Collection getSensitiveCategories() {
44: return sensitiveCategories;
45: }
46:
47: public ParameterDescription[] getParameterDescription() {
48: return new ParameterDescription[0];
49: }
50:
51: public void render(Writer writer, Map parameterMap,
52: CallData callData) throws IOException {
53: Color color = content.getColor(callData);
54: // TODO this renderer needs to be channel-sensitive!
55: String htmlRepresentation = "#"
56: + Integer.toHexString(color.getRGB()).substring(2);
57: writer.write(htmlRepresentation);
58: }
59: }
|