001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License version 2
011: * as published by the Free Software Foundation.
012: *
013: * Resin Open Source is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
016: * of NON-INFRINGEMENT. See the GNU General Public License for more
017: * details.
018: *
019: * You should have received a copy of the GNU General Public License
020: * along with Resin Open Source; if not, write to the
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.jsf.cfg;
030:
031: import com.caucho.config.types.DescriptionGroupConfig;
032: import com.caucho.config.program.ConfigProgram;
033: import java.util.*;
034:
035: import javax.annotation.*;
036:
037: import javax.el.*;
038:
039: import javax.faces.*;
040: import javax.faces.application.*;
041: import javax.faces.component.*;
042: import javax.faces.component.html.*;
043: import javax.faces.context.*;
044: import javax.faces.convert.*;
045: import javax.faces.el.*;
046: import javax.faces.event.*;
047: import javax.faces.render.*;
048: import javax.faces.validator.*;
049:
050: import javax.xml.bind.annotation.*;
051:
052: import com.caucho.config.*;
053: import com.caucho.config.j2ee.*;
054: import com.caucho.jsf.el.*;
055: import com.caucho.util.*;
056:
057: public class RendererConfig extends DescriptionGroupConfig {
058: private static final L10N L = new L10N(RendererConfig.class);
059:
060: private String _family;
061: private String _type;
062: private Class _class;
063:
064: private Renderer _renderer;
065:
066: public void setFamily(String family) {
067: _family = family;
068: }
069:
070: public void setComponentFamily(String family) {
071: setFamily(family);
072: }
073:
074: public void setType(String type) {
075: _type = type;
076: }
077:
078: public void setRendererType(String type) {
079: setType(type);
080: }
081:
082: public void setClass(Class cl) {
083: Config.validate(cl, Renderer.class);
084:
085: _class = cl;
086: }
087:
088: public void setRendererClass(Class cl) {
089: setClass(cl);
090: }
091:
092: public void addFacet(FacetConfig facet) throws ConfigException {
093: }
094:
095: public void addAttribute(AttributeConfig attribute)
096: throws ConfigException {
097: }
098:
099: public void setRendererExtension(ConfigProgram program)
100: throws ConfigException {
101: }
102:
103: @PostConstruct
104: public void init() throws InstantiationException,
105: IllegalAccessException {
106: _renderer = (Renderer) _class.newInstance();
107: }
108:
109: public void configure(RenderKit renderKit) {
110: renderKit.addRenderer(_family, _type, _renderer);
111: }
112: }
|