creamtec.webcream.rendering.html
Class HTMLPageRenderer

java.lang.Object
  extended by creamtec.webcream.rendering.AbstractDocumentRenderer
      extended by creamtec.webcream.rendering.html.HTMLPageRenderer
All Implemented Interfaces:
ComponentRenderer, DocumentRenderer
Direct Known Subclasses:
PositionedPageRenderer, StructuredPageRenderer

public abstract class HTMLPageRenderer
extends AbstractDocumentRenderer

Contains logic that creates HTML page from parts such as the header and the body.


Field Summary
 
Fields inherited from class creamtec.webcream.rendering.AbstractDocumentRenderer
dummyField1, LIMIT_MODE
 
Constructor Summary
HTMLPageRenderer()
           
 
Method Summary
 void afterRenderComponent(Document page, java.lang.Object obj)
          Callback method invoked after rendering a component.
 void afterRenderComponent(HTMLPage page, java.lang.Object obj)
          Callback method invoked after rendering a component
 void appendClippingClause(HTMLPage page, java.awt.Component comp)
          Should be overriden to get clipping style clause of component in the positioning page renderers.
 void appendComponentStyle(HTMLPage page, java.lang.Object obj, boolean renderingStyle)
          Can be overridden to add styles to compoents
 void appendHeader(HTMLPage page, java.awt.Window window)
          Appends page header which contains the title and a link to the stylesheet
 void appendStyleSheet(HTMLPage page)
          Appends stylesheet link depending on the page theme and the agent's browser
 void beforeRenderComponent(Document page, java.lang.Object obj)
          Callback method invoked before rendering a component.
 void beforeRenderComponent(HTMLPage page, java.lang.Object obj)
          Callback method invoked before rendering a component
 Document createDocument()
          Creates a new HTML page
 javax.swing.border.TitledBorder findTitledBorder(javax.swing.border.Border border)
          Finds a titled border in the tree identified by the border (can be compound border)
 java.awt.Rectangle getComponentRect(HTMLPage page, java.awt.Component comp)
          Should be overriden to get rectangle of component in the positioning page renderers.
 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 renderComponent(Document document, java.lang.Object component)
          Facade method for rendering a component into the document.
 void renderContainer(Document document, java.awt.Container container)
          Helper method that forwards to renderContainer(HTMLPage, Container)
abstract  void renderContainer(HTMLPage page, java.awt.Container container)
          Must be overridden by subclasses to actually insert the logic of rendering
 Document renderDocument(ClientAgent agent, java.awt.Window window)
          Overrides AbstractDocumentRenderer implementation to render the given window as HTML page.
 
Methods inherited from class creamtec.webcream.rendering.AbstractDocumentRenderer
getCustomComponentRenderer, getDefaultJComponentRenderer, knownContainer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLPageRenderer

public HTMLPageRenderer()
Method Detail

renderDocument

public Document renderDocument(ClientAgent agent,
                               java.awt.Window window)
                        throws java.lang.Exception
Overrides AbstractDocumentRenderer implementation to render the given window as HTML page. Resets the page, generates the header, the body and the trailer and returns the HTML page.

Parameters:
agent - an agent representing a client to WebCream application
window - java.awt.Window or a subclass to be rendered
Throws:
java.lang.Exception

appendHeader

public void appendHeader(HTMLPage page,
                         java.awt.Window window)
Appends page header which contains the title and a link to the stylesheet


appendStyleSheet

public void appendStyleSheet(HTMLPage page)
Appends stylesheet link depending on the page theme and the agent's browser


getTitleForComponent

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


findTitledBorder

public javax.swing.border.TitledBorder findTitledBorder(javax.swing.border.Border border)
Finds a titled border in the tree identified by the border (can be compound border)

Parameters:
border - Border
Returns:
TitledBorder

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

renderContainer

public void renderContainer(Document document,
                            java.awt.Container container)
                     throws java.lang.Exception
Helper method that forwards to renderContainer(HTMLPage, Container)

Specified by:
renderContainer in class AbstractDocumentRenderer
Throws:
java.lang.Exception

renderContainer

public abstract void renderContainer(HTMLPage page,
                                     java.awt.Container container)
                              throws java.lang.Exception
Must be overridden by subclasses to actually insert the logic of rendering

Throws:
java.lang.Exception

beforeRenderComponent

public void beforeRenderComponent(Document page,
                                  java.lang.Object obj)
Callback method invoked before rendering a component. Forwards to afterRenderComponent(HTMLPage, Object)

Overrides:
beforeRenderComponent in class AbstractDocumentRenderer

afterRenderComponent

public void afterRenderComponent(Document page,
                                 java.lang.Object obj)
Callback method invoked after rendering a component. Forwards to afterRenderComponent(HTMLPage, Object)

Overrides:
afterRenderComponent in class AbstractDocumentRenderer

beforeRenderComponent

public void beforeRenderComponent(HTMLPage page,
                                  java.lang.Object obj)
Callback method invoked before rendering a component


afterRenderComponent

public void afterRenderComponent(HTMLPage page,
                                 java.lang.Object obj)
Callback method invoked after rendering a component


appendComponentStyle

public void appendComponentStyle(HTMLPage page,
                                 java.lang.Object obj,
                                 boolean renderingStyle)
Can be overridden to add styles to compoents


getComponentRect

public java.awt.Rectangle getComponentRect(HTMLPage page,
                                           java.awt.Component comp)
Should be overriden to get rectangle of component in the positioning page renderers. For structured renderers this method does not make sense.


appendClippingClause

public void appendClippingClause(HTMLPage page,
                                 java.awt.Component comp)
Should be overriden to get clipping style clause of component in the positioning page renderers. For structured renderers this method does not make sense.


createDocument

public Document createDocument()
                        throws java.lang.Exception
Creates a new HTML page

Specified by:
createDocument in class AbstractDocumentRenderer
Throws:
java.lang.Exception

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 WebCream framework for rendering components.

Specified by:
renderComponent in interface ComponentRenderer
Overrides:
renderComponent in class AbstractDocumentRenderer
Parameters:
document - such as HTML page that is being rendered
component - GUI component that needs to be rendered. Can be subclasses of java.awt.Component or other components such as JMenuItem
Throws:
java.lang.Exception


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