01: //WebOnSwing - Web Application Framework
02: //Copyright (C) 2003 Fernando Damian Petrola
03: //
04: //This library is free software; you can redistribute it and/or
05: //modify it under the terms of the GNU Lesser General Public
06: //License as published by the Free Software Foundation; either
07: //version 2.1 of the License, or (at your option) any later version.
08: //
09: //This library is distributed in the hope that it will be useful,
10: //but WITHOUT ANY WARRANTY; without even the implied warranty of
11: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: //Lesser General Public License for more details.
13: //
14: //You should have received a copy of the GNU Lesser General Public
15: //License along with this library; if not, write to the Free Software
16: //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17:
18: package net.ar.webonswing.render;
19:
20: import net.ar.webonswing.managers.persistence.*;
21: import net.ar.webonswing.managers.script.*;
22: import net.ar.webonswing.managers.styles.*;
23: import net.ar.webonswing.ui.*;
24: import net.ar.webonswing.visitor.*;
25: import net.ar.webonswing.wrapping.*;
26:
27: import org.apache.commons.logging.*;
28:
29: public class DefaultComponentRenderer implements ComponentRenderer {
30: protected RenderingContributionContainer theRenderingContribManager;
31:
32: public DefaultComponentRenderer() {
33: theRenderingContribManager = new RenderingContributionContainer(
34: this );
35: }
36:
37: public Visitable render(VisualComponent aComponent) {
38: aComponent.doLayout();
39: aComponent.getContributor().accept(this );
40:
41: if (theRenderingContribManager.getComponentProps(aComponent) == null)
42: LogFactory.getLog(DefaultComponentRenderer.class).error(
43: "The contributor did not render the component: "
44: + aComponent);
45:
46: return theRenderingContribManager
47: .getComponentRendering(aComponent);
48: }
49:
50: public void visitRenderingContributor(
51: ComponentUIContributor aContributor) {
52: aContributor
53: .doRenderingContribution(theRenderingContribManager);
54: }
55:
56: public void visitScriptContributor(ScriptContributor aContributor) {
57: }
58:
59: public void visitStyleContributor(StyleContributor aContributor) {
60: }
61:
62: public void visitPersistenceContributor(
63: PersistenceContributor aContributor) {
64: }
65:
66: public void visit(Visitable aVisitable) {
67: }
68:
69: public RenderingContributionContainer getRenderingContributionContainer() {
70: return theRenderingContribManager;
71: }
72:
73: public void setRenderingContribManager(
74: RenderingContributionContainer renderingContribManager) {
75: theRenderingContribManager = renderingContribManager;
76: }
77: }
|