com.creamtec.ajaxswing.rendering
Class AbstractDocumentRenderer

java.lang.Object
  extended by com.creamtec.ajaxswing.rendering.AbstractDocumentRenderer
All Implemented Interfaces:
DocumentRenderer
Direct Known Subclasses:
HTMLPageRenderer

public abstract class AbstractDocumentRenderer
extends java.lang.Object
implements DocumentRenderer

Acts as a base class for all document renderers and contains logic shared by all of them. Includes support for renderer maps


Field Summary
static boolean LIMIT_MODE
           
 
Constructor Summary
AbstractDocumentRenderer()
           
 
Method Summary
 void afterRenderComponent(Document document, java.lang.Object obj)
          A callback method that is invoked right after the component is rendered
 void beforeRenderComponent(Document document, java.lang.Object obj)
          A callback method that is invoked right before the component is rendered
abstract  Document createDocument()
          Abstract Factory Method design pattern to create documents.
 ComponentRenderer getComponentRenderer(java.lang.Object component)
          Locates the proper renderer for the given component and returns it
 ComponentRenderer getDefaultJComponentRenderer()
           
 int getDeflatedHeight(int height)
          Returns the height decreased by configured percentage (see application property html.inflate.height).
 int getDeflatedWidth(int width)
          Returns the width decreased by configured percentage (see application property html.inflate.width).
 int getInflatedHeight(int height)
          Returns the height increased by configured percentage (see application property html.inflate.height).
 int getInflatedWidth(int width)
          Returns the width increased by configured percentage (see application property html.inflate.width).
static java.lang.String getTitleForComponent(java.awt.Component comp)
          Extracts the title from the component depending on the component type
 void initializeDocument(Document document)
           
 boolean knownContainer(java.lang.Object comp)
          Returns true if the passed component should be rendered as a container.
 void redirectoToStandardPage(ClientAgent agent, int status, java.lang.Throwable x)
          Renders a standard page based on the template and the status
 void renderComponent(Document document, java.lang.Object component)
          Facade method for rendering a component into the document.
abstract  void renderContainer(Document document, java.awt.Container container)
          Renders given container into the given document.
abstract  Document renderDocument(ClientAgent agent, java.util.List windows)
          Top level method used to get a document representing a rendering of the window of the agent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIMIT_MODE

public static boolean LIMIT_MODE
Constructor Detail

AbstractDocumentRenderer

public AbstractDocumentRenderer()
Method Detail

renderContainer

public abstract void renderContainer(Document document,
                                     java.awt.Container container)
                              throws java.lang.Exception
Renders given container into the given document. Subclasses override to add logic

Throws:
java.lang.Exception

createDocument

public abstract Document createDocument()
                                 throws java.lang.Exception
Abstract Factory Method design pattern to create documents.

Throws:
java.lang.Exception

renderDocument

public abstract Document renderDocument(ClientAgent agent,
                                        java.util.List windows)
                                 throws java.lang.Exception
Description copied from interface: DocumentRenderer
Top level method used to get a document representing a rendering of the window of the agent

Specified by:
renderDocument in interface DocumentRenderer
Parameters:
agent - an agent representing a client to AjaxSwing application
Throws:
java.lang.Exception

initializeDocument

public void initializeDocument(Document document)

getComponentRenderer

public ComponentRenderer getComponentRenderer(java.lang.Object component)
Locates the proper renderer for the given component and returns it

Parameters:
component - descendant or Object descendant such as MenuBar
Throws:
AjaxSwingException - if there is no renderer for the component

renderComponent

public void renderComponent(Document document,
                            java.lang.Object component)
                     throws java.lang.Exception
Facade method for rendering a component into the document. If the component is a known container (such as JPanel) then delegates to renderContainer method. Otherwise delegates to the appropriate component renderer. This method should be used as an entry level into AjaxSwing framework for rendering components.

Throws:
java.lang.Exception

knownContainer

public boolean knownContainer(java.lang.Object comp)
Returns true if the passed component should be rendered as a container. For example, JPanel is rendered as a container, but JLabel which extend java.awt.Container should not be rendered as a Container since AjaxSwing doesn't support components inside JLabel.


beforeRenderComponent

public void beforeRenderComponent(Document document,
                                  java.lang.Object obj)
A callback method that is invoked right before the component is rendered


afterRenderComponent

public void afterRenderComponent(Document document,
                                 java.lang.Object obj)
A callback method that is invoked right after the component is rendered


getDefaultJComponentRenderer

public ComponentRenderer getDefaultJComponentRenderer()

getInflatedWidth

public int getInflatedWidth(int width)
Returns the width increased by configured percentage (see application property html.inflate.width).

Parameters:
width - the original width
Returns:
adjusted width

getInflatedHeight

public int getInflatedHeight(int height)
Returns the height increased by configured percentage (see application property html.inflate.height).

Parameters:
height - the original height
Returns:
adjusted height

getDeflatedWidth

public int getDeflatedWidth(int width)
Returns the width decreased by configured percentage (see application property html.inflate.width).

Parameters:
width - the original width
Returns:
adjusted width

getDeflatedHeight

public int getDeflatedHeight(int height)
Returns the height decreased by configured percentage (see application property html.inflate.height).

Parameters:
height - the original height
Returns:
adjusted height

redirectoToStandardPage

public void redirectoToStandardPage(ClientAgent agent,
                                    int status,
                                    java.lang.Throwable x)
                             throws java.lang.Exception
Renders a standard page based on the template and the status

Throws:
java.lang.Exception

getTitleForComponent

public static java.lang.String getTitleForComponent(java.awt.Component comp)
Extracts the title from the component depending on the component type



Copyright © 2000-2008 CreamTec LLC. All Rights Reserved.