All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----xm.xm_Factory | +----xv.xv_ViewFactory
Factory for generating views for displaying XML nodes in a JEditorPane. Since the constructors of swing.text.View objects must be passed the Element of which they are Views, this class can only create Views given an actual Element object: a node type and/or name are not sufficient. Consequently this class has a more limited range of methods than other classes driven by the node type registry (eg. xm_NodeFactory).
Note that this factory can only create View objects which have a single- argument constructor, where that single argument is the element for which it is a View. This is a little irritating, since there are Views (such as BoxView) which take additional arguments, but is not a major problem in practice. This limitation could be lifted with a considerable amount of work - the bulk of which is in configuring the argument values to use and implementing a mechanism to make them accessible to this factory. One possibility is to use an XML configuration file, and pass the list of attributes associated with one element type to the View class for it to use as it wishes.
Another possible enhancement would be to use an XML configuration file (an extension to an XSL stylesheet?) to offer more flexibility than simply specifying a single View class for each registry entry. (This argument applies equally well to customizer classes.)
Given the name/type of an XML node (or a node itself), it creates a view object suitable for displaying it.
Create a view of a type suitable for displaying a node whose name is 'InputNodeName'.
public static final String UsualViewClassName
public static final String ElementClassName
protected Class ViewConstructorClasses[]
protected Object ViewConstructorArgs[]
public xv_ViewFactory()
public View createView(xg_Node InputNode) throws xv_ViewCreationException
Create a view of a type suitable for displaying a node whose name is 'InputNodeName'. If no view is registered for InputNodeName, then a custopmizer suitable for InputNodeType is created. This dual-level scheme allows special views to be added, while still creating views of the correct standard type the rest of the time.
Non-standard views can be added by registering them with xm_NodeTypeRegistry.
public String getViewClassName(String InputNodeName, int InputNodeType) throws xv_ViewCreationException
public View create(Element InputElement)
All Packages Class Hierarchy This Package Previous Next Index