com.ibm.designer.domino.xsp.api.visual
Class AbstractVisualizationFactory

java.lang.Object
  extended by com.ibm.designer.domino.xsp.api.visual.AbstractVisualizationFactory

public abstract class AbstractVisualizationFactory
extends java.lang.Object

A factory class that generates XSP mark-up for the tag it is associated with. The XSP markup must only contain mark-up which has pre-existing visualizations in Domino Designer. When a tag (which has a corresponding VisualizationFactory) is dropped onto an XPage, the visualization factory is given the DOM Node representing the newly inserted tag. The visualization factory then may return XSP mark-up that will be used to display the control. The visualization factory is queried each time node on the XPage changes.


Nested Class Summary
static interface AbstractVisualizationFactory.IVisualizationCallback
          An interface that gets invoked when the factory is printing a DOM Node.
static class AbstractVisualizationFactory.RenderChildrenRecursiveCallback
          A default implementation of com.ibm.designer.domino.xsp.api.visual.AbstractVisualizationFactory.IVisualizationCallback.
 
Field Summary
static AbstractVisualizationFactory.RenderChildrenRecursiveCallback recursiveCallback
          A static callback clas that will cause the print methods to recursively print a node.
static java.lang.String XSP_FOOTER
          The closing tag of an XPage (</xp:view>)
 
Constructor Summary
AbstractVisualizationFactory()
           
 
Method Summary
static java.lang.String generateHeaderWithExtLibDef(org.w3c.dom.Node n)
          Utility method that examines the current XPage and returns the header that is appropriate for use within a visualization.
abstract  java.lang.String getFullXSPMarkupForControl(org.w3c.dom.Node nodeToVisualize, FacesRegistry registry)
          Returns valid XSP mark-up which will be used by the Design editor in the XPages editor to visualize a control for the given DOM node.
abstract  java.lang.String getXSPMarkupForControl(org.w3c.dom.Node nodeToVisualize, AbstractVisualizationFactory.IVisualizationCallback callback, FacesRegistry registry)
          Returns valid XSP mark-up which will be used by the Design editor in the XPages editor to visualize a control for the given DOM node.
 java.lang.String printNode(org.w3c.dom.Node n)
          Prints the provided node (including all of it's children) to a string.
static java.lang.String printNode(org.w3c.dom.Node n, AbstractVisualizationFactory.IVisualizationCallback callback, FacesRegistry registry)
          Prints the provided node to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recursiveCallback

public static final AbstractVisualizationFactory.RenderChildrenRecursiveCallback recursiveCallback
A static callback clas that will cause the print methods to recursively print a node.


XSP_FOOTER

public static final java.lang.String XSP_FOOTER
The closing tag of an XPage (</xp:view>)

See Also:
Constant Field Values
Constructor Detail

AbstractVisualizationFactory

public AbstractVisualizationFactory()
Method Detail

generateHeaderWithExtLibDef

public static java.lang.String generateHeaderWithExtLibDef(org.w3c.dom.Node n)
Utility method that examines the current XPage and returns the header that is appropriate for use within a visualization. The header will contain the XML declaration, a long with the opening 'view' tag of the XPage. The view tag will contain the correct namespace prefixes as defined in the current XPage.

Parameters:
n - the node that is being visualized
Returns:

printNode

public static java.lang.String printNode(org.w3c.dom.Node n,
                                         AbstractVisualizationFactory.IVisualizationCallback callback,
                                         FacesRegistry registry)
Prints the provided node to a string. Gives the caller an opportunity to inject content between the opening and closing tags of the node. The lifecycle of this method is the opening tag is printed to the string a long with all of the attributes that have been set on the node, next the callback class is called (if provided), to append information to the tag, finally the closing tag is generated.

Parameters:
n - a node that we wish to serialize to a String
callback - an object that will be queried for further input during the print operation
registry - the FacesRegistry for the current application
Returns:
a String representation of the given node.

getFullXSPMarkupForControl

public abstract java.lang.String getFullXSPMarkupForControl(org.w3c.dom.Node nodeToVisualize,
                                                            FacesRegistry registry)
Returns valid XSP mark-up which will be used by the Design editor in the XPages editor to visualize a control for the given DOM node. This method must return the markup for an complete XPage i.e. include the 'view' tag for the XPage.

The implementation of this method should be extremely light-weight. This method will be called repeatedly during the life-cycle of a control on an XPage. Any time-consuming work should NOT be performed within this method as it will adversely affect the performance of the XPage editor.
Clients with extremely complex controls should be careful not to over elaborate on their visualizations as any delay in creating a markup will impact editor performance.

Parameters:
nodeToVisualize - the DOM node from the XPage that requires a visualization
registry - the FacesRegistry for the current application
Returns:
valid markup representing an XSP page

getXSPMarkupForControl

public abstract java.lang.String getXSPMarkupForControl(org.w3c.dom.Node nodeToVisualize,
                                                        AbstractVisualizationFactory.IVisualizationCallback callback,
                                                        FacesRegistry registry)
Returns valid XSP mark-up which will be used by the Design editor in the XPages editor to visualize a control for the given DOM node. This method is different to getFullXSPMarkupForControl(Node, FacesRegistry) in that it does not need to return an entire XPage. This method will be called when the control that this visualizer represents is embedded within another control that is associated with an instance of RenderChildrenRecursiveCallback

The implementation of this method should be extremely light-weight. This method will be called repeatedly during the life-cycle of a control on an XPage. Any time-consuming work should NOT be performed within this method as it will adversely affect the performance of the XPage editor.
Clients with extremely complex controls should be careful not to over elaborate on their visualizations as any delay in creating a markup will impact editor performance.

Parameters:
nodeToVisualize - the DOM node from the XPage that requires a visualization
callback -
registry - the FacesRegistry for the current application
Returns:
valid markup representing an XSP page
See Also:
AbstractVisualizationFactory.IVisualizationCallback

printNode

public java.lang.String printNode(org.w3c.dom.Node n)
                           throws XMLException
Prints the provided node (including all of it's children) to a string.

Parameters:
n - a node that we wish to serialize to a String
Returns:
a String representation of the given node.
Throws:
XMLException - if the node provided contains invalid XML an XMLException will be generated