001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.components;
019:
020: import java.io.IOException;
021: import java.io.Writer;
022: import java.util.Map;
023:
024: import org.radeox.api.engine.context.RenderContext;
025: import org.radeox.engine.context.BaseRenderContext;
026: import org.radeox.filter.BoldFilter;
027: import org.radeox.filter.FilterPipe;
028: import org.radeox.filter.HeadingFilter;
029: import org.radeox.filter.ItalicFilter;
030: import org.radeox.filter.KeyFilter;
031: import org.radeox.filter.LineFilter;
032: import org.radeox.filter.LinkTestFilter;
033: import org.radeox.filter.ListFilter;
034: import org.radeox.filter.MacroFilter;
035: import org.radeox.filter.MarkFilter;
036: import org.radeox.filter.NewlineFilter;
037: import org.radeox.filter.ParagraphFilter;
038: import org.radeox.filter.ParamFilter;
039: import org.radeox.filter.StrikeThroughFilter;
040: import org.radeox.filter.TypographyFilter;
041: import org.radeox.filter.UrlFilter;
042: import org.radeox.filter.context.BaseFilterContext;
043: import org.radeox.filter.context.FilterContext;
044:
045: import de.finix.contelligent.CallData;
046: import de.finix.contelligent.content.Content;
047: import de.finix.contelligent.content.TextContent;
048: import de.finix.contelligent.exception.ContelligentException;
049: import de.finix.contelligent.logging.LoggingService;
050: import de.finix.contelligent.render.MissingParameterException;
051:
052: public class CEasyText extends CStyledText {
053: final static org.apache.log4j.Logger log = LoggingService
054: .getLogger(CEasyText.class);
055:
056: // private TextContent content;
057: // private static Map htmlToDocbook = new HashMap();
058:
059: // public void postCreate() throws Exception {
060: // content = new ContelligentTextContent(this,
061: // ContelligentTextContent.EVALUATE);
062: // }
063:
064: public Content getContent() {
065: return super .getContent();
066: }
067:
068: public void render(Writer writer, Map parameterMap,
069: CallData callData) throws IOException,
070: MissingParameterException, ContelligentException {
071: String stringContent = ((TextContent) getContent())
072: .getText(callData);
073: if (stringContent != null) {
074:
075: RenderContext radeoxContext = new BaseRenderContext();
076: // RenderEngine radeoxEngine = new BaseRenderEngine();
077: FilterPipe fp = new FilterPipe();
078:
079: fp.addFilter(new ParamFilter());
080: fp.addFilter(new MacroFilter());
081: fp.addFilter(new HeadingFilter());
082: fp.addFilter(new LineFilter());
083: fp.addFilter(new ListFilter());
084: fp.addFilter(new StrikeThroughFilter());
085: fp.addFilter(new NewlineFilter());
086: fp.addFilter(new ParagraphFilter());
087: fp.addFilter(new BoldFilter());
088: fp.addFilter(new ItalicFilter());
089: fp.addFilter(new UrlFilter());
090: fp.addFilter(new MarkFilter());
091: fp.addFilter(new KeyFilter());
092: fp.addFilter(new TypographyFilter());
093: fp.addFilter(new LinkTestFilter());
094:
095: FilterContext filtercontext = new BaseFilterContext();
096: filtercontext.setRenderContext(radeoxContext);
097:
098: stringContent = fp.filter(stringContent, filtercontext);
099:
100: writer.write(stringContent);
101: }
102: }
103:
104: }
|