How do I create a new view to the HTMLFactory? For example, an HTML.Tag.HEAD?

Sandip Chitale

Here is an excerpt from the JDK1.2 API javadoc of HTMLEditorKit. That should help -


The default view of the models are provided as a hierarchy of View implementations, so one can easily customize how a particular element is displayed or add capabilities for new kinds of elements by providing new View implementations. The default set of views are provided by the HTMLFactory class. This can be easily changed by subclassing or replacing the HTMLFactory and reimplementing the getViewFactory method to return the alternative factory.

The View implementations work primarily off of CSS attributes, which are kept in the views. This makes it possible to have multiple views mapped over the same model that appear substantially different. This can be especially useful for printing. For most html attributes, the html attributes are converted to css attributes for display. This helps make the View implementations more general purpose.