Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Tag Conversion Design

Revision as of 18:17, 8 January 2007 by Cameron.bateman.oracle.com (Talk | contribs) (Tag Conversion Factories)

Overview

This design note describes a proposed design for model view conversion from JSP/JSF tags to HTML in the Visual Page Designer. This document should be considered tentative and highly subject change.

The design-time render engine for the Visual Page Designer (VPD) is an HTML/CSS visual renderer. It relies on a transformed view of the JSP page model that approximates the HTML/CSS output that the real runtime servlet would generate to render a page. To accomplish the conversion of the design time model, the VPD uses the concept of a ITagConverter.

One or more factories is consulted to construct ITagConverter for each tag found in the source document. For each tag that has an ITagConverter constructed, transforming of the tag to the corresponding HTML is delegated.

Tag Converters

Tag converters are transformative adapters that create one-to-one mappings from source model tags to renderable HTML elements. Each converter may be thought of as a mapping function, f where:

f: Tjsp -> Thtml

where T is the set of all valid tags, Tjsp is the the subset of T containing only valid JSP source document tags and Thtml is the subset of T containing only valid HTML 4.01 tags. f is not guaranteed to be strictly bijective. However, given a fixed Tjsp, Gjsp (i.e. a specific JSP source document), the set Gf (the resulting HTMl document) will always have a bijective relationship to Gjsp. Thus, for any resulting HTML rendered tag, a reverse mapping to the source JSP tag should always be possible. Although a possible exception may occur with tags that use the Composition archetypes (see Archetypes below), since composed objects may involve generating multiple sibling HTML tags for a single JSP/JSF tag (for example, a tabbed panel).

Transformation-based Tag Converters

While an extension-point based system is provided (see Factories below) for creation of customized tag converters, the preferred method of tag conversion is create transformation mappings through the use of meta-data. In this scenario, the following class structure is provided as the "workhorse" tag converter for doing most model adaption:

Tag conversion factories create ITagConverters based on the type of tag that exists in the source model.

TagConverter.png

The DTTagConverter implements that main logic for meta-data driven conversion. The converter has (possibly pluggable) IOutputRenderer that does the work of converting an input tag into a basic HTML output. To do this, the IOutputRenderer has transformer class in the form of ITagTransformer. The ITagTransformer uses a map of ITransformStrategy's that are used to perform transformations on source tags to produce an ever-more exact approximation of the final HTML for rendering.

Before consulting ITagTransformer for the tag transformation, IOutputRenderer calls decorate() on each of its ITransformDecorator's to put additional logic into the transform. This mechanism is pluggable and can allow multiple sources of knowledge about the rendering to be injected by sources such as meta-data, tag instantiators, customizers and (some day) a mock servlet mechanism.

Tag Conversion Factories

Tag conversion factories are used to create and configure tag converters based on the properties of the tag, the state of the system and other possible information contributed by third-parties.

TagConverterFactory.png

The ComposedTagConversionFactory composes multiple IConverterFactory's and is the single source used by the HTML renderer to determine what ITagConverter should be used for each tag. In most cases, the SystemTagConverterFactory will be used for all tags. Providers of component tooling and meta-data may override this with their own factory through an extension point.

Archetype-driven Transforms

Back to the top