org.enhydra.barracuda.core.view
Class FormatType

java.lang.Object
  extended byorg.enhydra.barracuda.core.view.FormatType
Direct Known Subclasses:
FormatType.GenericDataImpl

public abstract class FormatType
extends Object

This class defines all valid FormatTypes.

We start by defining a series of basic interfaces to define all known format types and specify how they relate to one another. Please note that these are hierarchical in nature. Strongly typed FormatType interfaces include:

We can reference these interfaces to determine what kind of FormatType we're actually dealing with. For instance, say we have a reference to a format type 'ft':

    ft = FormatType.HTML_4_0

Note here that we assigned the format type value by referring to a concrete instance of the format type (the idea here is that if you wish to assign a FormatType to some object you must select a concrete type).

Concrete format types include:

Now lets say we want to check if 'ft' is at least compatible with HTML 3.2, we can use the instanceOf() operator like this:

    if (ft instanceof FormatType.Html3x) {...}

Since FormatType.HTML_4_0 implements FormatType.Html3x the logic check succeeds and our 'if' statement is executed.

In case you are wondering 'Why in the world did we go to the effort to define all these interfaces and such' the reason is that we wanted to make it easy to check for "classes" of formats (ie. anything that conforms to HTML 3.2 for instance...an HTML 4.0 browser does). The net effect of this is that you can write code that targets a baseline and as new versions come out your code will continue to work.

The reason we used interfaces is that as code evolves it sometimes supports more than one format. XHTML is an excellent example of this. There are 2 different flavors of this: XHTML Basic is a subset of XHTML. What this means is that XHTML_1_x should be an instance of XHTML_Basic. However, it should also be an instance of XHTML_Basic_1_x. Since Java does not allow multiple inheritance in concrete classes, we had to instead use interfaces so that a given format can specify support multiple formats.


Nested Class Summary
static interface FormatType.AsciiData
           
protected static class FormatType.AsciiDataImpl
           
static interface FormatType.BinaryData
           
protected static class FormatType.BinaryDataImpl
           
static interface FormatType.Chtml
           
protected static class FormatType.Chtml1_0Impl
           
static interface FormatType.Chtml1x
           
protected static class FormatType.Chtml1xImpl
           
protected static class FormatType.Chtml2_0Impl
           
static interface FormatType.Chtml2x
           
protected static class FormatType.Chtml2xImpl
           
protected static class FormatType.ChtmlImpl
           
static interface FormatType.Doc
           
protected static class FormatType.DocImpl
           
static interface FormatType.Exe
           
protected static class FormatType.ExeImpl
           
static interface FormatType.GenericData
           
protected static class FormatType.GenericDataImpl
           
static interface FormatType.Html
           
protected static class FormatType.Html3_0Impl
           
protected static class FormatType.Html3_1Impl
           
protected static class FormatType.Html3_2Impl
           
static interface FormatType.Html3x
           
protected static class FormatType.Html3xImpl
           
protected static class FormatType.Html4_0Impl
           
protected static class FormatType.Html4_1Impl
           
static interface FormatType.Html4x
           
protected static class FormatType.Html4xImpl
           
static interface FormatType.HtmlBasic
           
protected static class FormatType.HtmlBasicImpl
           
protected static class FormatType.HtmlImpl
           
static interface FormatType.Pdf
           
protected static class FormatType.PdfImpl
           
static interface FormatType.Rtf
           
protected static class FormatType.RtfImpl
           
static interface FormatType.UnknownFormat
           
protected static class FormatType.UnknownFormatImpl
           
static interface FormatType.Vxml
           
protected static class FormatType.Vxml1_0Impl
           
static interface FormatType.Vxml1x
           
protected static class FormatType.Vxml1xImpl
           
protected static class FormatType.VxmlImpl
           
static interface FormatType.Wml
           
protected static class FormatType.Wml1_0Impl
           
static interface FormatType.Wml1x
           
protected static class FormatType.Wml1xImpl
           
protected static class FormatType.WmlImpl
           
static interface FormatType.Xhtml
           
static interface FormatType.XhtmlBasic
           
protected static class FormatType.XhtmlBasic1_0Impl
           
static interface FormatType.XhtmlBasic1x
           
protected static class FormatType.XhtmlBasic1xImpl
           
static interface FormatType.XhtmlBasic2x
           
protected static class FormatType.XhtmlBasicImpl
           
protected static class FormatType.XhtmlImpl
           
static interface FormatType.XhtmlStandard
           
protected static class FormatType.XhtmlStandard1_0Impl
           
static interface FormatType.XhtmlStandard1x
           
protected static class FormatType.XhtmlStandard1xImpl
           
static interface FormatType.XhtmlStandard2x
           
protected static class FormatType.XhtmlStandardImpl
           
static interface FormatType.Xml
           
protected static class FormatType.Xml1_0Impl
           
static interface FormatType.Xml1x
           
protected static class FormatType.Xml1xImpl
           
protected static class FormatType.XmlImpl
           
 
Field Summary
static FormatType CHTML_1_0
           
static FormatType CHTML_2_0
           
protected  Class domCl
           
static FormatType HTML_3_0
           
static FormatType HTML_3_1
           
static FormatType HTML_3_2
           
static FormatType HTML_4_0
           
static FormatType HTML_4_1
           
static FormatType UNKNOWN_FORMAT
           
static FormatType VXML_1_0
           
static FormatType WML_1_0
           
static FormatType XHTML_BASIC_1_0
           
static FormatType XHTML_STANDARD_1_0
           
static FormatType XML_1_0
           
 
Constructor Summary
protected FormatType()
          Private constructor to prevent external instantiation
 
Method Summary
 Class getDOMClass()
          Get the DOM class associated with this particular format type.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_3_0

public static final FormatType HTML_3_0

HTML_3_1

public static final FormatType HTML_3_1

HTML_3_2

public static final FormatType HTML_3_2

HTML_4_0

public static final FormatType HTML_4_0

HTML_4_1

public static final FormatType HTML_4_1

CHTML_1_0

public static final FormatType CHTML_1_0

CHTML_2_0

public static final FormatType CHTML_2_0

XML_1_0

public static final FormatType XML_1_0

VXML_1_0

public static final FormatType VXML_1_0

WML_1_0

public static final FormatType WML_1_0

XHTML_BASIC_1_0

public static final FormatType XHTML_BASIC_1_0

XHTML_STANDARD_1_0

public static final FormatType XHTML_STANDARD_1_0

UNKNOWN_FORMAT

public static final FormatType UNKNOWN_FORMAT

domCl

protected Class domCl
Constructor Detail

FormatType

protected FormatType()
Private constructor to prevent external instantiation

Method Detail

getDOMClass

public Class getDOMClass()
Get the DOM class associated with this particular format type. This is useful because it makes it possible for components to look up a Renderer by getting the DOM class from the format type. By default, returns a reference to Node.class. HTML formats return a reference to HTMLElement.class.

Returns:
the DOM class associated with this particular format type.

main

public static void main(String[] args)


Copyright © 2003 BarracudaMVC.org All Rights Reserved.